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

Manifest optimization #3712

Merged
merged 12 commits into from
Oct 7, 2021
Merged

Manifest optimization #3712

merged 12 commits into from
Oct 7, 2021

Conversation

Marishka17
Copy link
Contributor

@Marishka17 Marishka17 commented Sep 23, 2021

Resolve #2993

Motivation and context

  • added progress bar for manifest creating
  • reduced manifest creating time

How has this been tested?

Manually, old tests work as expected

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

@Marishka17 Marishka17 requested a review from nmanovic September 23, 2021 09:33
@Marishka17 Marishka17 linked an issue Sep 23, 2021 that may be closed by this pull request
2 tasks
@Marishka17 Marishka17 force-pushed the mk/manifest_optimization branch from ad6331b to 68c7176 Compare September 30, 2021 08:11
@Marishka17 Marishka17 marked this pull request as ready for review September 30, 2021 08:37
@nmanovic
Copy link
Contributor

nmanovic commented Oct 4, 2021

@Marishka17 , it will be great to have a line in CHANGELOG. Probably you can estimate some speed up which we should get in some scenarios. It will be helpful as well.

@nmanovic
Copy link
Contributor

nmanovic commented Oct 4, 2021

@Marishka17 , need to add tqdm module into requirements

Traceback (most recent call last):
  File "./create.py", line 91, in <module>
    from dataset_manifest.core import VideoManifestManager, ImageManifestManager
  File "/mnt/data.ssd1tb/workspace/cvat/utils/dataset_manifest/__init__.py", line 4, in <module>
    from .core import VideoManifestManager, ImageManifestManager
  File "/mnt/data.ssd1tb/workspace/cvat/utils/dataset_manifest/core.py", line 13, in <module>
    from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'

file.write(f'{json_item}\n')

def _write_core_part(self, file):
for item in tqdm(self._reader,
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better don't use tqdm inside a library. It is a good solution for create.py. What do you think?

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 think that need to use tqdm where an iteration directly takes place. It seems to me not a very good solution to raise an iteration to a higher level.
If we will use tqdm in create.py, we should change manifest.create() to for _ in manifest.create(): pass in all places where manifest.create() is used, or expand existing API. What do you think about it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it spam CVAT server logs with unnecessary messages?

Copy link
Contributor

Choose a reason for hiding this comment

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

In general I don't advice a solution. I just want to say that the general rule is to use tqdm inside CLI not in a library.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can pass an optional object into the create method. Thus CLI will pass tqdm like object. If the code is imported, the object will be None.

@nmanovic nmanovic merged commit 5b890b1 into develop Oct 7, 2021
@nmanovic nmanovic deleted the mk/manifest_optimization branch October 7, 2021 07:11
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.

Manifest optimization
2 participants