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)
This PR refactors the eval_end2end.py file in the tools/end2end directory to improve modularity and code organization. The following changes were made:
Extracted the code block that calculates the Intersection over Union (IoU) between two polygons into a separate function named calculate_iou.
Extracted the code block that calculates the edit distance between two strings into a separate function named calculate_edit_distance.
Extracted the code block that reads ground truth and detection results from files into a separate function named read_files.
Extracted the code block that matches ground truth and detection results based on IoU into a separate function named match_results.
Extracted the code block that calculates the precision, recall, and F-measure into a separate function named calculate_metrics.
These changes improve the modularity of the code and make it easier to understand and maintain.
Summary of Changes
Created a new function calculate_iou to calculate the Intersection over Union (IoU) between two polygons.
Created a new function calculate_edit_distance to calculate the edit distance between two strings.
Created a new function read_files to read ground truth and detection results from files.
Created a new function match_results to match ground truth and detection results based on IoU.
Created a new function calculate_metrics to calculate precision, recall, and F-measure.
These changes improve the code organization and make it more modular.
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
eval_end2end.py
file in thetools/end2end
directory to improve modularity and code organization. The following changes were made:calculate_iou
.calculate_edit_distance
.read_files
.match_results
.calculate_metrics
.These changes improve the modularity of the code and make it easier to understand and maintain.
Summary of Changes
calculate_iou
to calculate the Intersection over Union (IoU) between two polygons.calculate_edit_distance
to calculate the edit distance between two strings.read_files
to read ground truth and detection results from files.match_results
to match ground truth and detection results based on IoU.calculate_metrics
to calculate precision, recall, and F-measure.These changes improve the code organization and make it more modular.
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: