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

Enhance 'id_from_image_name' transform to ensure each identifier is unique #1635

Conversation

jihyeonyi
Copy link
Contributor

@jihyeonyi jihyeonyi commented Oct 8, 2024

Summary

Ticket: 153389

  1. Enhance 'id_from_image_name' transform to ensure each identifier is unique.
    • add random suffix if the image name is not distinct: [image_name]__[suffix]
    • introduce related parameters: ensure_unique(default: false), suffix_length (default: 3)
  2. Handle VideoFrame considering its index
    • format: [video_name]_frame-[index]

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

@jihyeonyi jihyeonyi marked this pull request as ready for review October 8, 2024 08:53
@jihyeonyi jihyeonyi requested review from a team as code owners October 8, 2024 08:53
@jihyeonyi jihyeonyi requested review from sooahleex and removed request for a team October 8, 2024 08:53
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.17%. Comparing base (ff5fd94) to head (2532532).
Report is 15 commits behind head on develop.

Files with missing lines Patch % Lines
src/datumaro/plugins/transforms.py 97.22% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1635      +/-   ##
===========================================
+ Coverage    81.06%   81.17%   +0.10%     
===========================================
  Files          278      281       +3     
  Lines        32517    32781     +264     
  Branches      6607     5294    -1313     
===========================================
+ Hits         26360    26609     +249     
- Misses        4701     4721      +20     
+ Partials      1456     1451       -5     
Flag Coverage Δ
ubuntu-20.04_Python-3.10 81.15% <97.22%> (+0.10%) ⬆️
windows-2022_Python-3.10 81.14% <97.22%> (+0.10%) ⬆️

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

@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, but I left one comment. It may be misunderstanding due to my low understanding of this feature, if it doesn't matter, you can ignore it.

Comment on lines +1213 to +1228
def fxt_dataset(self, n_labels=3, n_anns=5, n_items=7) -> Dataset:
video = Video("video.mp4")
video._frame_size = MagicMock(return_value=(32, 32))
video.get_frame_data = MagicMock(return_value=np.ndarray((32, 32, 3), dtype=np.uint8))
return Dataset.from_iterable(
[
DatasetItem(id=1, media=Image.from_file(path="path1.jpg")),
DatasetItem(id=2, media=Image.from_file(path="path1.jpg")),
DatasetItem(id=3, media=Image.from_file(path="path1.jpg")),
DatasetItem(id=4, media=VideoFrame(video, index=30)),
DatasetItem(id=5, media=VideoFrame(video, index=30)),
DatasetItem(id=6, media=VideoFrame(video, index=60)),
DatasetItem(id=7),
DatasetItem(id=8, media=Image.from_numpy(data=np.ones([5, 5, 3]))),
]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it okay to bundle the dataset for all tests in one without dividing the dataset into several?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you said, we can make several datasets, but I think it doesn't matter to reuse it.

@jihyeonyi jihyeonyi merged commit f716078 into openvinotoolkit:develop Oct 11, 2024
8 checks passed
@jihyeonyi jihyeonyi deleted the jihyeony/enhance_id_from_image_name branch October 11, 2024 07:24
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