Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 74e83dd

Browse files
YosuaMichaelfacebook-github-bot
authored andcommitted
Use the updated kinetics dataset API (#107)
Summary: X-link: fairinternal/ClassyVision#107 Pull Request resolved: #797 Kinetics400 is deprecated and scheduled to be removed on torchvision v0.14. We notice on D39829021 (see v0.1) that the removal will break classy_vision. Hence we patch classy_kinetics400 before the actual removal with this diffs Reviewed By: NicolasHug Differential Revision: D39832659 fbshipit-source-id: ee3a502e09add6c1a96b6e76d51fe8fb49b3c655
1 parent e27f5d8 commit 74e83dd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

classy_vision/dataset/classy_kinetics400.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import Any, Callable, Dict, List, Optional
99

1010
import torch
11-
from torchvision.datasets.kinetics import Kinetics400
11+
from torchvision.datasets.kinetics import Kinetics
1212

1313
from . import register_dataset
1414
from .classy_video_dataset import ClassyVideoDataset
@@ -25,7 +25,7 @@ class Kinetics400Dataset(ClassyVideoDataset):
2525
We assume videos are already trimmed to 10-second clip, and are stored in a
2626
folder.
2727
28-
It is built on top of `Kinetics400 <https://github.com/pytorch/vision/blob/
28+
It is built on top of `Kinetics <https://github.com/pytorch/vision/blob/
2929
master/torchvision/datasets/kinetics.py#L7/>`_ dataset class in TorchVision.
3030
3131
"""
@@ -91,9 +91,10 @@ def __init__(
9191
metadata_filepath, video_dir=video_dir, update_file_path=True
9292
)
9393

94-
dataset = Kinetics400(
94+
dataset = Kinetics(
9595
video_dir,
9696
frames_per_clip,
97+
num_classes="400",
9798
step_between_clips=step_between_clips,
9899
frame_rate=frame_rate,
99100
_precomputed_metadata=metadata,
@@ -104,6 +105,7 @@ def __init__(
104105
_video_min_dimension=video_min_dimension,
105106
_audio_samples=audio_samples,
106107
_audio_channels=audio_channels,
108+
_legacy=True,
107109
)
108110
metadata = dataset.metadata
109111
if metadata and not os.path.exists(metadata_filepath):

0 commit comments

Comments
 (0)