openvinotoolkit / datumaro

Dataset Management Framework, a Python library and a CLI tool to build, analyze and manage Computer Vision datasets.
https://openvinotoolkit.github.io/datumaro/
MIT License
551 stars 135 forks source link

Add label groups for hierarchical classification in ImageNet #1645

Closed itrushkin closed 1 month ago

itrushkin commented 1 month ago

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

License

# Copyright (C) 2024 Intel Corporation
#
# SPDX-License-Identifier: MIT
codecov[bot] commented 1 month ago

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 :warning:
Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/openvinotoolkit/datumaro/pull/1645/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openvinotoolkit) | Coverage Δ | | |---|---|---| | [ubuntu-20.04_Python-3.10](https://app.codecov.io/gh/openvinotoolkit/datumaro/pull/1645/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openvinotoolkit) | `81.20% <66.66%> (+0.15%)` | :arrow_up: | | [windows-2022_Python-3.10](https://app.codecov.io/gh/openvinotoolkit/datumaro/pull/1645/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openvinotoolkit) | `81.20% <66.66%> (+0.16%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openvinotoolkit#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

itrushkin commented 1 month ago

@wonjuleee Parent category property is implemented in daf6669