Skip to main content

MobileNetV2

MobileNet is a lightweight deep neural network family designed by Google for mobile and embedded devices. By innovating convolution computation, it greatly reduces parameter count and computational complexity, enabling high-performance vision algorithms to run in real time on compute-constrained devices such as smartphones and IoT terminals.

  • Key features: Supports efficient image classification, object detection, and semantic segmentation, delivering high-quality visual perception with very low latency. It is a core engine for mobile deep learning applications.
  • Version notes: This example uses MobileNetV2. As an advanced version in the series, it adopts the “inverted residual and linear bottleneck” architecture, improving memory efficiency and enhancing complex feature extraction. It is an industry benchmark that balances fast inference and strong accuracy for edge AI applications.
Environment setup

You need to set up the environment in advance.

Quick start

Download model files

O6 / O6N
cd ai_model_hub_25_Q3/models/ComputeVision/Image_Classification/onnx_mobilenet_v2
wget https://www.modelscope.cn/models/cix/ai_model_hub_25_Q3/resolve/master/models/ComputeVision/Image_Classification/onnx_mobilenet_v2/mobilenet_v2.cix

Test the model

info

Activate the virtual environment before running.

O6 / O6N
python3 inference_npu.py

Full conversion workflow

Download model files

Linux PC
cd ai_model_hub_25_Q3/models/ComputeVision/Image_Classification/onnx_mobilenet_v2/model
wget https://www.modelscope.cn/models/cix/ai_model_hub_25_Q3/resolve/master/models/ComputeVision/Image_Classification/onnx_mobilenet_v2/model/mobilenet_v2.onnx
wget https://www.modelscope.cn/models/cix/ai_model_hub_25_Q3/resolve/master/models/ComputeVision/Image_Classification/onnx_mobilenet_v2/model/mobilenetv2-7.onnx

Project structure

├── cfg
├── datasets
├── inference_npu.py
├── inference_onnx.py
├── mobilenet_v2.cix
├── model
├── ReadMe.md
└── test_data

Quantize and convert the model

Linux PC
cd ..
cixbuild cfg/onnx_mobilenet_v2build.cfg
Copy to device

After conversion, copy the .cix model files to the device.

Test inference on the host

Run the inference script

Linux PC
python3 inference_onnx.py --images test_data --onnx_path model/mobilenetv2-7.onnx

Inference output

Linux PC
$ python3 inference_onnx.py --images test_data --onnx_path model/mobilenetv2-7.onnx
image path : test_data/ILSVRC2012_val_00024154.JPEG
Ibizan hound, Ibizan Podenco
image path : test_data/ILSVRC2012_val_00021564.JPEG
coucal
image path : test_data/ILSVRC2012_val_00002899.JPEG
rock python, rock snake, Python sebae
image path : test_data/ILSVRC2012_val_00045790.JPEG
Yorkshire terrier
image path : test_data/ILSVRC2012_val_00037133.JPEG
ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus

Deploy on NPU

Run the inference script

O6 / O6N
python3 inference_npu.py --images test_data --model_path mobilenet_v2.cix

Inference output

O6 / O6N
$ python3 inference_npu.py --images test_data --model_path mobilenet_v2.cix
npu: noe_init_context success
npu: noe_load_graph success
Input tensor count is 1.
Output tensor count is 1.
npu: noe_create_job success
image path : ./test_data/ILSVRC2012_val_00037133.JPEG
ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus
image path : ./test_data/ILSVRC2012_val_00021564.JPEG
coucal
image path : ./test_data/ILSVRC2012_val_00024154.JPEG
Ibizan hound, Ibizan Podenco
image path : ./test_data/ILSVRC2012_val_00002899.JPEG
boa constrictor, Constrictor constrictor
image path : ./test_data/ILSVRC2012_val_00045790.JPEG
Yorkshire terrier
npu: noe_clean_job success
npu: noe_unload_graph success
npu: noe_deinit_context success

    You need to be logged into GitHub to post a comment. If you are already logged in, please ignore this message.

    Radxa-docs © 2026 by Radxa Computer (Shenzhen) Co.,Ltd. is licensed under CC BY 4.0