AdaCompress: Adaptive Compression for Online Computer Vision Services

Hongshan Li, Yu Guo, Zhi Wang, Shutao Xia, Wenwu Zhu · DOI · OpenReview

Abstract

As deep learning models for computer vision (CV) increasingly migrate to cloud-based environments, the bandwidth required to transmit high-resolution images has become a significant bottleneck. Standard compression techniques like JPEG are optimized for the human visual system rather than convolutional neural networks (CNNs), leading to inefficiencies. This paper introduces AdaCompress, a reinforcement learning-based framework that adaptively selects optimal JPEG compression levels for images sent to "black-box" cloud services. By leveraging a Deep Q-Network (DQN) to analyze image features, AdaCompress reduces upload bandwidth by up to 50% while maintaining high inference accuracy and improving end-to-end latency.

Introduction

The proliferation of cloud-based computer vision services—such as Amazon Rekognition, Baidu Vision, and Face++—allows edge devices to leverage powerful deep learning models without local compute overhead. However, this architecture introduces a massive bandwidth burden. To mitigate this, practitioners typically use JPEG compression.

The fundamental issue is that JPEG was designed to satisfy human aesthetics, not the structural requirements of machine learning models. A standard compression level (e.g., Quality=75) may waste data on images where a lower quality would suffice for a CNN, or conversely, it may destroy critical features in complex images. Furthermore, because cloud models are proprietary "black boxes," users cannot easily determine the specific sensitivity of a remote model to compression artifacts. AdaCompress addresses these challenges by treating compression as a dynamic, sequential decision-making problem.

The AdaCompress Framework

AdaCompress utilizes a Deep Reinforcement Learning (DRL) approach to optimize the trade-off between image size and model accuracy.

1. The DRL Agent

The system employs a Deep Q-Network (DQN) as the core decision-maker. To ensure the framework remains lightweight enough for edge deployment, the authors use the early convolutional layers of a pre-trained MobileNetV2 as a fixed feature extractor. This allows the agent to capture essential structural information from the image without the computational cost of a full deep network.

2. Action and Reward

The agent selects from 10 discrete JPEG quality levels, ranging from 5 to 95. The reward function is designed as a linear combination of accuracy and file size: it rewards the agent for maintaining high top-5 accuracy while applying a penalty proportional to the resulting file size. This forces the agent to find the "sweet spot" where data is minimized without compromising the cloud model's performance.

3. Adaptation via Inference-Estimate-Retrain

To handle real-world variability, AdaCompress implements a three-stage lifecycle:

  • Inference: The agent selects a compression level and uploads the image.
  • Estimate: Periodically, the system uploads both a compressed image and a high-quality reference image to sample the cloud model’s current accuracy.
  • Retrain: If the sampled accuracy falls below a threshold—often due to changes in environmental conditions like lighting or scenery—the agent triggers an online retraining phase to adapt to the new data distribution.

Experimental Evaluation

The researchers evaluated AdaCompress using standard datasets (ImageNet) and specialized datasets for environmental shifts (Day and Night Image Modeling - DNIM). Testing was conducted against major commercial APIs, including Amazon Rekognition, Face++, and Baidu Vision.

Machine vs. Human Vision

One of the most significant findings was the divergence between human and machine perception. Using Grad-CAM to visualize the agent's attention, the authors discovered that images with large, smooth areas are highly sensitive to compression for CNNs, whereas images with complex, busy textures are surprisingly robust. In many cases, images that appeared "destroyed" to a human observer could still be correctly classified by the cloud models.

Performance Metrics

  • Bandwidth Savings: AdaCompress consistently reduced image sizes by 50% to 66% compared to the industry-standard JPEG Quality=75.
  • Accuracy: Despite the aggressive compression, relative top-5 accuracy only decreased by an average of 7% across the tested cloud services.
  • Latency: While the DRL agent adds a minor local compute overhead (~2.09 ms), the drastic reduction in transmission time resulted in a net improvement in end-to-end latency, dropping from approximately 12.35 ms to 7.43 ms in simulated environments.

Conclusion and Future Work

AdaCompress demonstrates that adaptive, machine-centric compression can significantly optimize cloud-based vision services. While the current system requires occasional high-quality uploads for ground-truth estimation—which incurs API costs—it provides a clear path toward more efficient edge-to-cloud pipelines.

Future iterations of the framework may include "scenery caching," where the system stores specialized agents for specific environments (e.g., day vs. night) to eliminate retraining delays. Additionally, transfer learning could allow an agent trained on one cloud service to rapidly adapt to a new, unseen API with minimal data requirements.

Summary updated

BibTeX
@inproceedings{li2019adacompress,
  author = {Hongshan Li and Yu Guo and Zhi Wang and Shutao Xia and Wenwu Zhu},
  title = {{AdaCompress: Adaptive Compression for Online Computer Vision Services}},
  booktitle = {ACM Multimedia},
  year = {2019},
  doi = {10.1145/3343031.3350874},
}
Figure