Skip to content

Commit 8a2923c

Browse files
author
pytorchbot
committed
2024-10-12 nightly release (ed55b03)
1 parent 800c366 commit 8a2923c

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

torchvision/datasets/stanford_cars.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class StanfordCars(VisionDataset):
1515
has been split roughly in a 50-50 split
1616
1717
The original URL is https://ai.stanford.edu/~jkrause/cars/car_dataset.html, but it is broken.
18+
Follow the instructions in ``download`` argument to obtain and use the dataset offline.
1819
1920
.. note::
2021
@@ -29,8 +30,12 @@ class StanfordCars(VisionDataset):
2930
target and transforms it.
3031
download (bool, optional): This parameter exists for backward compatibility but it does not
3132
download the dataset, since the original URL is not available anymore. The dataset
32-
seems to be available on Kaggle so you can try to manually download it using
33-
`these instructions <https://github.com/pytorch/vision/issues/7545#issuecomment-1631441616>`_.
33+
seems to be available on Kaggle so you can try to manually download and configure it using
34+
`these instructions <https://github.com/pytorch/vision/issues/7545#issuecomment-1631441616>`_,
35+
or use an integrated
36+
`dataset on Kaggle <https://github.com/pytorch/vision/issues/7545#issuecomment-2282674373>`_.
37+
In both cases, first download and configure the dataset locally, and use the dataset with
38+
``"download=False"``.
3439
"""
3540

3641
def __init__(

torchvision/io/video.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ def write_video(
6262
audio_options: Optional[Dict[str, Any]] = None,
6363
) -> None:
6464
"""
65-
Writes a 4d tensor in [T, H, W, C] format in a video file
65+
Writes a 4d tensor in [T, H, W, C] format in a video file.
66+
67+
This function relies on PyAV (therefore, ultimately FFmpeg) to encode
68+
videos, you can get more fine-grained control by referring to the other
69+
options at your disposal within `the FFMpeg wiki
70+
<http://trac.ffmpeg.org/wiki#Encoding>`_.
6671
6772
.. warning::
6873
@@ -78,12 +83,25 @@ def write_video(
7883
as a uint8 tensor in [T, H, W, C] format
7984
fps (Number): video frames per second
8085
video_codec (str): the name of the video codec, i.e. "libx264", "h264", etc.
81-
options (Dict): dictionary containing options to be passed into the PyAV video stream
86+
options (Dict): dictionary containing options to be passed into the PyAV video stream.
87+
The list of options is codec-dependent and can all
88+
be found from `the FFMpeg wiki <http://trac.ffmpeg.org/wiki#Encoding>`_.
8289
audio_array (Tensor[C, N]): tensor containing the audio, where C is the number of channels
8390
and N is the number of samples
8491
audio_fps (Number): audio sample rate, typically 44100 or 48000
8592
audio_codec (str): the name of the audio codec, i.e. "mp3", "aac", etc.
86-
audio_options (Dict): dictionary containing options to be passed into the PyAV audio stream
93+
audio_options (Dict): dictionary containing options to be passed into the PyAV audio stream.
94+
The list of options is codec-dependent and can all
95+
be found from `the FFMpeg wiki <http://trac.ffmpeg.org/wiki#Encoding>`_.
96+
97+
Examples::
98+
>>> # Creating libx264 video with CRF 17, for visually lossless footage:
99+
>>>
100+
>>> from torchvision.io import write_video
101+
>>> # 1000 frames of 100x100, 3-channel image.
102+
>>> vid = torch.randn(1000, 100, 100, 3, dtype = torch.uint8)
103+
>>> write_video("video.mp4", options = {"crf": "17"})
104+
87105
"""
88106
if not torch.jit.is_scripting() and not torch.jit.is_tracing():
89107
_log_api_usage_once(write_video)

0 commit comments

Comments
 (0)