CRAFT 是一个多语言文本检测模型。其原始实现位于 https://github.com/clovaai/CRAFT-pytorch。本仓库仅与 Hezar 包(>=v0.40.0)兼容,以用于波斯语文本检测,但其他语言也应适用。
pip install hezar[vision]from hezar.models import Model
from hezar.utils import load_image, draw_boxes, show_image
model = Model.load("hezarai/CRAFT", device="cuda")
image = load_image("../assets/text_detection_example.jpg")
outputs = model.predict(image)
result_image = draw_boxes(image, outputs[0]["boxes"])
show_image(result_image, "text_detected")