Deep Residual Learning in the JPEG Transform Domain

Max Ehrlich, Larry S. DavisICCV 2018

Abstract

We introduce a general method of performing Residual Network inference and learning in the JPEG transform domain that allows the network to consume compressed images as input. Our formulation leverages the linearity of the JPEG transform to redefine convolution and batch normalization with a tune-able numerical approximation for ReLU. The result is mathematically equivalent to the spatial domain network up to the ReLU approximation accuracy. A formulation for image classification and a model conversion algorithm for spatial domain networks are given as examples of the method. We show that the sparsity of the JPEG format allows for faster processing of images with little to no penalty in the network accuracy.

Introduction

In standard computer vision pipelines, images are typically stored in compressed formats such as JPEG. Before a neural network can process these images, they must be decompressed into the spatial domain (raw pixels). This decompression step is a "hidden" computational tax that consumes significant time and memory. This paper addresses the question: Why decompress at all? Since the initial stages of JPEG compression—Discrete Cosine Transform (DCT) and quantization—are linear operations, it is mathematically possible to perform network operations directly on the compressed coefficients.

Methods

The researchers reformulated the core components of a Residual Network (ResNet) to operate within the JPEG Transform Domain.

Linear Operations and Batch Normalization

Because the DCT is a linear map, spatial convolutions can be mathematically transformed into corresponding operations in the JPEG domain. This "Convolution Explosion" allows the network to bake decompression mathematics directly into its weights. Furthermore, the authors utilize a key property of the DCT: the first coefficient (the "DC" component) of a block is directly proportional to the mean of the pixels in that block. This makes calculating means and variances for Batch Normalization (BN) significantly more efficient than in the spatial domain.

Approximated Spatial Masking (ASM) for ReLU

The primary challenge in transform-domain processing is handling non-linearities like ReLU. The authors introduce Approximated Spatial Masking (ASM), which uses a subset of low-frequency coefficients to create a spatial "mask." This mask identifies which pixels would be zeroed out by ReLU, allowing the network to apply the non-linearity without full decompression. This technique is "tunable," allowing researchers to trade a small amount of accuracy for substantial gains in speed by adjusting the number of spatial frequencies used.

The proposed ResNet architecture operating in the JPEG transform domain.

Global Average Pooling

In the JPEG domain, Global Average Pooling (GAP) becomes a simple "read" operation of the DC coefficients, requiring almost zero computation compared to the spatial domain.

Results

The approach was evaluated using three standard benchmarks: MNIST (padded to 32x32), CIFAR-10, and CIFAR-100.

Accuracy and Mathematical Equivalence

For linear layers, the JPEG-domain network is mathematically equivalent to the spatial-domain version. When using the full set of frequencies for the ReLU approximation, the JPEG-domain models matched the spatial-domain models' accuracy within floating-point error (e.g., 0.988 for MNIST, 0.725 for CIFAR-10).

Inference Throughput

The most significant result is the increase in inference speed. As shown in the throughput analysis, JPEG testing throughput is significantly higher than spatial testing across all datasets. While training speedups were more marginal due to the complexity of gradient updates for "exploded" convolutions, the inference gains are substantial.

Comparison of throughput (images per second) between JPEG and spatial domain training and testing.

Conclusion

This work demonstrates that deep learning can be performed efficiently in the compressed domain. While current limitations include higher memory usage for linear maps and a lack of optimized library support for the required sparse tensor operations, the method provides a clear path toward faster computer vision pipelines by eliminating the decompression bottleneck.

Summary updated

BibTeX
@inproceedings{ehrlich2018deep,
  author = {Max Ehrlich and Larry S. Davis},
  title = {{Deep Residual Learning in the JPEG Transform Domain}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2018},
  url = {https://openreview.net/forum?id=1PNa2rN-yF},
}
Figure