-
Notifications
You must be signed in to change notification settings - Fork 60
修改 lanms 包安装的判定条件 #740
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
修改 lanms 包安装的判定条件 #740
Conversation
|
||
def test_lanms(self): | ||
expect_result = np.array([[8.611, 10, 8.611, 56.11, 30, 56.11, 30, 10, 1.8], [0, 0, 0, 20, 10, 20, 10, 0, 0.8]]) | ||
assert np.allclose(merge_quadrangle_n9([box1, box2, box3]), expect_result, 1e-2) | ||
assert np.allclose(merge_quadrangle_n9([box1, box2, box3]), expect_result, 1e-2) is True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np.allclose 可直接返回比较结果,无需使用 is True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np.allclose 可直接返回比较结果,无需使用 is True
是的,之后统一清理小问题。
@@ -16,8 +28,15 @@ def test_weighted_merge(self): | |||
assert np.allclose(weighted_merge(box1, box2), expect_result, rtol=1e-2) is True | |||
|
|||
def test_standard_nms(self): | |||
assert np.allclose(standard_nms([box2, box3], 0.5), box3, 1e-5) | |||
assert np.allclose(standard_nms([box2, box3], 0.5), box3, 1e-5) is True | |||
|
|||
def test_lanms(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
希望测试方法名清晰地描述它们的功能,如test_standard_nms、test_calculate_iou描述都是清晰的,但 test_lanms 稍显笼统,不便明确含义,建议可以更具体一些(如 test_merge_quadrangle_n9_with_multiple_boxes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
希望测试方法名清晰地描述它们的功能,如test_standard_nms、test_calculate_iou描述都是清晰的,但 test_lanms 稍显笼统,不便明确含义,建议可以更具体一些(如 test_merge_quadrangle_n9_with_multiple_boxes)
lanms 是完整的算法。这个是 E2E 的测试。
for origin_box_test in origin_boxes_test: | ||
real_results.append(sorted(merge_quadrangle_n9(origin_box_test), key=lambda x: x[0])) | ||
for i, real_result in enumerate(real_results): | ||
assert np.allclose(real_result, expect_processed_boxes_test[i], 1e-2) is True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议添加断言错误的提示消息,以便在断言失败时方便问题定位
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议添加断言错误的提示消息,以便在断言失败时方便问题定位
测试内容在函数名称已经写明。
@@ -16,8 +28,15 @@ def test_weighted_merge(self): | |||
assert np.allclose(weighted_merge(box1, box2), expect_result, rtol=1e-2) is True | |||
|
|||
def test_standard_nms(self): | |||
assert np.allclose(standard_nms([box2, box3], 0.5), box3, 1e-5) | |||
assert np.allclose(standard_nms([box2, box3], 0.5), box3, 1e-5) is True | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议添加断言错误的提示消息,以便在断言失败时方便问题定位
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议添加断言错误的提示消息,以便在断言失败时方便问题定位
同上
data = json.loads(f.readline()) | ||
origin_boxes_test.append(np.array(data["origin_boxes"])) | ||
expect_processed_boxes_test.append(sorted(np.array(data["processed_boxes"]), key=lambda x: x[0])) | ||
|
||
|
||
class TestLanmsPy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议为类以及函数添加适当的文档,解释具体的功能与参数
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议为类以及函数添加适当的文档,解释具体的功能与参数
本部分代码较短,变量名称已经覆盖意义,多余的注释意义不大。
当以下 2 个条件均满足时,才引入 lanms 包。
(1)python 版本 <= 3.10
(2)系统为 linux
Thank you for your contribution to the MindOCR repo.
Before submitting this PR, please make sure:
Motivation
(Write your motivation for proposed changes here.)
Test Plan
python 3.9 + Ascend 910B + Linux 下验证
Related Issues and PRs
(Is this PR part of a group of changes? Link the other relevant PRs and Issues here. Use https://help.github.com/en/articles/closing-issues-using-keywords for help on GitHub syntax)