-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Error with pyclipper inhomogeneous expanded array #12108
Conversation
For some images, `np.array(offset.Execute(distance))` can result in inhomogeneous part of the detection box list, which cannot be casted into numpy array directly.
Thanks for your contribution! |
not work for me paddleocr --image_dir doc/imgs/1.jpg --det_box_type poly
|
- box reshape was mistakenly done at line 145 which is now correctly done at line 92 of `db_postprocess.py` - if box is empty then continue
- reverted mistakenly changed `box.array(box)` to `np.array(box)`
Hi @GreatV, I have fixed the code now. Actually there should have been numpy array conversion at line 92. Just in case the image attached in the description doesn't reproduce the error, here is another one. |
|
|
hi @zovelsanj, please ensure it works well for both 'quad' and 'poly'. |
For `--det_box_type = poly`, pad the detected polygon arrays if they have different shapes to ensure even shapes of polygon arrays
Hi @GreatV, thanks. I only checked it for |
@zovelsanj, please install and configure pre-commit to pass the CI checks. I will run some tests to verify if it is working correctly. |
It works. paddleocr --image_dir doc/imgs/1.jpg
paddleocr --image_dir doc/imgs/1.jpg --det_box_type poly
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@zovelsanj Thanks for your contribution! You will receive a beautiful PaddlePaddle gift. Please provide your mailing address by filling out the following questionnaire before October 18th. Looking forward to the future, we will walk further together in the world of open source! |
@zovelsanj Could you provide your phone number? We need this information when mailing gifts. Please send your phone number to ext_paddle_oss@baidu.com. Thanks very much! |
In case of
det_box_type='poly'
, for some images,np.array(offset.Execute(distance))
can result in inhomogeneous part of the detection box list, which cannot be casted into numpy array directly. Due to this the following error occurs:This is because the
expanded
list frompyclipper
'soffset.Execute
is an inhomogeneous list. For example, in the case of the following image:the
expanded
list (before converting to numpy array) is as follows:[[[47, 79], [45, 79], [46, 78]], [[56, 78], [58, 78], [59, 79], [55, 79]]]
which is an inhomogeneous list and cannot be cast directly to the numpy array. Suchexpanded
lists generally represent the detections with very small area thus resembling lines instead of polygons. Thus, it is better to eliminate such detections.