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

load CocoPageMapper once per process #1184

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(<https://github.com/openvinotoolkit/datumaro/pull/1174>)

### Bug fixes
- Import CocoPageMapper only once per process
(<https://github.com/openvinotoolkit/datumaro/pull/1184>)
- Modify the draw function in the visualizer not to raise an error for unsupported annotation types.
(<https://github.com/openvinotoolkit/datumaro/pull/1180>)
- Correct explore path in the related document.
Expand Down
5 changes: 4 additions & 1 deletion src/datumaro/plugins/data_formats/coco/page_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import logging as log
from typing import Any, Dict, Iterator, List, Optional, Tuple

from datumaro.rust_api import CocoPageMapper as CocoPageMapperImpl
try:
from datumaro.rust_api import CocoPageMapper as CocoPageMapperImpl
except ImportError:
pass

Check warning on line 11 in src/datumaro/plugins/data_formats/coco/page_mapper.py

View check run for this annotation

Codecov / codecov/patch

src/datumaro/plugins/data_formats/coco/page_mapper.py#L10-L11

Added lines #L10 - L11 were not covered by tests
Comment on lines +8 to +11
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the exact case requiring this fix? If any interpreter goes into L10-11, it means that it doesn't loads CocoPageMapperImpl just a once but does not load CocoPageMapperImpl totally.

Copy link
Author

Choose a reason for hiding this comment

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

The error occurs when importing a dataset multiple times in the streamlit GUI.
I thought this problem can be reproduced easily in the normal interpreter, but it was not.
I guess I need to handle this problem in another way.
So, I'll cancel this change at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

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

What Python version is in your dev env? 3.12?

Copy link
Author

Choose a reason for hiding this comment

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

My Python version is 3.10.
Anyway, it's strange that I cannot reproduce this problem after reverting the code.
I'll revisit this issue once it is reproduced.
I might have made a mistake when dealing with the streamlit.


__all__ = ["COCOPageMapper"]

Expand Down
Loading