Package: torchvision
torchvisionThe torchvision package consists of popular datasets, model architectures, and common image transformations for computer
vision.InstallationPlease refer to theofficial
instructionsto install the stable
versions oftorchandtorchvisionon your system.To build source, refer to ourcontributing
page.The following is the correspondingtorchvisionversions and supported Python
versions.torchtorchvisionPythonmain/nightlymain/nightly>=3.8,<=3.112.10.16>=3.8,<=3.112.00.15>=3.8,<=3.111.130.14>=3.7.2,<=3.10older versionstorchtorchvisionPython1.120.13>=3.7,<=3.101.110.12>=3.7,<=3.101.100.11>=3.6,<=3.91.90.10>=3.6,<=3.91.80.9>=3.6,<=3.91.70.8>=3.6,<=3.91.60.7>=3.6,<=3.81.50.6>=3.5,<=3.81.40.5==2.7,>=3.5,<=3.81.30.4.2/0.4.3==2.7,>=3.5,<=3.71.20.4.1==2.7,>=3.5,<=3.71.10.3==2.7,>=3.5,<=3.7<=1.00.2==2.7,>=3.5,<=3.7Image BackendsTorchvision currently supports the following image backends:torch tensorsPIL images:PillowPillow-SIMD- amuch fasterdrop-in replacement for Pillow with SIMD.Read more in in ourdocs.[UNSTABLE] Video BackendTorchvision currently supports the following video backends:pyav(default) - Pythonic binding for ffmpeg libraries.video_reader - This needs ffmpeg to be installed and torchvision to be built from source. There shouldn't be any
conflicting version of ffmpeg installed. Currently, this is only supported on Linux.conda install -c conda-forge 'ffmpeg<4.3'
python setup.py installUsing the models on C++TorchVision provides an example project for how to use the models on C++ using JIT Script.Installation From source:mkdir build
cd build
# Add -DWITH_CUDA=on support for the CUDA if needed
cmake ..
make
make installOnce installed, the library can be accessed in cmake (after properly configuringCMAKE_PREFIX_PATH) via theTorchVision::TorchVisiontarget:find_package(TorchVision REQUIRED)
target_link_libraries(my-target PUBLIC TorchVision::TorchVision)TheTorchVisionpackage will also automatically look for theTorchpackage and add it as a dependency tomy-target, so make sure that it is also available to cmake via theCMAKE_PREFIX_PATH.For an example setup, take a look atexamples/cpp/hello_world.Python linking is disabled by default when compiling TorchVision with CMake, this allows you to run models without any
Python dependency. In some special cases where TorchVision's operators are used from Python code, you may need to link
to Python. This can be done by passing-DUSE_PYTHON=onto CMake.TorchVision OperatorsIn order to get the torchvision operators registered with torch (eg. for the JIT), all you need to do is to ensure that
you#include <torchvision/vision.h>in your project.DocumentationYou can find the API documentation on the pytorch website:https://pytorch.org/vision/stable/index.htmlContributingSee theCONTRIBUTINGfile for how to help out.Disclaimer on DatasetsThis is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets,
vouch for their quality or fairness, or claim that you have license to use the dataset. It is your responsibility to
determine whether you have permission to use the dataset under the dataset's license.If you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset
to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML
community!Pre-trained Model LicenseThe pre-trained models provided in this library may have their own licenses or terms and conditions derived from the
dataset used for training. It is your responsibility to determine whether you have permission to use the models for your
use case.More specifically, SWAG models are released under the CC-BY-NC 4.0 license. SeeSWAG LICENSEfor additional details.Citing TorchVisionIf you find TorchVision useful in your work, please consider citing the following BibTeX entry:@software{torchvision2016,title={TorchVision: PyTorch's Computer Vision library},author={TorchVision maintainers and contributors},year=2016,journal={GitHub repository},publisher={GitHub},howpublished={\url{https://github.com/pytorch/vision}}}