fix: remove zero boxes after detection #198
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CRAFT text detection produced false positive detections under some condition (e.g. with text_threshold = 0.01, link_threshold = 0.01, low_text = 0.1 and my pictures).
While most of the predicted text boxes are correct, there are wrong predictions containing only zero values (screenshot showes print of 4 predicted boxes and there are 2 wrong boxes only with zeros as values).
That can lead to an error within the craft module depending on the OpenCV version.
I recognized the following error with opencv-python-4.5.4.60:
cv2.error: OpenCV(4.5.4) matrix.cpp:466: error: (-215:Assertion failed) _step >= minstep in function 'cv::Mat::Mat'
To fix that problem, I added a check to remove the zero boxes for further steps