DeepCache: Principled Cache for Mobile Deep Vision

Mengwei Xu, Mengze Zhu, Yunxin Liu, Felix Xiaozhu Lin, Xuanzhe Liu

TL;DR

DeepCache is a novel caching system designed to accelerate deep learning inference on mobile devices by exploiting temporal locality in video streams. It achieves significant speedups (up to 47%) and energy savings (up to 20%) with minimal accuracy loss by intelligently caching and reusing intermediate results within Convolutional Neural Networks (CNNs), all without requiring model modifications.

What Problem Does This Paper Address?

Mobile devices are increasingly equipped with powerful cameras, enabling a wide range of continuous vision applications like life logging, navigation, and augmented reality. These applications heavily rely on deep learning models, particularly CNNs, which are computationally expensive and power-hungry. Running these models on resource-constrained mobile devices presents a significant challenge. While offloading to the cloud is an option, it introduces latency and privacy concerns. Executing CNNs on-device is desirable for speed and privacy, but the computational demands often exceed mobile capabilities. This paper tackles the problem of making continuous mobile vision feasible by efficiently reusing computations across consecutive video frames, a concept known as exploiting temporal locality. The core challenge is to do this effectively while accounting for variations in video scenes, minimizing overhead, and maintaining model accuracy.

Methods

DeepCache introduces a principled caching approach with two main components:

  • Input-level Cache Key Lookup: At the input of the CNN, DeepCache identifies reusable regions within incoming video frames. It leverages techniques from video compression, specifically "diamond search," to efficiently find similar image regions across consecutive frames. This approach is designed to be robust to moderate scene variations caused by camera motion, object changes, or lighting.
  • Intra-model Cache Value Propagation: Instead of just caching the final output, DeepCache propagates reusable regions into the CNN model. It exploits the internal structure of CNNs to map these reusable image regions to corresponding intermediate feature map regions within each layer. These feature maps are then reused, bypassing computationally expensive operations. Crucially, DeepCache avoids applying video heuristics directly to the high-dimensional, difficult-to-interpret feature maps, treating them solely as cache values.

This design allows DeepCache to operate with unmodified CNN models and requires no manual developer effort for integration.

Datasets

The paper evaluates DeepCache on several datasets:

  • UCF101: A dataset for activity recognition, containing 101 human action classes and 13,421 short videos. The authors randomly selected 10 types for evaluation.
  • Nvidia driving dataset: A dataset for self-driving applications, containing 45,568 static images captured at 10 FPS with corresponding steering angles. The authors used 10 scenarios (100 images each) for testing.

The authors also mention using popular CNN models like AlexNet, GoogLeNet, ResNet-50, and YOLO, which are typically trained on large-scale image datasets like ImageNet.

Key Insights and Ideas

  • Exploiting Temporal Locality is Key for Mobile Vision: The paper strongly emphasizes that the inherent redundancy in consecutive video frames is a rich source of computational savings for mobile vision tasks.
  • Input-Level Matching is Sufficient and Efficient: DeepCache's success hinges on the insight that effective caching can be achieved by matching image regions at the input, rather than attempting complex and costly matching on internal feature maps across all layers. This significantly reduces overhead.
  • CNN Structure Enables Propagation: By understanding how CNN layers transform spatial information, DeepCache can intelligently propagate reusable regions through the network, maximizing the impact of initial cache hits.
  • No Developer Effort Required: A major advantage is that DeepCache works with existing, unmodified CNN models, making it immediately deployable and highly practical for real-world applications.
  • Convolutional Layers are the Bottleneck: The paper highlights that convolutional layers are the primary computational hotspots in most CNNs, making them the ideal target for caching optimizations.

Key Results

  • Latency Reduction: DeepCache reduces inference time by an average of 18.2% and up to 47.1% across various CNN models and benchmarks. This is significantly better than the baseline "no-cache" approach and competitive with or superior to existing methods like DeepMon.
  • Energy Saving: System energy consumption is reduced by an average of 19.7% and up to 28.6%, which is crucial for battery-powered mobile devices.
  • Minimal Accuracy Loss: The accuracy drop is very small, typically less than 3% for top-1 accuracy and less than 1.5% for top-3 accuracy, making the trade-off highly favorable.
  • Low Memory Overhead: DeepCache adds a memory overhead of only 2.5 MB to 43.8 MB, which is negligible compared to the total system DRAM on modern mobile devices.
  • Efficient Image Matching: The proposed image matching algorithm is efficient, capable of processing over 1,000 227x227 frames per second.

Limitations and Future Work

  • Cache Erosion: The paper acknowledges that reusability can diminish in deeper CNN layers, a phenomenon called "cache erosion." While DeepCache mitigates this by merging regions and focusing on early layers, it remains a challenge.
  • Accuracy Trade-off: While the accuracy loss is minimal, it exists. The paper suggests that for applications less sensitive to output accuracy, a lower matching threshold can be used for even greater latency improvements.
  • Periodic Cache Reset: To prevent accumulated accuracy loss over long video sequences, DeepCache periodically resets its cache and performs a full inference. The default interval is 10 frames.
  • Future Work: The authors suggest extending DeepCache to other layer types beyond convolutional layers and exploring its integration with hardware accelerators like GPUs and FPGAs for further speedups. They also mention the potential for DeepCache to coexist with other optimization techniques like model compression.

Summary updated

BibTeX
@inproceedings{xu2018deepcache,
  author = {Mengwei Xu and Mengze Zhu and Yunxin Liu and Felix Xiaozhu Lin and Xuanzhe Liu},
  title = {{DeepCache: Principled Cache for Mobile Deep Vision}},
  booktitle = {MobiCom},
  year = {2018},
  url = {https://openreview.net/forum?id=MTfNokmJZFO},
}
Figure