Skip to content

Orange-OpenSource/Cool-Chic

Repository files navigation

Forks Stargazers Issues BSD-3 License PyTorch


Cool-chic (pronounced /kul ʃik/ as in French 🥖🧀🍷) is a low-complexity neural image codec based on overfitting.

  • 🏆 Coding performance: Cool-chic offers visual quality similar to H.266/VVC with 30% less rate

  • 🪶 Lightweight decoder: Cool-chic decoder performs only 1000 multiplications per decoded pixel

  • 🚀 Fast CPU-only decoder: Decode a 1280x720 image in 100 ms on CPU with our decoder written in C


🎲 Cool-chic 4.2.0: Common Randomness & Wasserstein Distance! 🎲

Cool-chic 4.2 focuses on perceptually-oriented image coding. This release draws heavily on the following paper: Good, Cheap, and Fast: Overfitted Image Compression with Wasserstein Distortion, Ballé et al..

  • Wasserstein Distance as a distortion metric: use --tune=wasserstein
  • Decoder-side common randomness for additional details in the decoded image
  • Improved image coding performance: around -50% rate versus Cool-chic 4.1 for the same visual quality
  • Low decoding complexity 1728 MAC / pixel

A pair of bitstreams in samples/bitstreams/ illustrates the benefits of the --tune=wasserstein options. See the decoding example to decode them and see the pictures.

Check-out the release history to see previous versions of Cool-chic.

Setup

See the Cool-chic setup documentation for additional details

# We need to get these packages to compile the C API and bind it to python.
sudo add-apt-repository -y ppa:deadsnakes/ppa && sudo apt update
sudo apt install -y build-essential python3.10-dev pip g++
git clone https://github.com/Orange-OpenSource/Cool-Chic.git && cd Cool-Chic

# Install create and activate virtual env
python3.10 -m pip install virtualenv
python3.10 -m virtualenv venv && source venv/bin/activate

# Install Cool-chic
pip install -e .

# Sanity check
python -m test.sanity_check

Encoding

See the example page for more encoding examples. A comprehensive description of the encoder parameters are available for image and video compression.

# Encode an image using the default (fast) configuration
python coolchic/encode.py -i image.png -o ./bitstream.cool

# Video requires to successively encode multiples frames.
python samples/encode.py -i myTestVideo_1920x1080_24p_yuv420_8b.yuv -o bitstream.cool

Decoding

Call the C decoder through a python wrapper to decode Cool-chic bitstreams.

# Decoder outputs either PPM (image) or YUV (video) files
python coolchic/decode.py -i samples/bitstreams/a365_wd.cool -o a365_wd.ppm


Cool-chic Logo