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

SampleFrames ignore tail frames #1048

Closed
makecent opened this issue Jul 22, 2021 · 1 comment · Fixed by #1050
Closed

SampleFrames ignore tail frames #1048

makecent opened this issue Jul 22, 2021 · 1 comment · Fixed by #1050

Comments

@makecent
Copy link
Contributor

makecent commented Jul 22, 2021

Reproduce

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)

# 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()

outs:
myplot
Comments
SampleFrames will ignore tail frames because the // used:

ori_clip_len = self.clip_len * self.frame_interval
avg_interval = (num_frames - ori_clip_len + 1) // self.num_clips

@kennymckormick
Copy link
Member

Use '/' instead of '//' can be more reasonable, we will add an option to do so.

@dreamerlin dreamerlin linked a pull request Jul 22, 2021 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants