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

Add label groups for hierarchical classification in ImageNet #1645

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

itrushkin
Copy link
Contributor

@itrushkin itrushkin commented Oct 15, 2024

Summary

This PR adds grouping of labels (directories for the ImageNet case) by their groups (parent directories).
For example, for the following folder structure

.
├── label_1
│   └── label_1_1
│       └── 1.jpg
└── label_2
    └── label_2_1
        └── 2.jpg

label groups will be label_1 and label_2.

Note: for the higher depth of nesting, names of groups will be relative paths of second-to-last directories. For the following case:

.
├── label_1
│   └── label_1_1
│       └── label_1_1_1
│           └── 1.jpg
│        
└── label_2
    └── label_2_1
        └── label_2_1_1
            └── 2.jpg

label groups will be label_1/label_1_1 and label_2/label_2_1.

How to test

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) 2024 Intel Corporation
#
# SPDX-License-Identifier: MIT

@itrushkin itrushkin requested review from a team as code owners October 15, 2024 15:14
@itrushkin itrushkin requested review from wonjuleee and removed request for a team October 15, 2024 15:14
Signed-off-by: Ilya Trushkin <[email protected]>
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.22%. Comparing base (ff5fd94) to head (3f48944).
Report is 21 commits behind head on develop.

Files with missing lines Patch % Lines
src/datumaro/plugins/data_formats/imagenet.py 66.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1645      +/-   ##
===========================================
+ Coverage    81.06%   81.22%   +0.16%     
===========================================
  Files          278      281       +3     
  Lines        32517    32889     +372     
  Branches      6607     5291    -1316     
===========================================
+ Hits         26360    26715     +355     
- Misses        4701     4723      +22     
+ Partials      1456     1451       -5     
Flag Coverage Δ
ubuntu-20.04_Python-3.10 81.20% <66.66%> (+0.15%) ⬆️
windows-2022_Python-3.10 81.20% <66.66%> (+0.16%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Thanks @itrushkin, could you add parent information for each label?
For instance,
LabelCategories.Category(name='Clover', parent='', attributes=set()), LabelCategories.Category(name='Clover/Ace', parent='', attributes=set())
should be turned into
LabelCategories.Category(name='Clover', parent='', attributes=set()), LabelCategories.Category(name='Clover/Ace', parent='Clover', attributes=set())

@itrushkin
Copy link
Contributor Author

@wonjuleee Parent category property is implemented in daf6669

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.

LGTM! Thank you for your efforts!

@wonjuleee wonjuleee merged commit e79cca2 into openvinotoolkit:develop Oct 23, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants