Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

padded_polygon = np.array(padding.Execute(distance)[0]) IndexError: list index out of range #115

Closed
dengfenglai321 opened this issue Nov 10, 2020 · 8 comments

Comments

@dengfenglai321
Copy link

以下代码报错
make_order_map.py

padded_polygon = np.array(padding.Execute(distance)[0])

File "/data2/deliancen/workpace/OCR/PytorchOCR/torchocr/datasets/det_modules/make_border_map.py", line 54, in draw_border_map
padded_polygon = np.array(padding.Execute(distance)[0])
IndexError: list index out of range

@novioleo
Copy link
Collaborator

@cendelian 抱歉看到晚了。能麻烦print一下错误的时候distance的值么

@dengfenglai321
Copy link
Author

dengfenglai321 commented Nov 12, 2020

@cendelian 抱歉看到晚了。能麻烦print一下错误的时候distance的值么
image

对应的代码如下:

    # if padding.Execute(distance) is None:
        #     print('None')
        print('distance : ',distance)
        print('----------------------------')
        padded_polygon = np.array(padding.Execute(distance)[0])
        print('padded_polygon: ',padded_polygon)
        cv2.fillPoly(mask, [padded_polygon.astype(np.int32)], 1.0)

请问该怎么解决?
运行时batch :1, numworker:1

@novioleo
Copy link
Collaborator

这个是你这个标注数据区域shrink的话太小,小于0了。你可以调整shrink比例,也可以check一下你的这个case的标注情况。

@dengfenglai321
Copy link
Author

这个是你这个标注数据区域shrink的话太小,小于0了。你可以调整shrink比例,也可以check一下你的这个case的标注情况。

shrink比例在哪里调?调小还是调大?
还有一样的数据集,我在大佬WenmuZhou / DBNet.pytorch这个项目里就能跑通没有任何错误。

我感觉WenmuZhou / DBNet.pytorch 和WenmuZhou / PytorchOCR这两个项目的文本检测部分都差不多吧

@dengfenglai321
Copy link
Author

这个是你这个标注数据区域shrink的话太小,小于0了。你可以调整shrink比例,也可以check一下你的这个case的标注情况。

我使用WenmuZhou / DBNet.pytorch跑一样的数据集,推理发现结果的标注的确比正常文本框要小。。。比如下图:
image

大佬该怎么调shrink呢?
实在config下调那个shrink_ratio吗?调大?
# db 预处理,不需要修改

            'pre_processes': [{'type': 'IaaAugment', 'args': [{'type': 'Fliplr', 'args': {'p': 0.5}},
                                                              {'type': 'Affine', 'args': {'rotate': [-10, 10]}},
                                                              {'type': 'Resize', 'args': {'size': [0.5, 3]}}]},
                              {'type': 'EastRandomCropData', 'args': {'size': [640, 640], 'max_tries': 50, 'keep_ratio': True}},
                              {'type': 'MakeBorderMap', 'args': {'shrink_ratio': 0.4, 'thresh_min': 0.3, 'thresh_max': 0.7}},
                              {'type': 'MakeShrinkMap', 'args': {'shrink_ratio': 0.4, 'min_text_size': 8}}],

@WenmuZhou
Copy link
Owner

框小了,需要unclip_ratio调大

@dengfenglai321
Copy link
Author

框小了,需要unclip_ratio调大

大佬你好,我将unclip_ration调到2.0了 还是报一样的错误

@novioleo
Copy link
Collaborator

我觉得是标注的数据有点问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants