AstarLight / Lets_OCR

A repository for OCR, which inlcudes some classical OCR algorithms Pytorch implementation such as CTPN, EAST and CRNN.
MIT License
656 stars 327 forks source link

ctpn项目中,为什么所有anchor的bottom坐标都比top坐标要大 #60

Closed Nobody0321 closed 5 years ago

Nobody0321 commented 5 years ago

您好,我最近在研读你的ctpn项目代码,有一个小小的疑问,为什么所有anchor的bottom坐标都比 top坐标要大?比如./lib/generate_gt_anchor.py第37行, h = y_bottom[i] - y_top[i] + 1 # the height of anchor box 高度的计算默认bottom比top大,下面的cal_y_top_and_bottom()函数中,y_top明显是从下往上找到的,而y_bottom是从上往下找到的。 相同的情况在./lib/tag_anchor.py文件的cal_y()函数中也出现了。 我对cv领域不太了解,想请问一下这个是后面训练有要求还是cv领域特有的讲究?

Nobody0321 commented 5 years ago

在ctpn/infer.py中

        b1 = line[6] - line[7] / 2  # 根据高度和文本行中心线,求取文本行上下两条线的b值
        b2 = line[6] + line[7] / 2
        x1 = line[0]
        y1 = line[5] * line[0] + b1  # 左上
        x2 = line[2]
        y2 = line[5] * line[2] + b1  # 右上
        x3 = line[0]
        y3 = line[5] * line[0] + b2  # 左下
        x4 = line[2]
        y4 = line[5] * line[2] + b2  # 右下

按理说,b1小于b2吧,y1应该是左下,y2是右下,y3是左上,y4是右上才对