Skip to content

Using Kinetics400 from references raises a deprecation warning #5787

@datumbox

Description

@datumbox

🐛 Describe the bug

Using Kinetics400 from references leads to a deprecation warning. The fastest way to reproduce:

torchrun --nproc_per_node=8 train.py --data-path /datasets01/kinetics/070618/ --train-dir=val_avi-480p --val-dir=val_avi-480p --batch-size=64 --sync-bn --test-only --weights R2Plus1D_18_Weights.DEFAULT --cache-dataset

./vision/torchvision/io/video.py:160: UserWarning: The pts_unit 'pts' gives wrong results and will be removed in a follow-up version. Please use pts_unit 'sec'.
  warnings.warn(

It seems this is due to the following line:

video, audio, info = read_video(video_path, start_pts, end_pts)

Which calls the method with the default parameter for pts_unit="pts" which is deprecated:

if pts_unit == "sec":
start_offset = int(math.floor(start_offset * (1 / stream.time_base)))
if end_offset != float("inf"):
end_offset = int(math.ceil(end_offset * (1 / stream.time_base)))
else:
warnings.warn(
"The pts_unit 'pts' gives wrong results and will be removed in a "
+ "follow-up version. Please use pts_unit 'sec'."
)

If the specific option is deprecated, TorchVision shouldn't be using the feature.

Versions

Latest main branch

cc @pmeier @YosuaMichael @bjuncek

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions