Skip to content

Commit

Permalink
Cleanup README.md (#7847)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Aug 17, 2023
1 parent a7b52a6 commit 74f50d9
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 90 deletions.
45 changes: 32 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,49 @@ clear and has sufficient instructions to be able to reproduce the issue.

## 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
conda install pytorch -c pytorch-nightly
# 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
conda install libpng libjpeg-turbo -c pytorch
```

### 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
git clone https://github.com/pytorch/vision.git
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
# 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
pip install flake8 typing mypy pytest pytest-mock scipy
```
You may also have to install `libpng-dev` and `libjpeg-turbo8-dev` libraries:
```bash
conda install libpng jpeg

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.

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
Expand Down Expand Up @@ -192,7 +211,7 @@ Please refer to the guidelines in [Contributing to Torchvision - Models](https:/

### 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.

### Pull Request
Expand Down
63 changes: 16 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ vision.

## Installation

We recommend Anaconda as Python package management system. Please refer to [pytorch.org](https://pytorch.org/) for the
detail of PyTorch (`torch`) installation. The following is the corresponding `torchvision` versions and supported Python
Please refer to the [official
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.

| `torch` | `torchvision` | Python |
Expand Down Expand Up @@ -39,55 +45,18 @@ versions.

</details>

Anaconda:

```
conda install torchvision -c pytorch
```

pip:

```
pip install torchvision
```
## Image Backends

From source:

```
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.
Torchvision currently supports the following image backends:

## 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)
- [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
## [UNSTABLE] Video Backend

Torchvision currently supports the following video backends:

Expand Down
61 changes: 31 additions & 30 deletions docs/source/io.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
Reading/Writing images and videos
=================================
Decoding / Encoding images and videos
=====================================

.. currentmodule:: torchvision.io

The :mod:`torchvision.io` package provides functions for performing IO
operations. They are currently specific to reading and writing video and
images.
operations. They are currently specific to reading and writing images and
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
-----
Expand All @@ -20,7 +46,7 @@ Video


Fine-grained video API
----------------------
^^^^^^^^^^^^^^^^^^^^^^

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.
Expand Down Expand Up @@ -61,28 +87,3 @@ Example of inspecting a video:
# the constructor we select a default video stream, but
# in practice, we can set whichever stream we would like
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

0 comments on commit 74f50d9

Please sign in to comment.