Skip to content
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

Refactor e2e_eval function and add unit tests #11193

Conversation

kevinlu1248
Copy link

This PR was copied from kevinlu1248#17, written by Sweep, and AI-powered junior developer.

Description

This PR refactors the e2e_eval function in tools/end2end/eval_end2end.py to make it more modular and adds unit tests in eval_end2end_tests.py. The e2e_eval function is quite large and complex, so it has been broken down into smaller, more manageable functions. Additionally, unit tests have been added to ensure the correctness of the code and make it easier to identify and fix bugs in the future.

Summary of Changes

  • Extracted the code block that calculates the Intersection over Union (IoU) between two polygons into a new function named calculate_iou in tools/end2end/utils.py.
  • Extracted the code block that calculates the edit distance between two strings into a new function named calculate_edit_distance in tools/end2end/utils.py.
  • Extracted the code block that calculates the precision, recall, and fmeasure into a new function named calculate_metrics in tools/end2end/utils.py.
  • Extracted the code block that handles the matching of ground truth and detected text into a new function named match_gt_and_dt in tools/end2end/utils.py.
  • Added unit tests for the extracted functions in eval_end2end_tests.py.

Please review and merge this PR. Thank you!

Fixes #1.


🎉 Latest improvements to Sweep:


💡 To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

Copy link

paddle-bot bot commented Nov 3, 2023

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Nov 3, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ sweep-nightly[bot]
❌ kevinlu1248
You have signed the CLA already but the status is still pending? Let us recheck it.

@shiyutang
Copy link
Collaborator

please sign the CLA and push your changes to the develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants