Support rectangle in draw_boxes and relocate draw_ser_results #755
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.
Thank you for your contribution to the MindOCR repo.
Before submitting this PR, please make sure:
Motivation
Update
mindocr.utils.visualize.draw_boxes
function to supportrectangle
draw_type:The current draw_boxes function only supports drawing polygons. Adding support for drawing rectangles will enhance its versatility and make it more useful for various applications that require drawing bounding boxes in both polygon and rectangle formats.
Move
tools.infer.text.predict_ser.draw_ser_results
tomindocr.utils.visualize:
The draw_ser_results function is currently located in
tools.infer.text.predict_ser
, which may not be the most intuitive location for a utility function that deals with visualizing OCR results. Moving it tomindocr.utils.visualize
will improve the organization of the codebase, making it easier for developers to find and use this function.Test Plan
case one (
python tools/infer/text/predict_det.py --image_dir configs/kie/vi_layoutxlm/example.jpg --det_algorithm DB++
):case two(

python tools/infer/text/predict_ser.py --det_algorithm DB++ --rec_algorithm CRNN_CH --image_dir configs/kie/vi_layoutxlm/example.jpg
)case one (
python tools/infer/text/predict_det.py --image_dir configs/kie/vi_layoutxlm/example.jpg --det_algorithm DB++
):case two(

python tools/infer/text/predict_ser.py --det_algorithm DB++ --rec_algorithm CRNN_CH --image_dir configs/kie/vi_layoutxlm/example.jpg
)case three(test for draw_boxes with
rectangle
draw_type):