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

Fix detect unit tests to test false negatives as well #868

Conversation

vinnamkim
Copy link
Contributor

@vinnamkim vinnamkim commented Mar 20, 2023

Summary

  • Ticket no. 104511
  • To test false positive, change detect() test from assertIn() to assertEqual().
  • In addition, add false positive test code as well to some datasets which must have multiple candidates from
    detect() in nature (e.g. kitti).
  • Refactor Importer.detect() confidence return logic.
  • Some addition fixes for dataset format plugins during this work.

How to test

This changes includes tests as well.

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​
  • I have added the description of my changes into CHANGELOG.​
  • I have updated the documentation accordingly

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

@vinnamkim vinnamkim changed the base branch from develop to releases/1.1.0 March 20, 2023 05:55
@vinnamkim vinnamkim changed the title Fix detect unit tests to test false negatives Fix detect unit tests to test false negatives as well Mar 20, 2023
@vinnamkim vinnamkim added this to the 1.1.0 milestone Mar 20, 2023
@vinnamkim vinnamkim added the BUG Something isn't working label Mar 20, 2023
@chuneuny-emily chuneuny-emily added FIX defect fix and removed BUG Something isn't working labels Mar 20, 2023
@vinnamkim vinnamkim force-pushed the bugfix/test-false-negative-detect branch 2 times, most recently from ecb7ef3 to 2f0addb Compare March 20, 2023 06:50
 - To test false positive, change detect() test from assertIn() to assertEqaul().
 - In addition, add false positive test code to some datasets which must have multi candidates from
detect().
 - Refactor Importer.detect() confidence return logic.
 - Some addition fixes for dataset format plugins during this work.

Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
@vinnamkim vinnamkim force-pushed the bugfix/test-false-negative-detect branch from 2f0addb to 12302f8 Compare March 20, 2023 07:14
@vinnamkim vinnamkim marked this pull request as ready for review March 20, 2023 07:19
@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (fc7f607) 78.49% compared to head (12302f8) 78.52%.

Additional details and impacted files
@@                Coverage Diff                 @@
##           releases/1.1.0     #868      +/-   ##
==================================================
+ Coverage           78.49%   78.52%   +0.02%     
==================================================
  Files                 206      206              
  Lines               24939    24961      +22     
  Branches             5007     5011       +4     
==================================================
+ Hits                19577    19601      +24     
+ Misses               4236     4235       -1     
+ Partials             1126     1125       -1     
Flag Coverage Δ
macos-11_Python-3.8 77.50% <100.00%> (+0.02%) ⬆️
ubuntu-20.04_Python-3.8 78.51% <100.00%> (+0.02%) ⬆️
windows-2019_Python-3.8 78.45% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
datumaro/components/format_detection.py 93.58% <100.00%> (+0.03%) ⬆️
datumaro/components/importer.py 90.00% <100.00%> (+0.31%) ⬆️
datumaro/plugins/data_formats/image_dir.py 80.55% <100.00%> (-1.50%) ⬇️
datumaro/plugins/data_formats/imagenet.py 91.25% <100.00%> (+1.10%) ⬆️
datumaro/plugins/data_formats/kitti/importer.py 85.00% <100.00%> (+5.93%) ⬆️
datumaro/plugins/data_formats/market1501.py 91.22% <100.00%> (+0.15%) ⬆️
datumaro/plugins/data_formats/mvtec/importer.py 100.00% <100.00%> (ø)
datumaro/util/definitions.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@sooahleex sooahleex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I have one question, is there any reason to check whether images is under blacklisted folder only for imagenet dataset?

@vinnamkim
Copy link
Contributor Author

Looks good to me. I have one question, is there any reason to check whether images is under blacklisted folder only for imagenet dataset?

Because imagenet format has very loose condition to be detected (sub-directories filled with images), we need to add the blacklist names to prevent it from being falsely detected.

Copy link
Contributor

@wonjuleee wonjuleee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your great work!

@vinnamkim vinnamkim merged commit bb72953 into openvinotoolkit:releases/1.1.0 Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIX defect fix RELEASE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants