/ Machine Learning

Pytorch implementation of CRAFT text detector

Pytorch implementation of CRAFT text detector


Character-Region Awareness For Text detection.

Official Pytorch implementation of CRAFT text detector

Youngmin Baek, Bado Lee, Dongyoon Han, Sangdoo Yun, Hwalsuk Lee.

Clova AI Research, NAVER Corp.

Sample Results


PyTorch implementation for CRAFT text detector that effectively detect text area by exploring each character region and affinity between characters. The bounding box of texts are obtained by simply finding minimum bounding rectangles on binary map after thresholding character region and affinity scores.



13 Jun, 2019: Initial update

Getting started

Install dependencies


  • PyTorch>=0.4.1
  • torchvision>=0.2.1
  • opencv-python>=3.4.2
  • check requiremtns.txt
pip install -r requirements.txt


We are currently in the process of cleaning training code for disclosure.

Test instruction using pretrained model

  • Run with pretrained model
python test.py --trained_model=[weightfile] --test_folder=[folder path to test images]

The result image and socre maps will be saved to ./result by default.


  • --trained_model: pretrained model
  • --text_threshold: text confidence threshold
  • --low_text: text low-bound score
  • --link_threshold: link confidence threshold
  • --canvas_size: max image size for inference
  • --mag_ratio: image magnification ratio
  • --show_time: show processing time
  • --test_folder: folder path to input images


  title={Character Region Awareness for Text Detection},
  author={Baek, Youngmin and Lee, Bado and Han, Dongyoon and Yun, Sangdoo and Lee, Hwalsuk},
  journal={arXiv preprint arXiv:1904.01941},