SSDLite MobileNetV2
is a lightweight real-time object detection model designed to run efficiently on mobile and embedded
devices. It combines the SSD (Single Shot MultiBox Detector)
architecture with a MobileNetV2 backbone, replacing the standard SSD
convolutions with depthwise-separable convolutions (hence "SSDLite") to reduce computation. Given an
RGB image, the model regresses bounding box coordinates and a class-score distribution over 91 COCO
categories for each of 1917 prior boxes; box decoding and non-maximum suppression (NMS) are not part of
the model graph (see example.py for a full post-processing implementation).
This repository contains a quantized int8 model, pre-compiled for NXP i.MX 8M Plus, i.MX 93, i.MX 95 and
i.MX 952 processors, at a fixed 300x300 input resolution. It also contains the scripts used to
regenerate these assets (recipe.sh), an inference example (example.py) and an evaluation script
(evaluate.py).
This repository contains pre-compiled model files optimized for NXP i.MX 8M Plus, i.MX 93, i.MX 95, and i.MX 952 processors.
This model is a derivative work with the following changes from the original:
image / 127.5 - 1.lf-6.18.20_2.0.0 and lf-6.18.37_2.1.0.3.1.3, 3.2.1 and 3.2.3.Original model available at: SSDLite MobileNetV2 COCO (2018-05-09).
| Information | Value |
|---|---|
| Input shape | RGB image (1, 300, 300, 3), float32 |
| Input example | (Image source: Wikimedia Commons, Public domain) |
| Output shape | 2 tensors, both float32: (1, 1917, 1, 4) raw (not decoded) bounding box coordinates, and (1, 1917, 91) per-box class scores. See example.py to decode them. |
| Output example | |
| FLOPS | 1.5G |
| Number of parameters | 4.3M |
| File size (int8) | 5.3 MB (5,578,432 bytes) |
| Source framework | TensorFlow 1 |
All models run with the eIQ LiteRT (TensorFlow Lite) runtime and the corresponding NPU delegate (VX for i.MX 8M Plus, Ethos-U for i.MX 93, Neutron for i.MX 95 / i.MX 952). The same information is captured in release_manifest.json.
| Asset | Runtime | Precision | HW target | BSP & SDK versions | Link to asset |
|---|---|---|---|---|---|
| i.MX 8M Plus Quantized | LiteRT | INT8 | i.MX 8M Plus | - | Download |
| i.MX 93 Precompiled | LiteRT | INT8 | i.MX 93 | BSP lf-6.18.20_2.0.0, VELA_TAG = lf-6.18.20_2.0.0 | Download |
| i.MX 93 Precompiled | LiteRT | INT8 | i.MX 93 | BSP lf-6.18.37_2.1.0, VELA_TAG = lf-6.18.37_2.1.0 | Download |
| i.MX 95 Precompiled | LiteRT | INT8 | i.MX 95 | BSP lf-6.18.20_2.0.0, Neutron SDK v3.1.3 | Download |
| i.MX 95 Precompiled | LiteRT | INT8 | i.MX 95 | BSP lf-6.18.37_2.1.0, Neutron SDK v3.2.1 | Download |
| i.MX 95 Precompiled | LiteRT | INT8 | i.MX 95 | BSP lf-6.18.37_2.1.0, Neutron SDK v3.2.3 | Download |
| i.MX 952 Precompiled | LiteRT | INT8 | i.MX 952 | BSP lf-6.18.20_2.0.0, Neutron SDK v3.1.3 | Download |
| i.MX 952 Precompiled | LiteRT | INT8 | i.MX 952 | BSP lf-6.18.37_2.1.0, Neutron SDK v3.2.1 | Download |
| i.MX 952 Precompiled | LiteRT | INT8 | i.MX 952 | BSP lf-6.18.37_2.1.0, Neutron SDK v3.2.3 | Download |
The assets/imx8mplus/ssdlite_mobilenet_v2_quant.tflite file is a symlink to the hardware-independent
int8 model at assets/quantized_tflite_model/ssdlite_mobilenet_v2_quant.tflite (identical bytes, same
sha256); that same hardware-independent file is also used for host (x86) inference and as the input to
the i.MX 93 / i.MX 95 / i.MX 952 compilers.
This model inherits all limitations from the original SSDLite MobileNetV2 COCO model. Additional limitations:
The original SSDLite MobileNetV2 model was trained and evaluated by its authors on the COCO dataset [1], which features 80 object classes, according to the source of the model. NXP did not retrain this model; only quantization and compilation were performed (see Modifications). Instructions for re-training the original model can be found in the TensorFlow Detection Model Zoo.
evaluate.py evaluates the int8 quantized, hardware-independent model
(assets/quantized_tflite_model/ssdlite_mobilenet_v2_quant.tflite) on the COCO val2017 dataset, using
the LiteRT CPU runtime on a host PC. It downloads the COCO val2017 images and annotations, runs
inference and the same post-processing as example.py, and reports standard COCO detection metrics via
pycocotools.
python3 evaluate.py -m assets/quantized_tflite_model/ssdlite_mobilenet_v2_quant.tflite
The recipe installs the eIQ Neutron SDK from the NXP eIQ PyPI Distribution Portal. Configure pip once to use it:
python -m pip config --user set global.index https://eiq.nxp.com/repository
python -m pip config --user set global.index-url https://eiq.nxp.com/repository
python -m pip config --user set global.trusted-host eiq.nxp.com
python -m pip config --user set global.extra-index-url https://pypi.org/simple
python -m pip config --user set global.find-links https://eiq.nxp.com/repository/
To regenerate the quantized model and all precompiled assets, run:
bash recipe.sh
This downloads the original TF1 SavedModel and COCO val2017 calibration images, performs int8 post-training quantization, and compiles/converts the result for i.MX 93, i.MX 95 and i.MX 952. The generated files are:
assets/quantized_tflite_model/ssdlite_mobilenet_v2_quant.tflite - hardware-independent int8 model,
also used for i.MX 8M Plus (assets/imx8mplus/)assets/imx93/<VELA_TAG>/ssdlite_mobilenet_v2_quant_vela.tflite - Vela-compiled for i.MX 93assets/imx95/<NEUTRON_SDK_VERSION>/ssdlite_mobilenet_v2_quant_converted.tflite - Neutron-converted for i.MX 95assets/imx952/<NEUTRON_SDK_VERSION>/ssdlite_mobilenet_v2_quant_converted.tflite - Neutron-converted for i.MX 952An example of how to use the model is in example.py (run on a PC):
python3 example.py -m assets/quantized_tflite_model/ssdlite_mobilenet_v2_quant.tflite \
-i example_input.jpg -o example_output.jpg
Please refer to the i.MX Machine Learning User Guide for details on how to run the models on each i.MX platform.
Full on-device examples leveraging GStreamer/NNStreamer and this model can be found in nxp-nnstreamer-examples on GitHub.
This model is released under the Apache License 2.0, the same license as the original SSDLite MobileNetV2 COCO (2018-05-09) model.
If you use this model, please cite both this work and the original model:
@inproceedings{lin2014microsoft,
title={Microsoft coco: Common objects in context},
author={Lin, Tsung-Yi and Maire, Michael and Belongie, Serge and Hays, James and Perona, Pietro and Ramanan, Deva and Doll{\'a}r, Piotr and Zitnick, C Lawrence},
booktitle={European conference on computer vision},
pages={740--755},
year={2014},
organization={Springer}
}
@inproceedings{sandler2018mobilenetv2,
title={Mobilenetv2: Inverted residuals and linear bottlenecks},
author={Sandler, Mark and Howard, Andrew and Zhu, Menglong and Zhmoginov, Andrey and Chen, Liang-Chieh},
booktitle={2018 IEEE/CVF conference on computer vision and pattern recognition},
pages={4510--4520},
year={2018},
organization={Ieee}
}
@inproceedings{liu2016ssd,
title={Ssd: Single shot multibox detector},
author={Liu, Wei and Anguelov, Dragomir and Erhan, Dumitru and Szegedy, Christian and Reed, Scott and Fu, Cheng-Yang and Berg, Alexander C},
booktitle={European conference on computer vision},
pages={21--37},
year={2016},
organization={Springer}
}