/torchvideo

:movie_camera: Datasets, transforms and samplers for video in PyTorch

Primary LanguagePythonMozilla Public License 2.0MPL-2.0

torchvideo

Build Status PyPI versions codecov Documentation Status

WARNING: Do not use this library. It is still in development. When this notice is removed it will be sufficiently stable for usage.

A PyTorch library for video-based computer vision tasks. torchvideo provides dataset loaders specialised for video, video frame samplers, and transformations specifically for video.

Get started

Set up an accelerated environment in conda

$ conda env create -f environment.yml -n torchvideo
$ conda activate torchvideo

# The following steps are taken from
# https://docs.fast.ai/performance.html#installation

$ conda uninstall -y --force pillow pil jpeg libtiff
$ pip uninstall -y pillow pil jpeg libtiff
$ conda install -y -c conda-forge libjpeg-turbo
$ CFLAGS="${CFLAGS} -mavx2" pip install --upgrade --no-cache-dir --force-reinstall --no-binary :all: --compile pillow-simd
$ conda install -y jpeg libtiff

NOTE: If the installation of pillow-simd fails, you can try installing GCC from conda-forge and trying the install again:

$ conda install -y gxx_linux-64
$ export CXX=x86_64-conda_cos6-linux-gnu-g++
$ export CC=x86_64-conda_cos6-linux-gnu-gcc
$ CFLAGS="${CFLAGS} -mavx2" pip install --upgrade --no-cache-dir --force-reinstall --no-binary :all: --compile pillow-simd
$ conda install -y jpeg libtiff

If you install any new packages, check that pillow-simd hasn't be overwritten by an alternate pillow install by running:

$ python -c "from PIL import Image; print(Image.PILLOW_VERSION)"

You should see something like

6.0.0.post0

Pillow doesn't release with post suffixes, so if you have post in the version name, it's likely you have pillow-simd installed.

Install torchvideo

$ pip install git+https://github.com/willprice/torchvideo.git@master

Learn how to use torchvideo

Check out the example notebooks, you can launch these on binder without having to install anything locally!

Acknowledgements

Thanks to the following people and projects

  • yjxiong for his work on TSN and publicly available pytorch implementation from which many of the transforms in this project started from.
  • dukebw for his excellent lintel FFmpeg video loading library.
  • hypothesis and the team behind it. This has been used heavily in testing the project.