Mobile AI Vehicle and VIN Recognition: From TensorFlow to TensorFlow Lite Deployment on Android and iOS
This article details how the 58 Used‑Car mobile team built, trained, and optimized TensorFlow‑based object‑detection models for on‑device vehicle and VIN code recognition, covering data preparation, model conversion to TF‑Lite, performance improvements, engineering integration on Android/iOS, and real‑world deployment results.
In recent years, the rapid upgrade of mobile hardware and continuous optimization of AI algorithms have made on‑device AI feasible; the 58 Used‑Car mobile team therefore explored vehicle auto‑recognition and VIN‑code recognition on Android and iOS.
Background: Traditional AI services run on backend servers due to limited device compute, causing high traffic, poor user experience, and server overload when images are uploaded for inference.
Pain points: Most apps upload raw photos to the server for vehicle detection, which is inflexible, cumbersome, and consumes bandwidth; the server also bears heavy processing load.
Idea: Run an object‑detection model on the device, filter out irrelevant images locally, and only upload images containing vehicles or VIN codes, thereby reducing traffic and server pressure.
Challenges: Mobile compute limits, model size, and integration of AI libraries on Android/iOS.
AI basics: The team used TensorFlow and its Object_Detection API to train a vehicle detection model, then converted it to TensorFlow Lite (TF‑Lite) for on‑device inference. TF‑Lite offers a smaller footprint and lower latency at the cost of some accuracy.
Vehicle detection project: The workflow included preparing and manually labeling ~1800 vehicle images, splitting them into train/val/test sets, converting XML annotations to CSV and then to TFRecord files, training the model, and visualizing progress with TensorBoard. After several iterations, a quantized MobileNet‑V2 model (~300 KB) was selected.
Data augmentation: Random cropping, brightness, contrast, saturation, and hue adjustments were applied to increase sample diversity, which significantly reduced false‑positive detections.
VIN‑code recognition: Using the same pipeline, ~2889 VIN images (expanded to 34 668 samples with adversarial examples) were processed; the model achieved >90 % confidence with occasional multi‑box errors.
Engineering integration: The TF‑Lite model is downloaded at runtime, keeping the app package small (Android +3.1 MB, iOS OC +1.3 MB, iOS Swift +3.1 MB). The detection flow is: real‑time on‑device coarse classification → upload only relevant images → server performs fine‑grained brand/model classification.
Optimization results: Introducing on‑device detection reduced coarse‑classification latency from ~150 ms to 0 ms and overall response time from ~500 ms to ~350 ms (≈30‑40 % improvement). The app size increase is limited to the dependency library, avoiding a full model bundle.
Demo: Screenshots and GIFs show the real‑time scanning UI and recognition outcomes for both vehicle and VIN detection.
Conclusion & future work: The two AI features demonstrate a complete mobile AI pipeline, providing a template for further on‑device AI scenarios as mobile hardware continues to improve.
References: 1. https://TensorFlow.google.cn/lite
Authors: Li Tong (Backend & Mobile Lead), Ma Zhichao (Senior iOS Engineer), Huang Haijie (Senior Android Engineer) at 58.com Used‑Car Technology Department.
58 Tech
Official tech channel of 58, a platform for tech innovation, sharing, and communication.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.