Instructions to use nxp/inceptionv4-imx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use nxp/inceptionv4-imx with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Inception v4
Overview
Inception v4 is a member of the Inception family of image classification models. Compared to previous versions, it has a more uniform, simplified architecture and uses more Inception modules. Given an RGB image, the model classifies it into one of the 1000 ImageNet classes, returning a vector of 1001 output probabilities (index 0 is an unused background class).
This repository contains the Inception v4 model, quantized to int8 and compiled for NXP i.MX 8M Plus, i.MX 93,
i.MX 95, and i.MX 952 processors, together with the recipe used to regenerate the assets (recipe.sh) and an
inference example (example.py).
Key Features
- Uniform, simplified Inception architecture with additional Inception modules.
- 1000-class ImageNet image classification (the model exposes 1001 output logits; index 0 is an unused background class).
- ~43M parameters, ~24.6 G OPS.
- Fully quantized int8 model with uint8 input (values 0-255) and uint8 (quantized) output, for accelerated NPU inference on NXP i.MX platforms.
Model Description
This is a quantized and compiled version of Inception v4, optimized for NXP i.MX 8M Plus, i.MX 93, i.MX 95, and i.MX 952 processors.
- Base Model: TensorFlow models - Inception v4 (TF-Slim)
- Original Model Authors: Christian Szegedy et al. (Google / The TensorFlow Authors)
- Original License: Apache-2.0
- Modified by: NXP
Modifications
This model is a derivative work with the following changes from the original:
- Quantization: The int8 TFLite model (uint8 input, uint8 output) is downloaded directly from the pre-quantized Kaggle checkpoint published by the TensorFlow authors; no local re-quantization is performed.
- Compilation (i.MX 93): compiled for the Ethos-U65 NPU using Vela,
tags
lf-6.18.20_2.0.0andlf-6.18.37_2.1.0. - Compilation (i.MX 95 / i.MX 952): converted for the eIQ Neutron NPU using eIQ Neutron SDK versions
3.1.3,3.2.1, and3.2.3.
Original model available at: https://github.com/tensorflow/models/tree/master/research/slim.
Model Information
| Information | Value |
|---|---|
| Input shape | Color image (1, 299, 299, 3), uint8 |
| Input example | (Public domain picture) |
| Output shape | Vector of probabilities (1, 1001), uint8 quantized; dequantize with the tensor's scale / zero point |
| Output example | [[0, ..., 0, 252, 1, ..., 0]] -> Top class: boxer |
| FLOPS | 24.6 G OPS |
| Number of parameters | 43 M |
| File size (int8) | 40.9 MB (assets/quantized_tflite_model/inceptionv4_quant_int8.tflite) |
| Source framework | TensorFlow |
Output labels: 1000 ImageNet classes (offset by 1 for the unused background class); see labels.py.
Supported Hardware and Software Configurations
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 i.MX 8M Plus asset (assets/imx8mplus/inceptionv4_quant_int8.tflite) is identical to the
hardware-independent int8 model, also provided for host (x86) inference at
assets/quantized_tflite_model/inceptionv4_quant_int8.tflite.
Limitations and Biases
This model inherits all limitations from the original Inception v4 model. Additional limitations:
- Task scope: 1000-class ImageNet classification only; the model does not localize objects or detect multiple objects in a single image.
- Dataset bias: The model is trained on ImageNet. Classification quality may vary for object categories, contexts, or demographic groups that are under-represented in that dataset.
Training
The original Inception v4 model was trained by its authors on the ImageNet dataset. No additional retraining was performed by NXP; the int8 quantized checkpoint used in this repository is downloaded as-is from the pre-quantized version published by the TensorFlow authors on Kaggle.
Download and Run
Running the example
An example of how to run inference on a host PC is in example.py. Install the dependencies from
requirements.txt first.
# Run on PC:
python example.py -m assets/quantized_tflite_model/inceptionv4_quant_int8.tflite -i example_input.jpg
example.py accepts the following arguments:
-m,--model(default:assets/quantized_tflite_model/inceptionv4_quant_int8.tflite): path to the TFLite model file.-i,--input(default:example_input.jpg): path to the input image.-o,--output(default: none): optional path to write the top predictions as text.
To run the models on an i.MX MPU target with the NPU delegates, see the i.MX Machine Learning User Guide.
Regenerating the assets with recipe.sh
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 download the pre-quantized int8 model and compile it for all supported platforms, run:
bash recipe.sh
The script takes two optional positional arguments:
bash recipe.sh [IMX_ETHOS_U_VELA_TAG] [EIQ_NEUTRON_SDK_VERSION]
defaulting to lf-6.18.20_2.0.0 and 3.2.3 respectively. For example:
bash recipe.sh lf-6.18.37_2.1.0 3.2.3
recipe.sh downloads the pre-quantized int8 model from Kaggle, then generates:
assets/quantized_tflite_model/inceptionv4_quant_int8.tflite- hardware-independent int8 model (also used for i.MX 8M Plus, atassets/imx8mplus/inceptionv4_quant_int8.tflite).assets/imx93/<IMX_ETHOS_U_VELA_TAG>/inceptionv4_quant_int8_vela.tflite- Vela-compiled for i.MX 93.assets/imx95/<EIQ_NEUTRON_SDK_VERSION>/inceptionv4_quant_int8_converted.tflite- Neutron-converted for i.MX 95.assets/imx952/<EIQ_NEUTRON_SDK_VERSION>/inceptionv4_quant_int8_converted.tflite- Neutron-converted for i.MX 952.
License
This model is released under the Apache License 2.0 (see LICENSE), the same license as the original TensorFlow models - Inception v4 model.
Citation
If you use this model, please cite both this work and the original model:
- C. Szegedy, S. Ioffe, V. Vanhoucke and A. Alemi, "Inception-v4, Inception-ResNet and the Impact of Residual
Connections on Learning," Proceedings of the AAAI Conference on Artificial Intelligence, vol. 31, no. 1,
- arXiv:1602.07261.
- J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li and L. Fei-Fei, "ImageNet: A large-scale hierarchical image database," 2009 IEEE Conference on Computer Vision and Pattern Recognition, IEEE, 2009.
@inproceedings{szegedy2017inception,
title={Inception-v4, inception-resnet and the impact of residual connections on learning},
author={Szegedy, Christian and Ioffe, Sergey and Vanhoucke, Vincent and Alemi, Alexander},
booktitle={Proceedings of the AAAI conference on artificial intelligence},
volume={31},
number={1},
year={2017}
}
@inproceedings{deng2009imagenet,
title={Imagenet: A large-scale hierarchical image database},
author={Deng, Jia and Dong, Wei and Socher, Richard and Li, Li-Jia and Li, Kai and Fei-Fei, Li},
booktitle={2009 IEEE conference on computer vision and pattern recognition},
pages={248--255},
year={2009},
organization={Ieee}
}
- Downloads last month
- 55
(