Skip to content

Commit b1333dd

Browse files
authored
migrate README to markdown (pytorch#7565)
1 parent 7325517 commit b1333dd

File tree

4 files changed

+191
-220
lines changed

4 files changed

+191
-220
lines changed

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include README.rst
1+
include README.md
22
include LICENSE
33

44
recursive-exclude * __pycache__

README.md

+188
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# torchvision
2+
3+
[![total torchvision downloads](https://pepy.tech/badge/torchvision)](https://pepy.tech/project/torchvision)
4+
[![documentation](https://img.shields.io/badge/dynamic/json.svg?label=docs&url=https%3A%2F%2Fpypi.org%2Fpypi%2Ftorchvision%2Fjson&query=%24.info.version&colorB=brightgreen&prefix=v)](https://pytorch.org/vision/stable/index.html)
5+
6+
The torchvision package consists of popular datasets, model architectures, and common image transformations for computer
7+
vision.
8+
9+
## Installation
10+
11+
We recommend Anaconda as Python package management system. Please refer to [pytorch.org](https://pytorch.org/) for the
12+
detail of PyTorch (`torch`) installation. The following is the corresponding `torchvision` versions and supported Python
13+
versions.
14+
15+
| `torch` | `torchvision` | Python |
16+
| ------------------ | ------------------ | ------------------- |
17+
| `main` / `nightly` | `main` / `nightly` | `>=3.8`, `<=3.11` |
18+
| `2.0.0` | `0.15.1` | `>=3.8`, `<=3.11` |
19+
| `1.13.0` | `0.14.0` | `>=3.7.2`, `<=3.10` |
20+
| `1.12.0` | `0.13.0` | `>=3.7`, `<=3.10` |
21+
| `1.11.0` | `0.12.0` | `>=3.7`, `<=3.10` |
22+
23+
<details>
24+
<summary>older versions</summary>
25+
26+
| `torch` | `torchvision` | Python |
27+
|--------------------|--------------------|---------------------------|
28+
| `1.10.2` | `0.11.3` | `>=3.6`, `<=3.9` |
29+
| `1.10.1` | `0.11.2` | `>=3.6`, `<=3.9` |
30+
| `1.10.0` | `0.11.1` | `>=3.6`, `<=3.9` |
31+
| `1.9.1` | `0.10.1` | `>=3.6`, `<=3.9` |
32+
| `1.9.0` | `0.10.0` | `>=3.6`, `<=3.9` |
33+
| `1.8.2` | `0.9.2` | `>=3.6`, `<=3.9` |
34+
| `1.8.1` | `0.9.1` | `>=3.6`, `<=3.9` |
35+
| `1.8.0` | `0.9.0` | `>=3.6`, `<=3.9` |
36+
| `1.7.1` | `0.8.2` | `>=3.6`, `<=3.9` |
37+
| `1.7.0` | `0.8.1` | `>=3.6`, `<=3.8` |
38+
| `1.7.0` | `0.8.0` | `>=3.6`, `<=3.8` |
39+
| `1.6.0` | `0.7.0` | `>=3.6`, `<=3.8` |
40+
| `1.5.1` | `0.6.1` | `>=3.5`, `<=3.8` |
41+
| `1.5.0` | `0.6.0` | `>=3.5`, `<=3.8` |
42+
| `1.4.0` | `0.5.0` | `==2.7`, `>=3.5`, `<=3.8` |
43+
| `1.3.1` | `0.4.2` | `==2.7`, `>=3.5`, `<=3.7` |
44+
| `1.3.0` | `0.4.1` | `==2.7`, `>=3.5`, `<=3.7` |
45+
| `1.2.0` | `0.4.0` | `==2.7`, `>=3.5`, `<=3.7` |
46+
| `1.1.0` | `0.3.0` | `==2.7`, `>=3.5`, `<=3.7` |
47+
| `<=1.0.1` | `0.2.2` | `==2.7`, `>=3.5`, `<=3.7` |
48+
49+
</details>
50+
51+
Anaconda:
52+
53+
```
54+
conda install torchvision -c pytorch
55+
```
56+
57+
pip:
58+
59+
```
60+
pip install torchvision
61+
```
62+
63+
From source:
64+
65+
```
66+
python setup.py install
67+
# or, for OSX
68+
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
69+
```
70+
71+
We don't officially support building from source using `pip`, but _if_ you do, you'll need to use the
72+
`--no-build-isolation` flag. In case building TorchVision from source fails, install the nightly version of PyTorch
73+
following the linked guide on the
74+
[contributing page](https://github.com/pytorch/vision/blob/main/CONTRIBUTING.md#development-installation) and retry the
75+
install.
76+
77+
By default, GPU support is built if CUDA is found and `torch.cuda.is_available()` is true. It's possible to force
78+
building GPU support by setting `FORCE_CUDA=1` environment variable, which is useful when building a docker image.
79+
80+
## Image Backend
81+
82+
Torchvision currently supports the following image backends:
83+
84+
- [Pillow](https://python-pillow.org/) (default)
85+
- [Pillow-SIMD](https://github.com/uploadcare/pillow-simd) - a **much faster** drop-in replacement for Pillow with SIMD.
86+
If installed will be used as the default.
87+
- [accimage](https://github.com/pytorch/accimage) - if installed can be activated by calling
88+
`torchvision.set_image_backend('accimage')`
89+
- [libpng](http://www.libpng.org/pub/png/libpng.html) - can be installed via conda `conda install libpng` or any of the
90+
package managers for debian-based and RHEL-based Linux distributions.
91+
- [libjpeg](http://ijg.org/) - can be installed via conda `conda install jpeg` or any of the package managers for
92+
debian-based and RHEL-based Linux distributions. [libjpeg-turbo](https://libjpeg-turbo.org/) can be used as well.
93+
94+
**Notes:** `libpng` and `libjpeg` must be available at compilation time in order to be available. Make sure that it is
95+
available on the standard library locations, otherwise, add the include and library paths in the environment variables
96+
`TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY`, respectively.
97+
98+
## Video Backend
99+
100+
Torchvision currently supports the following video backends:
101+
102+
- [pyav](https://github.com/PyAV-Org/PyAV) (default) - Pythonic binding for ffmpeg libraries.
103+
- video_reader - This needs ffmpeg to be installed and torchvision to be built from source. There shouldn't be any
104+
conflicting version of ffmpeg installed. Currently, this is only supported on Linux.
105+
106+
```
107+
conda install -c conda-forge ffmpeg
108+
python setup.py install
109+
```
110+
111+
# Using the models on C++
112+
113+
TorchVision provides an example project for how to use the models on C++ using JIT Script.
114+
115+
Installation From source:
116+
117+
```
118+
mkdir build
119+
cd build
120+
# Add -DWITH_CUDA=on support for the CUDA if needed
121+
cmake ..
122+
make
123+
make install
124+
```
125+
126+
Once installed, the library can be accessed in cmake (after properly configuring `CMAKE_PREFIX_PATH`) via the
127+
`TorchVision::TorchVision` target:
128+
129+
```
130+
find_package(TorchVision REQUIRED)
131+
target_link_libraries(my-target PUBLIC TorchVision::TorchVision)
132+
```
133+
134+
The `TorchVision` package will also automatically look for the `Torch` package and add it as a dependency to
135+
`my-target`, so make sure that it is also available to cmake via the `CMAKE_PREFIX_PATH`.
136+
137+
For an example setup, take a look at `examples/cpp/hello_world`.
138+
139+
Python linking is disabled by default when compiling TorchVision with CMake, this allows you to run models without any
140+
Python dependency. In some special cases where TorchVision's operators are used from Python code, you may need to link
141+
to Python. This can be done by passing `-DUSE_PYTHON=on` to CMake.
142+
143+
### TorchVision Operators
144+
145+
In order to get the torchvision operators registered with torch (eg. for the JIT), all you need to do is to ensure that
146+
you `#include <torchvision/vision.h>` in your project.
147+
148+
## Documentation
149+
150+
You can find the API documentation on the pytorch website: <https://pytorch.org/vision/stable/index.html>
151+
152+
## Contributing
153+
154+
See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
155+
156+
## Disclaimer on Datasets
157+
158+
This is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets,
159+
vouch for their quality or fairness, or claim that you have license to use the dataset. It is your responsibility to
160+
determine whether you have permission to use the dataset under the dataset's license.
161+
162+
If you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset
163+
to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML
164+
community!
165+
166+
## Pre-trained Model License
167+
168+
The pre-trained models provided in this library may have their own licenses or terms and conditions derived from the
169+
dataset used for training. It is your responsibility to determine whether you have permission to use the models for your
170+
use case.
171+
172+
More specifically, SWAG models are released under the CC-BY-NC 4.0 license. See
173+
[SWAG LICENSE](https://github.com/facebookresearch/SWAG/blob/main/LICENSE) for additional details.
174+
175+
## Citing TorchVision
176+
177+
If you find TorchVision useful in your work, please consider citing the following BibTeX entry:
178+
179+
```bibtex
180+
@software{torchvision2016,
181+
title = {TorchVision: PyTorch's Computer Vision library},
182+
author = {TorchVision maintainers and contributors},
183+
year = 2016,
184+
journal = {GitHub repository},
185+
publisher = {GitHub},
186+
howpublished = {\url{https://github.com/pytorch/vision}}
187+
}
188+
```

0 commit comments

Comments
 (0)