PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Apache License 2.0
39.75k stars 7.39k forks source link

支持网络图片获得每个文字的位置吗?谢谢 #12082

Closed tang9527 closed 1 month ago

tang9527 commented 1 month ago

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

下面代码是按 block 获得的位置,请问可以获得每个文字的坐标吗?谢谢

from paddleocr import PaddleOCR, draw_ocr
import matplotlib.pyplot as plt

ocr = PaddleOCR()

img_path = './11.jpg'
result = ocr.ocr(img_path, cls=True)

for line in result:
    for word in line:
        print('letter:', word[0], 'coordinate:', word[1])
letter: [[28.0, 37.0], [302.0, 39.0], [302.0, 72.0], [27.0, 70.0]] coordinate: ('纯臻营养护发素', 0.9978455901145935)
letter: [[26.0, 83.0], [173.0, 83.0], [173.0, 104.0], [26.0, 104.0]] coordinate: ('产品信息/参数', 0.9898436665534973)
letter: [[27.0, 112.0], [331.0, 112.0], [331.0, 135.0], [27.0, 135.0]] coordinate: ('(45元/每公斤,100公斤起订)', 0.965930700302124)
letter: [[25.0, 143.0], [281.0, 143.0], [281.0, 165.0], [25.0, 165.0]] coordinate: ('每瓶22元,1000瓶起订)', 0.9928770661354065)
letter: [[26.0, 179.0], [300.0, 179.0], [300.0, 195.0], [26.0, 195.0]] coordinate: ('【品牌】:代加工方式/OEMODM', 0.9844002723693848)
letter: [[26.0, 210.0], [234.0, 210.0], [234.0, 227.0], [26.0, 227.0]] coordinate: ('【品名】:纯臻营养护发素', 0.9963191151618958)
letter: [[25.0, 239.0], [241.0, 239.0], [241.0, 259.0], [25.0, 259.0]] coordinate: ('【产品编号】:YM-X-3011', 0.9848068952560425)
letter: [[413.0, 232.0], [430.0, 232.0], [430.0, 306.0], [413.0, 306.0]] coordinate: ('ODMOEM', 0.9908114075660706)
letter: [[24.0, 271.0], [180.0, 271.0], [180.0, 290.0], [24.0, 290.0]] coordinate: ('【净含量】:220ml', 0.9892366528511047)
letter: [[26.0, 303.0], [251.0, 303.0], [251.0, 319.0], [26.0, 319.0]] coordinate: ('【适用人群】:适合所有肤质', 0.9909264445304871)
letter: [[26.0, 335.0], [344.0, 335.0], [344.0, 352.0], [26.0, 352.0]] coordinate: ('【主要成分】:鲸蜡硬脂醇、燕麦β-葡聚', 0.9828734397888184)
letter: [[26.0, 364.0], [281.0, 364.0], [281.0, 384.0], [26.0, 384.0]] coordinate: ('糖、椰油酰胺丙基甜菜碱、泛醌', 0.9505259394645691)
letter: [[368.0, 368.0], [477.0, 368.0], [477.0, 389.0], [368.0, 389.0]] coordinate: ('(成品包材)', 0.9920769333839417)
letter: [[26.0, 397.0], [360.0, 397.0], [360.0, 414.0], [26.0, 414.0]] coordinate: ('【主要功能】:可紧致头发磷层,从而达到', 0.9904391765594482)
letter: [[28.0, 429.0], [370.0, 429.0], [370.0, 445.0], [28.0, 445.0]] coordinate: ('即时持久改善头发光泽的效果,给干燥的头', 0.9874253273010254)
letter: [[27.0, 458.0], [137.0, 458.0], [137.0, 479.0], [27.0, 479.0]] coordinate: ('发足够的滋养', 0.9987402558326721)
UserWangZz commented 1 month ago

你好,这个字符级检测暂不支持的,检测模型都是行级标注和词级标注训练的

tang9527 commented 1 month ago

好的,谢谢