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

COCOReader images argument can be used to provide a custom order of images #2597

Merged
merged 3 commits into from
Jan 12, 2021

Conversation

jantonguirao
Copy link
Contributor

Signed-off-by: Joaquin Anton janton@nvidia.com

Why we need this PR?

Pick one, remove the rest

  • Refactoring to allow custom order of images in COCOReader

What happened in this PR?

Fill relevant points, put NA otherwise. Replace anything inside []

  • What solution was applied:
    Rework the way that images argument is consumed, so that the images are sorted according to the order they appear in the provided file list
    Fix wrong data in tests
  • Affected modules and functionalities:
    COCOReader
  • Key points relevant for the review:
    COCOLoader changes
  • Validation and testing:
    Test updated
  • Documentation (including examples):
    Operator documentation updated

JIRA TASK: [DALI-1791]

… samples

Signed-off-by: Joaquin Anton <janton@nvidia.com>
'suit-2619784_1280.jpg' : 39,
'business-suit-690048_1280.jpg' : 41,
'car-604019_1280.jpg' : 59
'car-race-438467_1280.jpg' : 17,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the previous data was actually wrong.

@JanuszL JanuszL self-assigned this Jan 8, 2021
If specified, it acts as a filter for the file paths present in the annotation file.
If left unspecified or set to None, all images listed in the annotation file are read.
If specified, it acts as a filter for the file paths present in the annotation file, which will be
read in the same order as they appear in the list.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a note that names could repeat and given sample would be read multiple times.

std::unordered_map<std::string, detail::ImageInfo*> image_info_map;
std::unordered_map<int, size_t> custom_order;

for (const auto &filename : images_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about calling reserve first?

'business-suit-690048_1280.jpg' : 41,
'car-604019_1280.jpg' : 59
'car-race-438467_1280.jpg' : 17,
'clock-1274699_1280.jpg' : 6,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a test where a custom order with repetition is provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Joaquin Anton <janton@nvidia.com>
i = 0
while i < len(images):
out = pipeline.run()
assert out[0].at(0) == expected_ids[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just put here another loop that iterates batch_size times instead of hardcoding the repetition two times?

custom_orders = [
None, # natural order
[0, 2, 4, 6, 1, 3, 5, 7], # altered order
[0, 1, 2, 3, 2, 1, 4, 1, 5, 2, 6, 7], # with repetitions
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a case for ID that doesn't exist in the dataset?


constexpr inline RLEMask() : UniqueHandle() {}

struct RLEMask {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? Shouldn't RLEMask be marked as non-movable, non-copyable if not using proper move/copy semantics?

Signed-off-by: Joaquin Anton <janton@nvidia.com>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1973019]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1973019]: BUILD PASSED

@jantonguirao jantonguirao merged commit 760e224 into NVIDIA:master Jan 12, 2021
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.

None yet

4 participants