"references/git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "d5f4cc38dc96bd14e5cab0893c3203af9a8a9685"
Unverified Commit 74f50d93 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Cleanup README.md (#7847)

parent a7b52a68
...@@ -30,30 +30,49 @@ clear and has sufficient instructions to be able to reproduce the issue. ...@@ -30,30 +30,49 @@ clear and has sufficient instructions to be able to reproduce the issue.
## Development installation ## Development installation
### Install PyTorch Nightly
### Dependencies
Start by installing the **nightly** build of PyTorch following the [official
instructions](https://pytorch.org/get-started/locally/).
**Optionally**, install `libpng` and `libjpeg-turbo` if you want to enable
support for
native encoding / decoding of PNG and JPEG formats in
[torchvision.io](https://pytorch.org/vision/stable/io.html#image):
```bash ```bash
conda install pytorch -c pytorch-nightly conda install libpng libjpeg-turbo -c pytorch
# or with pip (see https://pytorch.org/get-started/locally/)
# pip install numpy
# pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
``` ```
### Install Torchvision Note: you can use the `TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY`
environment variables to tell the build system where to find those libraries if
they are in specific locations. Take a look at
[setup.py](https://github.com/pytorch/vision/blob/main/setup.py) for more
details.
### Clone and install torchvision
```bash ```bash
git clone https://github.com/pytorch/vision.git git clone https://github.com/pytorch/vision.git
cd vision cd vision
python setup.py develop python setup.py develop # use install instead of develop if you don't care about development.
# or, for OSX # or, for OSX
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop # MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop
# for C++ debugging, please use DEBUG=1 # for C++ debugging, use DEBUG=1
# DEBUG=1 python setup.py develop # DEBUG=1 python setup.py develop
pip install flake8 typing mypy pytest pytest-mock scipy
``` ```
You may also have to install `libpng-dev` and `libjpeg-turbo8-dev` libraries:
```bash By default, GPU support is built if CUDA is found and `torch.cuda.is_available()` is true. It's possible to force
conda install libpng jpeg building GPU support by setting `FORCE_CUDA=1` environment variable, which is useful when building a docker image.
We don't officially support building from source using `pip`, but _if_ you do, you'll need to use the
`--no-build-isolation` flag.
Other development dependencies include:
```
pip install flake8 typing mypy pytest pytest-mock scipy
``` ```
## Development Process ## Development Process
...@@ -192,7 +211,7 @@ Please refer to the guidelines in [Contributing to Torchvision - Models](https:/ ...@@ -192,7 +211,7 @@ Please refer to the guidelines in [Contributing to Torchvision - Models](https:/
### New dataset ### New dataset
More details on how to add a new dataset will be provided later. Please, do not send any PR with a new dataset without discussing Please, do not send any PR with a new dataset without discussing
it in an issue as, most likely, it will not be accepted. it in an issue as, most likely, it will not be accepted.
### Pull Request ### Pull Request
......
...@@ -8,8 +8,14 @@ vision. ...@@ -8,8 +8,14 @@ vision.
## Installation ## Installation
We recommend Anaconda as Python package management system. Please refer to [pytorch.org](https://pytorch.org/) for the Please refer to the [official
detail of PyTorch (`torch`) installation. The following is the corresponding `torchvision` versions and supported Python instructions](https://pytorch.org/get-started/locally/) to install the stable
versions of `torch` and `torchvision` on your system.
To build source, refer to our [contributing
page](https://github.com/pytorch/vision/blob/main/CONTRIBUTING.md#development-installation).
The following is the corresponding `torchvision` versions and supported Python
versions. versions.
| `torch` | `torchvision` | Python | | `torch` | `torchvision` | Python |
...@@ -39,55 +45,18 @@ versions. ...@@ -39,55 +45,18 @@ versions.
</details> </details>
Anaconda: ## Image Backends
```
conda install torchvision -c pytorch
```
pip:
```
pip install torchvision
```
From source: Torchvision currently supports the following image backends:
```
python setup.py install
# or, for OSX
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
```
We don't officially support building from source using `pip`, but _if_ you do, you'll need to use the
`--no-build-isolation` flag. In case building TorchVision from source fails, install the nightly version of PyTorch
following the linked guide on the
[contributing page](https://github.com/pytorch/vision/blob/main/CONTRIBUTING.md#development-installation) and retry the
install.
By default, GPU support is built if CUDA is found and `torch.cuda.is_available()` is true. It's possible to force
building GPU support by setting `FORCE_CUDA=1` environment variable, which is useful when building a docker image.
## Image Backend - torch tensors
- PIL images:
- [Pillow](https://python-pillow.org/)
- [Pillow-SIMD](https://github.com/uploadcare/pillow-simd) - a **much faster** drop-in replacement for Pillow with SIMD.
Torchvision currently supports the following image backends: Read more in in our [docs](https://pytorch.org/vision/stable/transforms.html).
- [Pillow](https://python-pillow.org/) (default) ## [UNSTABLE] Video Backend
- [Pillow-SIMD](https://github.com/uploadcare/pillow-simd) - a **much faster** drop-in replacement for Pillow with SIMD.
If installed will be used as the default.
- [accimage](https://github.com/pytorch/accimage) - if installed can be activated by calling
`torchvision.set_image_backend('accimage')`
- [libpng](http://www.libpng.org/pub/png/libpng.html) - can be installed via conda `conda install libpng` or any of the
package managers for debian-based and RHEL-based Linux distributions.
- [libjpeg](http://ijg.org/) - can be installed via conda `conda install jpeg` or any of the package managers for
debian-based and RHEL-based Linux distributions. [libjpeg-turbo](https://libjpeg-turbo.org/) can be used as well.
**Notes:** `libpng` and `libjpeg` are optional dependencies. If any of them is available on the system,
torchvision will provide encoding/decoding image functionalities from `torchvision.io.image`.
When building torchvision from source, `libpng` and `libjpeg` can be found on the standard library locations.
Otherwise, please use `TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY` environment variables to set up include and library paths.
## Video Backend
Torchvision currently supports the following video backends: Torchvision currently supports the following video backends:
......
Reading/Writing images and videos Decoding / Encoding images and videos
================================= =====================================
.. currentmodule:: torchvision.io .. currentmodule:: torchvision.io
The :mod:`torchvision.io` package provides functions for performing IO The :mod:`torchvision.io` package provides functions for performing IO
operations. They are currently specific to reading and writing video and operations. They are currently specific to reading and writing images and
images. videos.
Images
------
.. autosummary::
:toctree: generated/
:template: function.rst
read_image
decode_image
encode_jpeg
decode_jpeg
write_jpeg
encode_png
decode_png
write_png
read_file
write_file
.. autosummary::
:toctree: generated/
:template: class.rst
ImageReadMode
Video Video
----- -----
...@@ -20,7 +46,7 @@ Video ...@@ -20,7 +46,7 @@ Video
Fine-grained video API Fine-grained video API
---------------------- ^^^^^^^^^^^^^^^^^^^^^^
In addition to the :mod:`read_video` function, we provide a high-performance In addition to the :mod:`read_video` function, we provide a high-performance
lower-level API for more fine-grained control compared to the :mod:`read_video` function. lower-level API for more fine-grained control compared to the :mod:`read_video` function.
...@@ -61,28 +87,3 @@ Example of inspecting a video: ...@@ -61,28 +87,3 @@ Example of inspecting a video:
# the constructor we select a default video stream, but # the constructor we select a default video stream, but
# in practice, we can set whichever stream we would like # in practice, we can set whichever stream we would like
video.set_current_stream("video:0") video.set_current_stream("video:0")
Image
-----
.. autosummary::
:toctree: generated/
:template: class.rst
ImageReadMode
.. autosummary::
:toctree: generated/
:template: function.rst
read_image
decode_image
encode_jpeg
decode_jpeg
write_jpeg
encode_png
decode_png
write_png
read_file
write_file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment