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

Improve check videos #950

Merged
merged 6 commits into from
Jun 23, 2021
Merged

Conversation

rlleshi
Copy link
Contributor

@rlleshi rlleshi commented Jun 21, 2021

There are some problems with the check_videos.py script. I didn't see any current PR or issues on it so made this one.
Also improved some minor stuff.

Bugs

  • pool.join() was being called before pool.close(). It should be the other way around. This also leads to the following error:
Traceback (most recent call last):
  File "tools/check_videos.py", line 143, in <module>
    pool.join()
  File "/opt/conda/lib/python3.8/multiprocessing/pool.py", line 659, in join
    raise ValueError("Pool is still running")
ValueError: Pool is still running
  • Getting file length
    The current way, len(f) doesn't work since objects don't have length. Corresponding error:
Traceback (most recent call last):
  File "tools/check_videos.py", line 148, in <module>
    print(f'Checked {len(dataset)} videos, '
TypeError: object of type '_io.TextIOWrapper' has no len()

Added a function to get file length.

  • If no clips with problems were found then the script fails because no output file exists, e.g. here.
  • Same thing as above for deleting corrupted clips when no output file exists

Minor improvements

  • Remove num-processes as args and add instead all but one cpus for multiprocessing: pool = Pool(cpu_count() - 1 or 1)
  • Add choices for args here and here

@innerlee innerlee requested a review from dreamerlin June 21, 2021 14:54
@codecov
Copy link

codecov bot commented Jun 21, 2021

Codecov Report

Merging #950 (d78360c) into master (a6e8977) will decrease coverage by 0.04%.
The diff coverage is n/a.

❗ Current head d78360c differs from pull request most recent head 68799d4. Consider uploading reports for the commit 68799d4 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #950      +/-   ##
==========================================
- Coverage   83.72%   83.68%   -0.05%     
==========================================
  Files         132      132              
  Lines        9983     9983              
  Branches     1722     1722              
==========================================
- Hits         8358     8354       -4     
- Misses       1210     1212       +2     
- Partials      415      417       +2     
Flag Coverage Δ
unittests 83.68% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmaction/core/evaluation/accuracy.py 92.27% <0.00%> (-0.91%) ⬇️
mmaction/datasets/pipelines/augmentations.py 92.75% <0.00%> (-0.23%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6e8977...68799d4. Read the comment docs.

@dreamerlin dreamerlin force-pushed the improve-check-videos branch from a4e0860 to 4e84ab6 Compare June 22, 2021 17:02
@dreamerlin
Copy link
Collaborator

dreamerlin commented Jun 22, 2021

I made some changes and now LGTM

@dreamerlin dreamerlin force-pushed the improve-check-videos branch from 14b13ed to 68799d4 Compare June 23, 2021 13:17
@kennymckormick kennymckormick merged commit a5ea62d into open-mmlab:master Jun 23, 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.

4 participants