Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

v0.2.0

Choose a tag to compare

@0x00b1 0x00b1 released this 13 Dec 18:01
cc2c1b4

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)

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 of e^{x} - 1.
  • log_ndtr: logarithm of the normal cumulative distribution function (CDF).
  • log_survival_function: logarithm of x for a distribution’s survival function.
  • lower_bound: torch.maximum with a gradient for x < 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 of x given noisy soft rounded values.
  • soft_round_inverse: inverse of soft_round.
  • soft_round: differentiable approximation of torch.round.
  • survival_function: survival function of x. Generally defined as 1 - 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
  • HiFiCEncoder
  • HiFiCDiscriminator
  • HiFiCGenerator

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.
  • MeanScaleHyperpriorAutoencoder
  • ScaleHyperpriorAutoencoder

API Changes

  • neuralcompression.functional.hsv2rgb is now neuralcompression.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: