← 开源
Justin-Tan

generative-compression

TensorFlow Implementation of Generative Adversarial Networks for Extreme Learned Image Compression

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
533
Star
105
Fork
+0
本周
1
贡献者
创建于 2018-05-12 · 更新于 2026-07-18 · 今日第 17558 名
主要开发者
Justin-Tan

Justin-Tan/generative-compression 排名第 17,558,有 533 个星标。

同类别比较

Justin-Tan/generative-compression 排名第 17,558,此处有 8 个同类条目;InteractiveNLP-Team/RoleLLM-public 排名第 17,556。

同类别比较
名称排名指标
bohanli/BERT-flow17,540
语言:
Python
星标数:
534
分叉数:
68
简介:
TensorFlow implementation of On the Sentence Embeddings from Pre-trained Language Models (EMNLP 2020)
znxlwm/pytorch-MNIST-CelebA-cGAN-cDCGAN17,551
语言:
Python
星标数:
534
分叉数:
128
简介:
Pytorch implementation of conditional Generative Adversarial Networks (cGAN) and conditional Deep Convolutional Generative Adversarial Networks (cDCGAN) for MNIST dataset
BCG-X-Official/facet17,553
语言:
Jupyter Notebook
星标数:
533
分叉数:
47
简介:
Human-explainable AI.
InteractiveNLP-Team/RoleLLM-public17,556
星标数:
533
分叉数:
18
简介:
RoleLLM: Benchmarking, Eliciting, and Enhancing Role-Playing Abilities of Large Language Models
chaitjo/efficient-gnns17,565
语言:
Python
星标数:
533
分叉数:
63
简介:
Code and resources on scalable and efficient Graph Neural Networks (TNNLS 2023)
eyounx/VirtualTaobao17,567
语言:
Python
星标数:
533
分叉数:
97
简介:
Virtual-Taobao simulators with OpenAI Gym interface
johnsmith0031/alpaca_lora_4bit17,570
语言:
Python
星标数:
533
分叉数:
83
lucidrains/egnn-pytorch17,571
语言:
Python
星标数:
533
分叉数:
89
简介:
Implementation of E(n)-Equivariant Graph Neural Networks, in Pytorch
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
关键词Image production
星标数533
分叉数105
贡献者1
创建日期2018-05-12
更新日期2026-07-18
1 天星标数0
7 天星标数0
排名17,558
上次排名17,341
排名变化-217
7 天星标排名16,171
上次 7 天星标排名16,177
7 天星标排名变化6
总星标排名18,407
上次总星标排名18,385
总星标排名变化-22
国家UK
README 摘录

generative-compression TensorFlow Implementation for learned compression of images using Generative Adversarial Networks. The method was developed by Agustsson et. in Generative Adversarial Networks for Extreme Learned Image Compression. The proposed idea is very interesting and their approach is well-described. 8 Training is conducted with batch size 1 and reconstructed samples / tensorboard summaries will be periodically written every certain number of steps (default is 128). To compress a single image: The compressed image will be saved as a side

-by-side comparison with the original image under the path specified in in . If you are using the provided pretrained model with noise sampling, retain the hyperparameters under in , otherwise the parameters during test time should match the parameters set during training. *Note:* If you're willing to pay higher bitrates in exchange for much higher perceptual quality, you may want to check out this implementation of "High-Fidelity Generative Image Compression", which is in the same vein but operates in

higher bitrate regimes. Furthermore, it is capable of working with images of arbitrary size and resolution. Results These globally compressed images are from the test split of the Cityscapes dataset. The decoder seems to hallunicate greenery in buildings, and vice-versa. Global conditional compression: Multiscale discriminator + feature-matching losses, C=8 channels - (compression to 0. The model was subject to the multiscale discriminator and feature matching losses. Noise is sampled from a 128-dim normal distribution, passed through a DCGAN

-like generator and concatenated to the quantized image representation. The model was trained for 55 epochs on the train split of the Cityscapes dataset for the images and used the dataset for the corresponding semantic maps. This should work with the default settings under in . A pretrained model for global conditional compression with a bottleneck is also included. This model was, trained for 50 epochs with the same losses as above. Reconstruction is conditioned on semantic label maps (see the

folder and 'Conditional GAN usage'). Noise sampling model Conditional GAN model ** Warning: Tensorflow 1. 3 was used to train the models, but it appears to load without problems on Tensorflow 1. Please raise an issue if you have any problems. Details / extensions The network architectures are based on the description provided in the appendix of the original paper, which is in turn based on the paper Perceptual Losses for Real-Time Style Transfer and Super-Resolution The multiscale discriminator loss

used was originally proposed in the project High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs, consult for the implementation. If you would like to add an extension you can create a new method under the class, e. To change hyperparameters/toggle features use the knobs in . but I find it easier than a 20-line specification). Data / Setup Training was done using the ADE 20k dataset and the Cityscapes leftImg8bit dataset. In the former case images are rescaled

to width px, and in the latter images are resampled to prior to training. An example script for resampling using

常见问题

记录了多少星标和分叉?

Justin-Tan/generative-compression 有 533 个星标和 105 个分叉。

仓库排名是多少?

Justin-Tan/generative-compression 排名第 17,558。

记录的语言和类别是什么?

Justin-Tan/generative-compression 有 533 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

Justin-Tan/generative-compression 与 InteractiveNLP-Team/RoleLLM-public 比较,后者排名第 17,556,有 533 个星标。

README

generative-compression

TensorFlow Implementation for learned compression of images using Generative Adversarial Networks. The method was developed by Agustsson et. al. in Generative Adversarial Networks for Extreme Learned Image Compression. The proposed idea is very interesting and their approach is well-described.


Usage

The code depends on Tensorflow 1.8

# Clone
$ git clone https://github.com/Justin-Tan/generative-compression.git
$ cd generative-compression

# To train, check command line arguments
$ python3 train.py -h
# Run
$ python3 train.py -opt momentum --name my_network

Training is conducted with batch size 1 and reconstructed samples / tensorboard summaries will be periodically written every certain number of steps (default is 128). Checkpoints are saved every 10 epochs.

To compress a single image:

# Compress
$ python3 compress.py -r /path/to/model/checkpoint -i /path/to/image -o path/to/output/image

The compressed image will be saved as a side-by-side comparison with the original image under the path specified in directories.samples in config.py. If you are using the provided pretrained model with noise sampling, retain the hyperparameters under config_test in config.py, otherwise the parameters during test time should match the parameters set during training.

Note: If you're willing to pay higher bitrates in exchange for much higher perceptual quality, you may want to check out this implementation of "High-Fidelity Generative Image Compression", which is in the same vein but operates in higher bitrate regimes. Furthermore, it is capable of working with images of arbitrary size and resolution.

Results

These globally compressed images are from the test split of the Cityscapes leftImg8bit dataset. The decoder seems to hallunicate greenery in buildings, and vice-versa.

Global conditional compression: Multiscale discriminator + feature-matching losses, C=8 channels - (compression to 0.072 bbp)

Epoch 38 Epoch 44 Epoch 47 Epoch 48

Show quantized C=4,8,16 channels image comparison
Generator Loss Discriminator Loss

Pretrained Model

You can find the pretrained model for global compression with a channel bottleneck of C = 8 (corresponding to a 0.072 bpp representation) below. The model was subject to the multiscale discriminator and feature matching losses. Noise is sampled from a 128-dim normal distribution, passed through a DCGAN-like generator and concatenated to the quantized image representation. The model was trained for 55 epochs on the train split of the Cityscapes leftImg8bit dataset for the images and used the gtFine dataset for the corresponding semantic maps. This should work with the default settings under config_test in config.py.

A pretrained model for global conditional compression with a C=8 bottleneck is also included. This model was, trained for 50 epochs with the same losses as above. Reconstruction is conditioned on semantic label maps (see the cGAN/ folder and 'Conditional GAN usage').

** Warning: Tensorflow 1.3 was used to train the models, but it appears to load without problems on Tensorflow 1.8. Please raise an issue if you have any problems.

Details / extensions

The network architectures are based on the description provided in the appendix of the original paper, which is in turn based on the paper Perceptual Losses for Real-Time Style Transfer and Super-Resolution The multiscale discriminator loss used was originally proposed in the project High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs, consult network.py for the implementation. If you would like to add an extension you can create a new method under the Network class, e.g.

@staticmethod
def my_generator(z, **kwargs):
    """
    Inputs:
    z: sampled noise

    Returns:
    upsampled image
    """

    return tf.random_normal([z.get_shape()[0], height, width, channels], seed=42)

To change hyperparameters/toggle features use the knobs in config.py. (Bad form maybe. but I find it easier than a 20-line argparse specification).

Data / Setup

Training was done using the ADE 20k dataset and the Cityscapes leftImg8bit dataset. In the former case images are rescaled to width 512 px, and in the latter images are resampled to [512 x 1024] prior to training. An example script for resampling using Imagemagick is provided under data/. In each case, you will need to create a Pandas dataframe containing a single column: path, which holds the absolute/relative path to the images. This should be saved as a HDF5 file, and you should provide the path to this under the directories class in config.py. Examples for the Cityscapes dataset are provided in the data directory.

Conditional GAN usage

The conditional GAN implementation for global compression is in the cGAN directory. The cGAN implementation appears to yield images with the highest image quality, but this implementation remains experimental. In this implementation generation is conditioned on the information in the semantic label map of the selected image. You will need to download the gtFine dataset of annotation maps and append a separate column semantic_map_paths to the Pandas dataframe pointing to the corresponding images from the gtFine dataset.

Dependencies

Todo:

  • Incorporate GAN noise sampling into the reconstructed image. The authors state that this step is optional and that the sampled noise is combined with the quantized representation but don't provide further details. Currently the model samples from a normal distribution and upsamples this using a DCGAN-like generator (see network.py) to be concatenated with the quantized image representation w_hat, but this appears to substantially increase the 'hallunication factor' in the reconstructed images.
  • Integrate VGG loss.
  • Experiment with WGAN-GP.
  • Experiment with spectral normalization/
  • Experiment with different generator architectures with noise sampling.
  • Extend to selective compression using semantic maps (contributions welcome).

Resources

More Results

Global compression: Noise sampling, multiscale discriminator + feature-matching losses, C=8 channels - Compression to 0.072 bbp

排名相邻
同类项目