Skip to content

Commit 7506d89

Browse files
authored
Merge branch 'main' into resize-use-interp-uint8
2 parents 83dcd11 + c3d602e commit 7506d89

File tree

9 files changed

+277
-310
lines changed

9 files changed

+277
-310
lines changed

.github/workflows/lint.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,14 @@ jobs:
9696
echo '::group::Lint Python types'
9797
mypy --install-types --non-interactive --config-file mypy.ini
9898
echo '::endgroup::'
99+
100+
bc:
101+
if: github.event.pull_request
102+
runs-on: ubuntu-latest
103+
steps:
104+
- name: Run BC Lint Action
105+
uses: pytorch/test-infra/.github/actions/bc-lint@main
106+
with:
107+
repo: ${{ github.event.pull_request.head.repo.full_name }}
108+
base_sha: ${{ github.event.pull_request.base.sha }}
109+
head_sha: ${{ github.event.pull_request.head.sha }}

.github/workflows/test-macos.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/test-windows.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/test-linux.yml renamed to .github/workflows/tests.yml

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests on Linux
1+
name: Tests
22

33
on:
44
pull_request:
@@ -10,7 +10,7 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13-
unittests:
13+
unittests-linux:
1414
strategy:
1515
matrix:
1616
python-version:
@@ -41,6 +41,67 @@ jobs:
4141
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
4242
4343
./.github/scripts/unittest.sh
44+
45+
unittests-macos:
46+
strategy:
47+
matrix:
48+
python-version:
49+
- "3.8"
50+
- "3.9"
51+
- "3.10"
52+
- "3.11"
53+
runner: ["macos-12"]
54+
include:
55+
- python-version: "3.8"
56+
runner: macos-m1-12
57+
fail-fast: false
58+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
59+
with:
60+
repository: pytorch/vision
61+
# We need an increased timeout here, since the macos-12 runner is the free one from GH
62+
# and needs roughly 2 hours to just run the test suite
63+
timeout: 240
64+
runner: ${{ matrix.runner }}
65+
script: |
66+
set -euo pipefail
67+
68+
export PYTHON_VERSION=${{ matrix.python-version }}
69+
export GPU_ARCH_TYPE=cpu
70+
export GPU_ARCH_VERSION=''
71+
72+
./.github/scripts/unittest.sh
73+
74+
unittests-windows:
75+
strategy:
76+
matrix:
77+
python-version:
78+
- "3.8"
79+
- "3.9"
80+
- "3.10"
81+
- "3.11"
82+
runner: ["windows.4xlarge"]
83+
gpu-arch-type: ["cpu"]
84+
include:
85+
- python-version: "3.8"
86+
runner: windows.g5.4xlarge.nvidia.gpu
87+
gpu-arch-type: cuda
88+
gpu-arch-version: "11.7"
89+
fail-fast: false
90+
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
91+
with:
92+
repository: pytorch/vision
93+
runner: ${{ matrix.runner }}
94+
gpu-arch-type: ${{ matrix.gpu-arch-type }}
95+
gpu-arch-version: ${{ matrix.gpu-arch-version }}
96+
timeout: 120
97+
script: |
98+
set -euxo pipefail
99+
100+
export PYTHON_VERSION=${{ matrix.python-version }}
101+
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
102+
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
103+
104+
./.github/scripts/unittest.sh
44105
45106
onnx:
46107
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main

MANIFEST.in

Lines changed: 1 addition & 1 deletion
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

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
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.15` | `>=3.8`, `<=3.11` |
19+
| `1.13` | `0.14` | `>=3.7.2`, `<=3.10` |
20+
| `1.12` | `0.13` | `>=3.7`, `<=3.10` |
21+
22+
<details>
23+
<summary>older versions</summary>
24+
25+
| `torch` | `torchvision` | Python |
26+
|---------|-------------------|---------------------------|
27+
| `1.11` | `0.12` | `>=3.7`, `<=3.10` |
28+
| `1.10` | `0.11` | `>=3.6`, `<=3.9` |
29+
| `1.9` | `0.10` | `>=3.6`, `<=3.9` |
30+
| `1.8` | `0.9` | `>=3.6`, `<=3.9` |
31+
| `1.7` | `0.8` | `>=3.6`, `<=3.9` |
32+
| `1.6` | `0.7` | `>=3.6`, `<=3.8` |
33+
| `1.5` | `0.6` | `>=3.5`, `<=3.8` |
34+
| `1.4` | `0.5` | `==2.7`, `>=3.5`, `<=3.8` |
35+
| `1.3` | `0.4.2` / `0.4.3` | `==2.7`, `>=3.5`, `<=3.7` |
36+
| `1.2` | `0.4.1` | `==2.7`, `>=3.5`, `<=3.7` |
37+
| `1.1` | `0.3` | `==2.7`, `>=3.5`, `<=3.7` |
38+
| `<=1.0` | `0.2` | `==2.7`, `>=3.5`, `<=3.7` |
39+
40+
</details>
41+
42+
Anaconda:
43+
44+
```
45+
conda install torchvision -c pytorch
46+
```
47+
48+
pip:
49+
50+
```
51+
pip install torchvision
52+
```
53+
54+
From source:
55+
56+
```
57+
python setup.py install
58+
# or, for OSX
59+
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
60+
```
61+
62+
We don't officially support building from source using `pip`, but _if_ you do, you'll need to use the
63+
`--no-build-isolation` flag. In case building TorchVision from source fails, install the nightly version of PyTorch
64+
following the linked guide on the
65+
[contributing page](https://github.com/pytorch/vision/blob/main/CONTRIBUTING.md#development-installation) and retry the
66+
install.
67+
68+
By default, GPU support is built if CUDA is found and `torch.cuda.is_available()` is true. It's possible to force
69+
building GPU support by setting `FORCE_CUDA=1` environment variable, which is useful when building a docker image.
70+
71+
## Image Backend
72+
73+
Torchvision currently supports the following image backends:
74+
75+
- [Pillow](https://python-pillow.org/) (default)
76+
- [Pillow-SIMD](https://github.com/uploadcare/pillow-simd) - a **much faster** drop-in replacement for Pillow with SIMD.
77+
If installed will be used as the default.
78+
- [accimage](https://github.com/pytorch/accimage) - if installed can be activated by calling
79+
`torchvision.set_image_backend('accimage')`
80+
- [libpng](http://www.libpng.org/pub/png/libpng.html) - can be installed via conda `conda install libpng` or any of the
81+
package managers for debian-based and RHEL-based Linux distributions.
82+
- [libjpeg](http://ijg.org/) - can be installed via conda `conda install jpeg` or any of the package managers for
83+
debian-based and RHEL-based Linux distributions. [libjpeg-turbo](https://libjpeg-turbo.org/) can be used as well.
84+
85+
**Notes:** `libpng` and `libjpeg` must be available at compilation time in order to be available. Make sure that it is
86+
available on the standard library locations, otherwise, add the include and library paths in the environment variables
87+
`TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY`, respectively.
88+
89+
## Video Backend
90+
91+
Torchvision currently supports the following video backends:
92+
93+
- [pyav](https://github.com/PyAV-Org/PyAV) (default) - Pythonic binding for ffmpeg libraries.
94+
- video_reader - This needs ffmpeg to be installed and torchvision to be built from source. There shouldn't be any
95+
conflicting version of ffmpeg installed. Currently, this is only supported on Linux.
96+
97+
```
98+
conda install -c conda-forge ffmpeg
99+
python setup.py install
100+
```
101+
102+
# Using the models on C++
103+
104+
TorchVision provides an example project for how to use the models on C++ using JIT Script.
105+
106+
Installation From source:
107+
108+
```
109+
mkdir build
110+
cd build
111+
# Add -DWITH_CUDA=on support for the CUDA if needed
112+
cmake ..
113+
make
114+
make install
115+
```
116+
117+
Once installed, the library can be accessed in cmake (after properly configuring `CMAKE_PREFIX_PATH`) via the
118+
`TorchVision::TorchVision` target:
119+
120+
```
121+
find_package(TorchVision REQUIRED)
122+
target_link_libraries(my-target PUBLIC TorchVision::TorchVision)
123+
```
124+
125+
The `TorchVision` package will also automatically look for the `Torch` package and add it as a dependency to
126+
`my-target`, so make sure that it is also available to cmake via the `CMAKE_PREFIX_PATH`.
127+
128+
For an example setup, take a look at `examples/cpp/hello_world`.
129+
130+
Python linking is disabled by default when compiling TorchVision with CMake, this allows you to run models without any
131+
Python dependency. In some special cases where TorchVision's operators are used from Python code, you may need to link
132+
to Python. This can be done by passing `-DUSE_PYTHON=on` to CMake.
133+
134+
### TorchVision Operators
135+
136+
In order to get the torchvision operators registered with torch (eg. for the JIT), all you need to do is to ensure that
137+
you `#include <torchvision/vision.h>` in your project.
138+
139+
## Documentation
140+
141+
You can find the API documentation on the pytorch website: <https://pytorch.org/vision/stable/index.html>
142+
143+
## Contributing
144+
145+
See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
146+
147+
## Disclaimer on Datasets
148+
149+
This is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets,
150+
vouch for their quality or fairness, or claim that you have license to use the dataset. It is your responsibility to
151+
determine whether you have permission to use the dataset under the dataset's license.
152+
153+
If you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset
154+
to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML
155+
community!
156+
157+
## Pre-trained Model License
158+
159+
The pre-trained models provided in this library may have their own licenses or terms and conditions derived from the
160+
dataset used for training. It is your responsibility to determine whether you have permission to use the models for your
161+
use case.
162+
163+
More specifically, SWAG models are released under the CC-BY-NC 4.0 license. See
164+
[SWAG LICENSE](https://github.com/facebookresearch/SWAG/blob/main/LICENSE) for additional details.
165+
166+
## Citing TorchVision
167+
168+
If you find TorchVision useful in your work, please consider citing the following BibTeX entry:
169+
170+
```bibtex
171+
@software{torchvision2016,
172+
title = {TorchVision: PyTorch's Computer Vision library},
173+
author = {TorchVision maintainers and contributors},
174+
year = 2016,
175+
journal = {GitHub repository},
176+
publisher = {GitHub},
177+
howpublished = {\url{https://github.com/pytorch/vision}}
178+
}
179+
```

0 commit comments

Comments
 (0)