← Open Source
jiaxi-jiang

FBCNN

Official Code for ICCV 2021 paper "Towards Flexible Blind JPEG Artifacts Removal (FBCNN)".

Model DevelopmentArchitecturePython
Open on GitHub
Momentum
+2stars in 24 hours+0.4%
534
Stars
53
Forks
+2
This week
1
Contributors
Created 2021-09-12 · Updated 2026-10-16 · #4289 today
Top developers
jiaxi-jiang

jiaxi-jiang/FBCNN is ranked 4,289 with 534 stars.

Same-category comparison

jiaxi-jiang/FBCNN is ranked 4,289 among these 8 peers; Rhoban/bam is ranked 4,278.

Same-category comparison
NameRankMetrics
Zhefan-Xu/isaac-go2-ros24,231
Language:
Python
Stars:
598
Forks:
87
Description:
Unitree Go2 simulation platform for testing navigation, decision-making and autonomous tasks. (NVIDIA Isaac/ROS2).
HKUST-Aerial-Robotics/OmniNxt4,243
Stars:
585
Forks:
40
Description:
[IROS'24 Oral] A Fully Open-source and Compact Aerial Robot with Omnidirectional Visual Perception.
TX-Leo/HumanEgo4,250
Language:
Python
Stars:
577
Forks:
55
Description:
HumanEgo: Zero-Shot Robot Learning from Minutes of Human Egocentric Videos.
Rhoban/bam4,278
Language:
Python
Stars:
547
Forks:
71
Description:
Identify and simulate extended friction models for servo-actuators.
KlingAIResearch/VideoAlign4,305
Language:
Python
Stars:
519
Forks:
13
Description:
[NeurIPS 2025] Improving Video Generation with Human Feedback.
stillwater-sc/universal4,322
Language:
C++
Stars:
504
Forks:
73
Description:
Large collection of number systems providing custom arithmetic for mixed-precision algorithm development and optimization for AI, Machine Learning, Computer Vision, Signal Processing, CAE, EDA, control, optimization, estimation, and approximation.
openai/gym4,331
Language:
Python
Stars:
37,242
Forks:
8,668
Description:
A toolkit for developing and comparing reinforcement learning algorithms.
microsoft/unilm4,347
Language:
Python
Stars:
22,238
Forks:
2,742
Description:
Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryArchitecture
KeywordsComputer vision, Image-to-image
Stars534
Forks53
Contributors1
Created date2021-09-12
Updated date2026-10-16
Stars in 1 day2
Stars in 7 days2
Rank4,289
Previous rank17,371
Rank change13,082
7-day stars rank8,868
Previous 7-day stars rank16,195
7-day stars rank change7,327
Total stars rank18,374
Previous total stars rank18,419
Total stars rank change45
CountrySwitzerland
README summary

Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021) Jiaxi Jiang, Kai Zhang, Radu Timofte *Computer Vision Lab, ETH Zurich, Switzerland* ________ Training, Testing :sunny::sunny:**Try your own JPEG images in a second by clicking on Gradio Web Demo! ** Our model is integrated to Huggingface Spaces with Gradio. FBCNN achieves **state-of-the-art performance** in **BLIND** JPEG artifacts removal on Single JPEG images (color/grayscale) Double JPEG images (aligned/non-aligned) Real-world JPEG images >Training a single deep

blind model to handle different quality factors for JPEG image artifacts removal has been attracting considerable attention due to its convenience for practical usage. However, existing deep blind methods usually directly reconstruct the image without predicting the quality factor, thus lacking the flexibility to control the output as the non-blind methods. To remedy this problem, in this paper, we propose a flexible blind convolutional neural network, namely FBCNN, that can predict the adjustable quality factor to control the trade

-off between artifacts removal and details preservation. Specifically, FBCNN decouples the quality factor from the JPEG image via a decoupler module and then embeds the predicted quality factor into the subsequent reconstructor module through a quality factor attention block for flexible control. Besides, we find existing methods are prone to fail on non-aligned double JPEG images even with only a one-pixel shift, and we thus propose a double JPEG degradation model to augment the training data. Extensive experiments

on single JPEG images, more general double JPEG images, and real-world JPEG images demonstrate that our proposed FBCNN achieves favorable performance against state-of-the-art methods in terms of both quantitative metrics and visual quality. However, it is a lossy compression algorithm and can introduce annoying artifacts. Existing methods for JPEG artifacts removal generally have four limitations in real applications: Most existing learning-based methods [e. ARCNN, MWCNN, SwinIR] trained a specific model for each quality factor, lacking

the flexibility to learn a single model for different JPEG quality factors. DMCNN, QGAC] need to obtain the DCT coefficients or quantization table as input, which is only stored in JPEG format. Besides, when images are compressed multiple times, only the most recent compression information is stored. DnCNN, DCSC, QGAC] can only provide a deterministic reconstruction result for each input, ignoring the need for user preferences. Existing methods are all trained with synthetic images which assumes that the low-quality

images are compressed only once. _**However, most images from the Internet are compressed multiple times. **_ Despite some progress for real recompressed images, e. from Twitter [ARCNN, DCSC], a detailed and complete study on double JPEG artifacts removal is still missing. The quality factor can be manually adjusted for flexible JPEG restoration according to the user's preference. What is non-aligned double JPEG compression? Non-aligned double JPEG compression means that the 8x8 blocks of two JPEG compression are not aligned

. For example, when we crop a JPEG image and save it also as JPEG, it is highly possible we get

Frequently asked questions

How many stars and forks are recorded?

jiaxi-jiang/FBCNN has 534 stars and 53 forks.

What is the repository rank?

jiaxi-jiang/FBCNN is ranked 4,289.

What language and category are recorded?

jiaxi-jiang/FBCNN has 534 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

jiaxi-jiang/FBCNN is compared with Rhoban/bam, ranked 4,278 with 547 stars.

README

Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021)

Jiaxi Jiang, Kai Zhang, Radu Timofte

Computer Vision Lab, ETH Zurich, Switzerland


Training, Testing

:sunny::sunny:Try your own JPEG images in a second by clicking on Gradio Web Demo! Our model is integrated to Huggingface Spaces with Gradio.

:fire::fire: This repository is the official PyTorch implementation of paper "Towards Flexible Blind JPEG Artifacts Removal". FBCNN achieves state-of-the-art performance in BLIND JPEG artifacts removal on

  • Single JPEG images (color/grayscale)
  • Double JPEG images (aligned/non-aligned)
  • Real-world JPEG images

Training a single deep blind model to handle different quality factors for JPEG image artifacts removal has been attracting considerable attention due to its convenience for practical usage. However, existing deep blind methods usually directly reconstruct the image without predicting the quality factor, thus lacking the flexibility to control the output as the non-blind methods. To remedy this problem, in this paper, we propose a flexible blind convolutional neural network, namely FBCNN, that can predict the adjustable quality factor to control the trade-off between artifacts removal and details preservation. Specifically, FBCNN decouples the quality factor from the JPEG image via a decoupler module and then embeds the predicted quality factor into the subsequent reconstructor module through a quality factor attention block for flexible control. Besides, we find existing methods are prone to fail on non-aligned double JPEG images even with only a one-pixel shift, and we thus propose a double JPEG degradation model to augment the training data. Extensive experiments on single JPEG images, more general double JPEG images, and real-world JPEG images demonstrate that our proposed FBCNN achieves favorable performance against state-of-the-art methods in terms of both quantitative metrics and visual quality.

🚀🚀 Some Visual Examples (Click for full images)


Training

For training, just run the following code:

python main_train_fbcnn.py

The .json configuration file for training is located in ./options/

Testing

  • Grayscale JPEG images
python main_test_fbcnn_gray.py
  • Grayscale JPEG images, trained with double JPEG degradation model
python main_test_fbcnn_gray_doublejpeg.py
  • Color JPEG images
python main_test_fbcnn_color.py
  • Real-World JPEG images
python main_test_fbcnn_color_real.py

Contents

Motivations

JPEG is one of the most widely-used image compression algorithms and formats due to its simplicity and fast encoding/decoding speeds. However, it is a lossy compression algorithm and can introduce annoying artifacts. Existing methods for JPEG artifacts removal generally have four limitations in real applications:

  • Most existing learning-based methods [e.g. ARCNN, MWCNN, SwinIR] trained a specific model for each quality factor, lacking the flexibility to learn a single model for different JPEG quality factors.

  • DCT-based methods [e.g. DMCNN, QGAC] need to obtain the DCT coefficients or quantization table as input, which is only stored in JPEG format. Besides, when images are compressed multiple times, only the most recent compression information is stored.

  • Existing blind methods [e.g. DnCNN, DCSC, QGAC] can only provide a deterministic reconstruction result for each input, ignoring the need for user preferences.

  • Existing methods are all trained with synthetic images which assumes that the low-quality images are compressed only once. However, most images from the Internet are compressed multiple times. Despite some progress for real recompressed images, e.g. from Twitter [ARCNN, DCSC], a detailed and complete study on double JPEG artifacts removal is still missing.

Network Architecture

We propose a flexible blind convolutional neural network (FBCNN) that predicts the quality factor of a JPEG image and embed it into the decoder to guide image restoration. The quality factor can be manually adjusted for flexible JPEG restoration according to the user's preference.

Analysis of Double JPEG Restoration

1. What is non-aligned double JPEG compression?

Non-aligned double JPEG compression means that the 8x8 blocks of two JPEG compression are not aligned. For example, when we crop a JPEG image and save it also as JPEG, it is highly possible we get a non-aligned double JPEG image. There are many other common scenarios including, but not limited to:

  • take a picture by smartphone and upload it online. Most social media platforms, e.g. Wechat, Twitter, Facebook, resize the uploaded images by downsampling and then apply JPEG compression to save storage space.
  • Edit a JPEG image that introduces cropping, rotation, or resizing, and save it as JPEG.
  • Zoom in/out a JPEG image, then take a screenshot, save it as JPEG.
  • Group different JPEG image and save it as a single JPEG image.
  • Most memes are compressed many times with non-aligned cases.

2. Limitation of existing blind methods on restoration of non-aligned double JPEG images

We find that existing blind methods always do not work when the 8x8 blocks of two JPEG compression are not aligned and QF1 <= QF2, even with just a one-pixel shift. Other cases such as non-aligned double JPEG with QF1>QF2, or aligned double JPEG compression, are actually equivalent to single JPEG compression.

Here is an example of the restoration result of DnCNN and QGAC on a JPEG image with different degradation settings. '*' means there is a one-pixel shift between two JPEG blocks.

3. Our solutions

We find for non-aligned double JPEG images with QF1 < QF2, FBCNN always predicts the quality factor as QF2. However, it is the smaller QF1 that dominants the compression artifacts. By manually changing the predicted quality factor to QF1, we largely improve the result.

Besides, to get a fully blind model, we propose two blind solutions to solve this problem:

(1) FBCNN-D: Train a model with a single JPEG degradation model + automatic dominant QF correction. By utilizing the property of JPEG images, we find the quality factor of a single JPEG image can be predicted by applying another JPEG compression. When QF1 = QF2, the MSE of two JPEG images is minimal. In our paper, we also extend this method to non-aligned double JPEG cases to get a fully blind model.

(2) FBCNN-A: Augment training data with double JPEG degradation model, which is given by:

y = JPEG(shift(JPEG(x, QF1)),QF2)

By reducing the misalignment of training data and real-world JPEG images, FBCNN-A further improves the results on complex double JPEG restoration. This proposed double JPEG degradation model can be easily integrated into other image restoration tasks, such as single image super-resolution (e.g. BSRGAN), for better general real image restoration.

Experiments

1. Single JPEG restoration

*: Train a specific model for each quality factor.

2. Non-aligned double JPEG restoration

There is a pixel shift of (4,4) between the blocks of two JPEG compression.

3. Real-world JPEG restoration

4. Flexibility of FBCNN

By setting different quality factors, we can control the trade-off between artifacts removal and details preservation, according to the user's preference.

Citation

@inproceedings{jiang2021towards,
  title={Towards Flexible Blind JPEG Artifacts Removal},
  author={Jiang, Jiaxi and Zhang, Kai and Timofte, Radu},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={4997--5006},
  year={2021}
  }

License and Acknowledgement

This project is released under the Apache 2.0 license. This work was partly supported by the ETH Zürich Fund (OK) and a Huawei Technologies Oy (Finland) project.

Nearby in the ranking
Similar items