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

Fix bug that subsampled_streams is modified during iteration #327

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 1 addition & 1 deletion video2dataset/subsamplers/frame_subsampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FrameSubsampler(Subsampler):
def __init__(self, frame_rate, downsample_method="fps", encode_format="mp4"):
self.frame_rate = frame_rate
self.downsample_method = downsample_method
self.output_modality = "video" if downsample_method == "fps" else "jpg"
self.output_modality = "video" if downsample_method in ["fps", "keyframe"] else "jpg"
self.encode_formats = {"video": encode_format}

def __call__(self, streams, metadata=None):
Expand Down
2 changes: 1 addition & 1 deletion video2dataset/workers/download_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def data_generator():
)
subsampled_streams, metas, error_message = broadcast_subsampler(streams, meta)

for modality in subsampled_streams:
for modality in list(subsampled_streams.keys()):
for modality_subsampler in self.subsamplers[modality]:
subsampled_streams, metas, error_message = modality_subsampler(subsampled_streams, metas)

Expand Down
Loading