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

Commit

Permalink
Use the updated kinetics dataset API (#107)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
YosuaMichael authored and facebook-github-bot committed Sep 27, 2022
1 parent e27f5d8 commit 74e83dd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions classy_vision/dataset/classy_kinetics400.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Callable, Dict, List, Optional

import torch
from torchvision.datasets.kinetics import Kinetics400
from torchvision.datasets.kinetics import Kinetics

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

dataset = Kinetics400(
dataset = Kinetics(
video_dir,
frames_per_clip,
num_classes="400",
step_between_clips=step_between_clips,
frame_rate=frame_rate,
_precomputed_metadata=metadata,
Expand All @@ -104,6 +105,7 @@ def __init__(
_video_min_dimension=video_min_dimension,
_audio_samples=audio_samples,
_audio_channels=audio_channels,
_legacy=True,
)
metadata = dataset.metadata
if metadata and not os.path.exists(metadata_filepath):
Expand Down

0 comments on commit 74e83dd

Please sign in to comment.