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

Don't export outside annotations #1729

Merged
merged 11 commits into from
Jul 7, 2020
Merged

Don't export outside annotations #1729

merged 11 commits into from
Jul 7, 2020

Conversation

zhiltsov-max
Copy link
Contributor

Motivation and context

Fixes #1620

outside annotations were not considered during export.

How has this been tested?

Unit tests.

Checklist

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

@azhavoro
Copy link
Contributor

azhavoro commented Jun 17, 2020

@zhiltsov-max could you fix the tests?

@zhiltsov-max zhiltsov-max changed the title Don't export outside annotations [WIP] Don't export outside annotations Jun 17, 2020
@zhiltsov-max zhiltsov-max changed the title [WIP] Don't export outside annotations Don't export outside annotations Jun 17, 2020
azhavoro
azhavoro previously approved these changes Jun 18, 2020
last_shape = track.shapes[-1]
if last_shape.frame < int(task_data.meta['task']['stop_frame']):
track.shapes.append(last_shape._replace(outside=True,
frame=last_shape.frame + task_data.frame_step)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that here we need to add task_data.frame_step (probably +1 is correct). You can get a shape with frame > task_data.meta['task']['stop_frame']. @azhavoro , could you please look at the line and give your opinion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With +1 I'm not sure about how filtered out frames would be handled in UI, e.g. in "go to the next keyframe" button.

Copy link
Contributor

Choose a reason for hiding this comment

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

@zhiltsov-max , could you please check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've checked. We can't just save the next frame (which is +1) without breaking the logic in many places, at least on the server, so we probably should stick to +frame_step.

@@ -410,9 +410,10 @@ def match_frame(self, filename):
"Cannot match filename or determine frame number for {} filename".format(filename))

class CvatTaskDataExtractor(datumaro.SourceExtractor):
def __init__(self, task_data, include_images=False):
def __init__(self, task_data, include_images=False, include_outside=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the flag at all? When is it useful?

dm_dataset = datumaro.components.project.Dataset.from_extractors(extractor)
self.assertEqual(4, len(dm_dataset.get("image_1").annotations))

extractor = CvatTaskDataExtractor(task_data, include_outside=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we always should include_outside but different formats can use or ignore such shapes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, but there is no formats with such annotation property.

Copy link
Contributor Author

@zhiltsov-max zhiltsov-max Jun 22, 2020

Choose a reason for hiding this comment

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

I believed it too, so we've been there already. It means that all formats must expect (read as "support") such shapes. Much better is to filter them on the caller's side.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now "caller" knows about format implementation details (a format doesn't support "outside" flag). Is it OK? What is about attributes? Tracks? Cuboids? Are you going to filter that as?

Copy link
Contributor Author

@zhiltsov-max zhiltsov-max Jun 22, 2020

Choose a reason for hiding this comment

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

I think, only CVAT knows about outside, so I treat it as a CVAT implementation detail. Tracks and cuboids are not exported too.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. I see that CvatTaskDataExtractor is used as an utility function by each format. Thus the knowledge encapsulated.

@coveralls
Copy link

coveralls commented Jul 7, 2020

Pull Request Test Coverage Report for Build 6330

  • 17 of 18 (94.44%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 65.214%

Changes Missing Coverage Covered Lines Changed/Added Lines %
datumaro/datumaro/components/project.py 10 11 90.91%
Totals Coverage Status
Change from base Build 6288: 0.07%
Covered Lines: 11063
Relevant Lines: 16556

💛 - Coveralls

@nmanovic nmanovic merged commit fc2fb61 into develop Jul 7, 2020
@nmanovic nmanovic deleted the zm/dont-export-outside branch July 7, 2020 18:34
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.

bounding box is in picture when outside property is set
4 participants