Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Improvement] add option to keep tail frames #1050

Merged
merged 1 commit into from
Jul 23, 2021

Conversation

dreamerlin
Copy link
Collaborator

This PR enables class SampleFrames with ability to sample tail frames.

Test Codes

from mmaction.datasets.pipelines import SampleFrames
from matplotlib import pyplot as plt
import numpy as np

f = dict(total_frames=1000, start_index=0)
s = SampleFrames(clip_len=1, num_clips=128, keep_tail_frames=True)

# Sample 1000 times
a = []
for i in range(1000):
    a.append(s(f)['frame_inds'])
a = np.stack(a)

# Count occurance of each index
u, counts = np.unique(a, return_counts=True)
b = []
for i in range(1000):
    try:
        b.append(counts[u.tolist().index(i)])
    except ValueError:
        b.append(0)

# Plot
plt.plot(b)
plt.show()

Results
keep_tail_frames

@dreamerlin dreamerlin linked an issue Jul 22, 2021 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #1050 (2cd57a1) into master (76db181) will increase coverage by 0.02%.
The diff coverage is 88.88%.

❗ Current head 2cd57a1 differs from pull request most recent head 195aad9. Consider uploading reports for the commit 195aad9 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1050      +/-   ##
==========================================
+ Coverage   83.12%   83.14%   +0.02%     
==========================================
  Files         135      135              
  Lines       10362    10369       +7     
  Branches     1775     1777       +2     
==========================================
+ Hits         8613     8621       +8     
+ Misses       1317     1313       -4     
- Partials      432      435       +3     
Flag Coverage Δ
unittests 83.14% <88.88%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
mmaction/datasets/pipelines/loading.py 88.95% <88.88%> (-0.16%) ⬇️
mmaction/datasets/pipelines/augmentations.py 87.63% <0.00%> (+0.32%) ⬆️

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 76db181...195aad9. Read the comment docs.

@kennymckormick kennymckormick merged commit 3ed839a into open-mmlab:master Jul 23, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SampleFrames ignore tail frames
2 participants