Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Apache License 2.0
0
stars
0
forks
source link
Refactor tools/end2end/eval_end2end.py for modularity #6
This PR refactors the tools/end2end/eval_end2end.py file to improve its modularity. The e2e_eval function, which was previously large and complex, has been broken down into smaller, more manageable functions. This makes the code easier to understand and maintain.
Summary of Changes
Extracted the code block for reading the ground truth and prediction files into a separate function named read_files.
Extracted the code block for calculating the Intersection over Union (IoU) between two polygons into a separate function named calculate_iou.
Extracted the code block for calculating the edit distance between two strings into a separate function named calculate_edit_distance.
Extracted the code block for matching ground truth and prediction data into a separate function named match_gt_and_pred.
Extracted the code block for calculating the precision, recall, and f-measure into a separate function named calculate_metrics.
Modified the e2e_eval function to call the newly created functions.
Fixes #1.
🎉 Latest improvements to Sweep:
Sweep now uses the rope library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, try sweep: Refactor <your_file>.py to be more modular!
Description
This PR refactors the
tools/end2end/eval_end2end.py
file to improve its modularity. Thee2e_eval
function, which was previously large and complex, has been broken down into smaller, more manageable functions. This makes the code easier to understand and maintain.Summary of Changes
read_files
.calculate_iou
.calculate_edit_distance
.match_gt_and_pred
.calculate_metrics
.e2e_eval
function to call the newly created functions.Fixes #1.
🎉 Latest improvements to Sweep:
rope
library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, trysweep: Refactor <your_file>.py to be more modular
!💡 To get Sweep to edit this pull request, you can: