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

Convert points to float in import #1898

Merged
merged 2 commits into from
Jul 14, 2020
Merged

Convert points to float in import #1898

merged 2 commits into from
Jul 14, 2020

Conversation

zhiltsov-max
Copy link
Contributor

@zhiltsov-max zhiltsov-max commented Jul 14, 2020

Motivation and context

Fixes #1893
Quite surprised it was working. Added a conversion from string to float for point values in import.

How has this been tested?

Manual test.

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

@coveralls
Copy link

coveralls commented Jul 14, 2020

Pull Request Test Coverage Report for Build 6442

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.006%) to 64.92%

Files with Coverage Reduction New Missed Lines %
cvat/apps/engine/media_extractors.py 2 77.06%
Totals Coverage Status
Change from base Build 6419: -0.006%
Covered Lines: 11033
Relevant Lines: 16588

💛 - Coveralls

@nmanovic
Copy link
Contributor

@zhiltsov-max , could you please prepare a test to cover the bug?

@nmanovic nmanovic merged commit cf26ef0 into develop Jul 14, 2020
@nmanovic nmanovic deleted the zm/fix-subtract branch July 14, 2020 11:09
Bobronium added a commit that referenced this pull request Jul 29, 2024
@Bobronium Bobronium mentioned this pull request Jul 29, 2024
7 tasks
@Bobronium Bobronium mentioned this pull request Sep 3, 2024
7 tasks
Bobronium added a commit that referenced this pull request Sep 4, 2024
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
By using tuple as a container for points when dealing with import from
datumaro, we can achieve 2 things:
- Reduce memory needed for copying shapes and tracks during import
(running `deepcopy` on `tuple[int]` will return the same object, as
opposed to `list[int]`)
- Guarantee type safety during later stages of data pipeline and skip
additional conversion added in #1898

Same thing arguable should be done for CVAT format as well.

Benchmarks:
[memray_reports.zip](https://github.com/user-attachments/files/16849509/memray_reports.zip)


### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Improved handling of shape points during the import process for
enhanced data accuracy.
- Centralized conversion of shape points to floats, optimizing memory
usage and performance.

- **Refactor**
- Enhanced code readability and maintainability by restructuring the
point conversion logic.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
bschultz96 pushed a commit to bschultz96/cvat that referenced this pull request Sep 12, 2024
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
By using tuple as a container for points when dealing with import from
datumaro, we can achieve 2 things:
- Reduce memory needed for copying shapes and tracks during import
(running `deepcopy` on `tuple[int]` will return the same object, as
opposed to `list[int]`)
- Guarantee type safety during later stages of data pipeline and skip
additional conversion added in cvat-ai#1898

Same thing arguable should be done for CVAT format as well.

Benchmarks:
[memray_reports.zip](https://github.com/user-attachments/files/16849509/memray_reports.zip)


### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Improved handling of shape points during the import process for
enhanced data accuracy.
- Centralized conversion of shape points to floats, optimizing memory
usage and performance.

- **Refactor**
- Enhanced code readability and maintainability by restructuring the
point conversion logic.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

Could not upload annotations for the CVAT for video format
3 participants