This repository was archived by the owner on Aug 6, 2025. It is now read-only.
v0.2.0
NeuralCompression is a PyTorch-based Python package intended to simplify neural network-based compression research. It is similar to (and shares some of the functionality) of fantastic libraries like TensorFlow Compression and Compress AI.
The major theme of v0.2.0 release is autoencoders, particularly features useful for implementing existing models by Ballé and features useful to expand on these models in forthcoming research. In addition, 0.2.0 sees some code organization changes and published documentation. I recommend reading the new “Image Compression” example to see some of these changes.
API Additions
Data (neuralcompression.data)
CLIC2020Image: Challenge on Learned Image Compression (CLIC) 2020 Image DatasetCLIC2020Video: Challenge on Learned Image Compression (CLIC) 2020 Video Dataset
Distributions (neuralcompression.distributions)
NoisyNormal: normal distribution with additive identically distributed (i.i.d.) uniform noise.UniformNoise: adapts a continuous distribution via additive identically distributed (i.i.d.) uniform noise.
Functional (neuralcompression.functional)
estimate_tails: estimates approximate tail quantiles.log_cdf: logarithm of the distribution’s cumulative distribution function (CDF).log_expm1: logarithm ofe^{x} - 1.log_ndtr: logarithm of the normal cumulative distribution function (CDF).log_survival_function: logarithm ofxfor a distribution’s survival function.lower_bound:torch.maximumwith a gradient forx < bound.lower_tail: approximates lower tail quantile for range coding.ndtr: the normal cumulative distribution function (CDF).pmf_to_quantized_cdf: transforms a probability mass function (PMF) into a quantized cumulative distribution function (CDF) for entropy coding.quantization_offset: computes a distribution-dependent quantization offset.soft_round_conditional_mean: conditional mean ofxgiven noisy soft rounded values.soft_round_inverse: inverse ofsoft_round.soft_round: differentiable approximation oftorch.round.survival_function: survival function ofx. Generally defined as1 - distribution.cdf(x).upper_tail: approximates upper tail quantile for range coding.
Layers (neuralcompression.layers)
AnalysisTransformation2D: applies the 2D analysis transformation over an input signal.ContinuousEntropy: base class for continuous entropy layers.GeneralizedDivisiveNormalization: applies generalized divisive normalization for each channel across a batch of data.HyperAnalysisTransformation2D: applies the 2D hyper analysis transformation over an input signal.HyperSynthesisTransformation2D: applies the 2D hyper synthesis transformation over an input signal.NonNegativeParameterization: the parameter is subjected to an invertible transformation that slows down the learning rate for small values.RateMSEDistortionLoss: rate-distortion loss.SynthesisTransformation2D: applies the 2D synthesis transformation over an input signal.
Models (neuralcompression.models)
End-to-end Optimized Image Compression
End-to-end Optimized Image Compression
Johannes Ballé, Valero Laparra, Eero P. Simoncelli
https://arxiv.org/abs/1611.01704
PriorAutoencoder: base class for implementing prior autoencoder architectures.FactorizedPriorAutoencoder
High-Fidelity Generative Image Compression
High-Fidelity Generative Image Compression
Fabian Mentzer, George Toderici, Michael Tschannen, Eirikur Agustsson
https://arxiv.org/abs/2006.09965
HiFiCEncoderHiFiCDiscriminatorHiFiCGenerator
Variational Image Compression with a Scale Hyperprior
Variational Image Compression with a Scale Hyperprior
Johannes Ballé, David Minnen, Saurabh Singh, Sung Jin Hwang, Nick Johnston
https://arxiv.org/abs/1802.01436
HyperpriorAutoencoder: base class for implementing hyperprior autoencoder architectures.MeanScaleHyperpriorAutoencoderScaleHyperpriorAutoencoder
API Changes
neuralcompression.functional.hsv2rgbis nowneuralcompression.functional.hsv_to_rgb.- neuralcompression.functional.learned_perceptual_image_patch_similarity is now
neuralcompression.functional.lpips.
Acknowledgements
Thank you to the following people for their advice:
- Johannes Ballé (@jonycgn) and TensorFlow Compression
- Jean Bégaint (@jbegaint) and Compress AI
- Fabien Racapé (@fracape) and Compress AI
- Justin Tan (@Justin-Tan) and high-fidelity-generative-compression