winkeywoo2020 / JSNet

A simulation network of JPEG lossy compression

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSNet:A simulation network of JPEG lossy compression for color images

Overview

JSNet is a JPEG simulation network which is proposed to reappear the whole procedure of the JPEG lossy compression and restoration except entropy encoding as realistically as possible for color images. The steps of sampling, DCT, and quantization are modelled by the max-pooling layer, convolution layer, and 3D noise-mask, respectively. The proposed JSNet can simulate JPEG lossy compression with any quality factors.

Beijing Chen, Yunqing Wu, Gouenou Coatrieux, et al. JSNet: A simulation network of JPEG lossy compression and restoration for robust image watermarking against JPEG attack.Computer Vision and Image Understanding, 2020; 197:103015.

Prerequisites

Linux

NVIDIA GPU+CUDA CuDNN (CPU mode may also work, but untested)

Install Tensorflow and dependencies

Clone the repo: JSNet

Setup training dataset

To train JSNet, you need to create two data folders TrainRaw and TrainGoal. The TrainRaw folder contains the original images without JPEG compression. The TrainGoal folder contains the JPEG compressed images of that in TrainRaw folder.

You can randomly select 6000 color images from the ImageNet. The dataset used for training was collected by other researches, please cite their paper if you use the data for your own research.

All the images are cropped to 256*256. You can refer to the Data preprocessing folder in the repository to prepare your own dataset.

Using Pre-trained Models

As the training images are randomly selected, for better and faster training, we release the pre-trained model. You can load the pre-trained model for fine-tuning in the training stage.

Training and Test Details

To train a model, you need to prepare two TXT files for data loading and you are welcome to modify the source code using other data loading methods. Just run the JSNet90_train_ImageNet.py on your machine for training. The same goes for testing. In the training stage, you may adjust parameters for a better model. You can also apply the trained model in the CRWNet if you are interested in watermarking. We provide two versions, the basic CRWNet and the CRWNet90.

Warm Tips:

1) Please pay attention to checking whether the original images are corresponded to the target images, otherwise the training will fail.

2) If you want to simulate JPEG with other quality factors, you need to make two changes:

  • a) modify your TrainGoal folder with the target compressed images;
  • b) modify the corresponding network parameters.

Related Works

About

A simulation network of JPEG lossy compression


Languages

Language:Python 99.4%Language:MATLAB 0.6%