|
--- |
|
language: |
|
- fa |
|
- en |
|
library_name: hezar |
|
pipeline_tag: object-detection |
|
tags: |
|
- hezar |
|
--- |
|
## CRAFT: Character-Region Awareness For Text detection |
|
|
|
CRAFT is a multilingual text detection model. The original implementation is located at https://github.com/clovaai/CRAFT-pytorch. This repo is only compatible |
|
with the [Hezar](https://github.com/hezarai/hezar) package. |
|
|
|
|
|
### Usage |
|
``` |
|
pip install hezar[vision] |
|
``` |
|
```python |
|
import cv2 |
|
from hezar.models import Model |
|
from hezar.utils import draw_boxes |
|
|
|
|
|
model = Model.load("hezarai/CRAFT", device="cuda") |
|
outputs = model.predict("../assets/text_detection_example.png") |
|
image = cv2.imread("../assets/text_detection_example.png") |
|
result_image = draw_boxes(image, outputs[0]["boxes"]) |
|
cv2.imwrite("detected.png", result_image) |
|
``` |