JPEG Inspired Deep Learning
Ahmed H. Salamah, Kaixiang Zheng, Yiwen Liu, En-Hui Yang
TL;DR
The paper tackles the conventional view that JPEG compression harms deep learning performance by introducing JPEG-DL, a framework that inserts a trainable JPEG layer with a differentiable soft quantizer before any DNN and jointly optimizes it with the network. By replacing the non-differentiable quantization with a differentiable quantizer based on a trainable CPMF, the method enables end-to-end learning of both quantization and model parameters, forming a unified model. Empirical results across multiple datasets and architectures show consistent accuracy gains (up to 20.9% on fine-grained tasks) and improved adversarial robustness, with only a small parameter overhead. The work demonstrates that a carefully designed, learnable JPEG front-end can serve as a powerful non-linear preprocessing stage, enhancing both performance and interpretability in vision systems.
Abstract
Although it is traditionally believed that lossy image compression, such as JPEG compression, has a negative impact on the performance of deep neural networks (DNNs), it is shown by recent works that well-crafted JPEG compression can actually improve the performance of deep learning (DL). Inspired by this, we propose JPEG-DL, a novel DL framework that prepends any underlying DNN architecture with a trainable JPEG compression layer. To make the quantization operation in JPEG compression trainable, a new differentiable soft quantizer is employed at the JPEG layer, and then the quantization operation and underlying DNN are jointly trained. Extensive experiments show that in comparison with the standard DL, JPEG-DL delivers significant accuracy improvements across various datasets and model architectures while enhancing robustness against adversarial attacks. Particularly, on some fine-grained image classification datasets, JPEG-DL can increase prediction accuracy by as much as 20.9%. Our code is available on https://github.com/AhmedHussKhalifa/JPEG-Inspired-DL.git.
