Integration of Convolutional Neural Networks in Mobile Applications

Roger Creus Castanyer, Silverio Martínez-Fernández, Xavier FranchWain@icse 2021

Introduction

The rapid advancement of Deep Learning (DL) has transformed computer vision, yet its deployment remains largely tethered to high-performance server environments. Integrating these complex models into mobile applications presents a significant "performance trade-off": the pursuit of higher accuracy often necessitates increased model complexity, which in turn strains mobile hardware, leading to latency, excessive storage requirements, and battery depletion. This paper investigates the practical challenges of bridging the gap between development and operation environments, proposing a sustainable lifecycle for mobile-centric DL.

Methodology

The research utilizes an end-to-end DL lifecycle encompassing five distinct stages: data management, modelling, development, system operation, and research output generation.

End-to-end deep learning lifecycle for mobile deployment.

Model Selection and Training

The study benchmarks three primary architectures:

  1. SmallCNN: A custom-tuned, lightweight architecture.
  2. MobileNet v2: An industry-standard architecture optimized for mobile devices.
  3. ResNet34: A deeper, high-capacity benchmark model.

Training was conducted using PyTorch, with models exported via the Open Neural Network Exchange (ONNX) format. For on-device inference, the Unity engine was employed alongside the Barracuda library.

Dataset and Data Feedback Loop

The German Traffic Sign Recognition Benchmark (GTSRB), consisting of over 51,000 images across 43 classes, served as the primary dataset. To address real-world performance degradation, the authors implemented a "human-in-the-loop" sustainability cycle. This feature allows the mobile application to capture and "Send Data"—specifically images where the model shows low confidence—back to developers for manual annotation and subsequent model retraining.

Analysis and Insights

The Framework Gap

A critical finding of this study is the significant friction between training and deployment frameworks. Standard operations in PyTorch, such as view(), often lack direct compatibility with mobile inference engines like Unity Barracuda, requiring manual intervention (e.g., replacing them with Flatten()). This highlights a need for more unified tools that span the entire DL lifecycle.

Complexity ≠ Accuracy

The results challenge the assumption that deeper models are inherently superior for specialized tasks. The custom SmallCNN achieved performance parity with the much larger ResNet34, suggesting that domain-specific optimization can yield high accuracy without the prohibitive resource costs of general-purpose deep architectures.

Results

The benchmarking results demonstrate that SmallCNN offers a superior balance of performance and efficiency for mobile deployment. As shown in the table below, SmallCNN achieved 95% accuracy with significantly fewer parameters and a smaller memory footprint compared to larger CNN variants.

Comparison of model architectures, parameters, and performance metrics.

Key quantitative findings include:

  • Resource Efficiency: SmallCNN utilized only 5.1M parameters and a 22.11MB footprint, whereas ResNet34 required 21.7M parameters and an 83.24MB footprint to reach the same 95% accuracy threshold.
  • Real-World Adaptation: Initial testing on mobile-captured data showed poor accuracy (~45%). However, after integrating real-world samples via the "Send Data" loop, accuracy for SmallCNN improved to 92.95%, while ResNet34 reached 98.59%.
  • MobileNet v2 Paradox: Despite its mobile-first design, MobileNet v2 required extensive data augmentation to perform effectively on the traffic sign task, indicating that "off-the-shelf" mobile models still require significant tuning.

Conclusion

Deploying DL to the edge requires a shift from static model development to a living, iterative lifecycle. By prioritizing architectural efficiency and implementing robust data feedback loops, developers can overcome the hardware constraints of mobile devices. Future research will focus on automating the retraining pipeline, enhancing model explainability through better confidence indicators, and exploring specialized mobile GPU operations to further optimize inference.

Summary updated

BibTeX
@inproceedings{castanyer2021integration,
  author = {Roger Creus Castanyer and Silverio Martínez-Fernández and Xavier Franch},
  title = {{Integration of Convolutional Neural Networks in Mobile Applications}},
  booktitle = {Wain@icse},
  year = {2021},
  doi = {10.1109/wain52551.2021.00010},
}
Figure