CRAFT for text detection and location in images, implemented in python and pytorch

#ai #document-processing #text-detection #ocr #fer-r-and-d #Fern-R&D

boomb0om 20f0c94d6b fix: fix model urls and polygons пре 1 година
CRAFT 20f0c94d6b fix: fix model urls and polygons пре 1 година
images ebe3b1f3ee Initial commit пре 2 година
.gitignore ebe3b1f3ee Initial commit пре 2 година
README.md 6ebe2173b3 Update README.md пре 2 година
example.ipynb bcac40da7a Fix imports пре 2 година
requirements.txt ebe3b1f3ee Initial commit пре 2 година
setup.py edc23e8b85 Fix installation пре 2 година
test.py ebe3b1f3ee Initial commit пре 2 година

README.md

CRAFT-text-detection

An unofficial PyTorch implementation of CRAFT text detector with better interface and fp16 support

This is not official implementation. I partially use code from the original repository

Main features of this implementation:

  • User-friendly interface
  • Easier to integrate this model in your project
  • fp16 inference support
  • Automatically downloading weights from huggingface

Installation

Recommended:

pip install git+https://github.com/boomb0om/CRAFT-text-detection/

or

git clone https://github.com/boomb0om/CRAFT-text-detection
cd CRAFT-text-detection/
pip install -r requirements.txt

To test model you can run test.py file.

Examples

from PIL import Image
from CRAFT import CRAFTModel, draw_polygons

model = CRAFTModel('weights/', 'cuda', use_refiner=True, fp16=True)
img = Image.open('images/cafe_sign.jpg')
polygons = model.get_polygons(img)
result = draw_polygons(img, polygons)

You can find more usage examples in example.ipynb

Detected polygons: