A collection of tools for neural compression enthusiasts
Project description
NeuralCompression
What's New
- July 2021 (image compression) - Released implemenation of Scale Hyperprior
- July 2021 (video compression) - Released implementation of DVC
About
NeuralCompression is a Python repository dedicated to research of neural networks that compress data. The repository includes tools such as JAX-based entropy coders, image compression models, video compression models, and metrics for image and video evaluation.
NeuralCompression is alpha software. The project is under active development. The API will change as we make releases, potentially breaking backwards compatibility.
Installation
NeuralCompression is a project currently under development. You can install the repository in development mode.
PyPI Installation
First, install PyTorch according to the directions from the PyTorch website. Then, you should be able to run
pip install neuralcompression
to get the latest version from PyPI.
Development Installation
First, clone the repository and navigate to the NeuralCompression root directory and install the package in development mode by running:
pip install --editable ".[dev, docs]"
If you are not interested in matching the test environment, then you only need to apply the second step to install.
Repository Structure
We use a 2-tier repository structure. The neuralcompression
package contains
a core set of tools for doing neural compression research. Code committed to
the core package requires stricter linting, high code quality, and rigorous
review. The projects
folder contains code for reproducing papers and training
baselines. Code in this folder is not linted aggressively, we don't enforce
type annotations, and it's okay to omit unit tests.
The 2-tier structure enables rapid iteration and reproduction via code in
projects
that is built on a backbone of high-quality code in
neuralcompression
.
neuralcompression
neuralcompression
- base packagedata
- PyTorch data loaders for various data setsentropy_coders
- lossless compression algorithms in JAXcraystack
- an implementation of the rANS algorithm with the craystack API
functional
- methods for image warping, information cost, flop counting, etc.layers
- building blocks for compression modelsmetrics
-torchmetrics
classes for assessing model performancemodels
- complete compression models
projects
projects
- recipes and code for reproducing papersscale_hyperprior_lightning
Scale Hyperprior (Balle et al., 2018)deep_video_compression
DVC (Lu et al., 2019)
Tutorial Notebooks
This repository also features interactive notebooks detailing different
parts of the package, which can be found in the tutorials
directory.
Existing tutorials are:
- Walkthrough of the
neuralcompression
flop counter (view on Colab). - Using
neuralcompression.metrics
andtorchmetrics
to calculate rate-distortion curves (view on Colab).
Getting Started
For an example of package usage, see the Scale Hyperprior for an example of how to train an image compression model in PyTorch Lightning. See DVC for a video compression example.
Contributions
Please read our CONTRIBUTING guide and our CODE_OF_CONDUCT prior to submitting a pull request.
We test all pull requests. We rely on this for reviews, so please make sure any
new code is tested. Tests for neuralcompression
go in the tests
folder in
the root of the repository. Tests for individual projects go in those projects'
own tests
folder.
We use black
for formatting, isort
for import sorting, flake8
for
linting, and mypy
for type checking.
License
NeuralCompression is MIT licensed, as found in the LICENSE file.
Cite
If you find NeuralCompression useful in your work, feel free to cite
@misc{muckley2021neuralcompression,
author={Matthew Muckley and Jordan Juravsky and Daniel Severo and Mannat Singh and Quentin Duval and Karen Ullrich},
title={NeuralCompression},
howpublished={\url{https://github.com/facebookresearch/NeuralCompression}},
year={2021}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file neuralcompression-0.2.1.tar.gz
.
File metadata
- Download URL: neuralcompression-0.2.1.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d293f01e0bf1d1279f1556fc3775e071fb1bfe57b63e5b1022fdcdbe784d48f |
|
MD5 | f564a1a197125215691b052e47fbd7cd |
|
BLAKE2b-256 | ce17aa278013c90691f527e27c23cd9708de4c4e93290166453d3b3aba898b8d |
File details
Details for the file neuralcompression-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: neuralcompression-0.2.1-py3-none-any.whl
- Upload date:
- Size: 104.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1b8a10dbc766f7b7775cbfcd5a4ef2d1cc21dd58bb991dc41eb7403a296cf6a |
|
MD5 | 9f3bbca00dc8449ff9112300a0577d3c |
|
BLAKE2b-256 | 7ea22cba88b8d17e65ffe5e2ddd600473132a9827a7d25df0cde6ad9cb92bef1 |