Image Classification
vision
cnn
mobile
File size: 6,073 Bytes
7ebe868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbae403
7ebe868
 
 
dbae403
7ebe868
 
e900ff7
7ebe868
 
 
 
 
 
 
e900ff7
7ebe868
 
 
 
dbae403
7ebe868
 
 
dbae403
 
 
 
7ebe868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbae403
 
7ebe868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
license: bsd-3-clause
tags:
- vision
- image-classification
- cnn
- mobile
datasets:
- imagenet-1k
---

<div align="center">

# MobileNetV3 for TI EdgeAI

### Efficient Mobile CNN for Image Classification

[![License](https://img.shields.io/badge/License-BSD--3--Clause-blue?style=for-the-badge)](https://opensource.org/licenses/BSD-3-Clause)
[![Framework](https://img.shields.io/badge/Framework-ONNX-orange?style=for-the-badge)](https://onnx.ai/)
[![Task](https://img.shields.io/badge/Task-Classification-green?style=for-the-badge)](https://github.com/TexasInstruments/edgeai)
[![Dataset](https://img.shields.io/badge/Dataset-ImageNet--1K-blueviolet?style=for-the-badge)](http://www.image-net.org/)

</div>

---

## Overview

**MobileNetV3** ([Searching for MobileNetV3](https://arxiv.org/abs/1905.02244), Howard et al., 2019) combines hardware-aware Neural Architecture Search (NAS) with NetAdapt and a redesigned last stage to deliver state-of-the-art accuracy for mobile and edge inference. Key improvements over MobileNetV2 include hard-swish activations, squeeze-and-excitation modules in the bottleneck layers, and an optimized final classifier.

Both variants are evaluated at **224×224** input resolution on **ImageNet-1K** and distributed via [torchvision](https://pytorch.org/vision/stable/models/mobilenetv3.html).

---

## Model Variants

| Model | Architecture | Params | GFLOPs | Top-1 Acc | Top-5 Acc | Validated Devices | Config |
|-------|---------------|--------|--------|-----------|-----------|--------------------|--------|
| `mobilenetv3_large` | MobileNetV3-Large | 5.48M | 0.22 | **75.274%** | 92.566% | TDA4VH | [mobilenetv3_large_config.yaml](mobilenetv3_large_config.yaml) |
| `mobilenetv3_small` | MobileNetV3-Small | 2.54M | 0.06 | 67.668% | 87.402% | N/A | N/A |

`mobilenetv3_large` uses `IMAGENET1K_V2` weights (improved training recipe). `mobilenetv3_small` is excluded from `prepare_model.py`'s export catalog because it produces poor accuracy under TIDL compilation — the `mobilenetv3_small.onnx` bundled in this folder is provided for reference only and has no validated TIDL config.

**Recommended for edge deployment:** `mobilenetv3_large` (best accuracy/compute trade-off with a validated TIDL config)

---

## Quick Start

### Prerequisites

```bash
pip install torch torchvision onnx>=1.14.0 onnxruntime>=1.16.0
# Optional but recommended for model optimization:
pip install onnx-simplifier
```

### Export the Model

```bash
# Export the default model (MobileNetV3-Large)
python prepare_model.py

# Export a specific model variant
python prepare_model.py --model mobilenetv3_large

# Export with a custom input resolution
python prepare_model.py --model mobilenetv3_large --shape 224 224

# List all available variants
python prepare_model.py --list-models
```

The script automatically:
- Downloads pretrained ImageNet-1K weights from torchvision (`MobileNet_V3_Large_Weights.IMAGENET1K_V2`)
- Exports to ONNX (opset 17) with a static `[1, 3, 224, 224]` input shape
- Runs ONNX shape inference across all intermediate tensors
- Optionally simplifies the graph with onnxsim (use `--no-simplify` to skip)

> Note: `mobilenetv3_small` is currently excluded from the export catalog (poor accuracy under TIDL compilation), so `--model mobilenetv3_small` and `--model all` only produce `mobilenetv3_large`.

### Compile and Infer uing edgeai-tidlrunner

> **Note:** Run the commands below from inside the `tidlrunner` directory (the cloned [edgeai-tidlrunner](https://github.com/TexasInstruments/edgeai-tidlrunner) repository), with `--config_path` pointing to this model's config file.

**Compile using edgeai-tidlrunner - on PC**

```bash
cd /path/to/edgeai-tidlrunner
tidlrunner-cli compile --target_device J784S4 \
  --config_path /path/to/mobilenetv3_large_config.yaml
```

**Run Inference Benchmark - on device**

```bash
cd /path/to/edgeai-tidlrunner
tidlrunner-cli infer --target_device J784S4 \
  --config_path /path/to/mobilenetv3_large_config.yaml
```

### Compile and Infer using edgeai-tidl-tools (Advanced):

Follow the instructions at https://github.com/TexasInstruments/edgeai-tidl-tools

### Deploy using edgeai-tidl-tools:

Deplyment can be done using **[edgeai-tidl-tools](https://github.com/TexasInstruments/edgeai-tidl-tools)**. For ONNX models, onnxruntime-tidl with TIDL acceleration can be used. Consult the documentation of edgeai-tidl-tools for more details.

---

## Citation

If you use these models, please cite:

```bibtex
@inproceedings{Howard2019MobileNetV3,
  title     = {Searching for MobileNetV3},
  author    = {Howard, Andrew and Sandler, Mark and Chu, Grace and Chen, Liang-Chieh
               and Chen, Bo and Tan, Mingxing and Wang, Weijun and Zhu, Yukun
               and Pang, Ruoming and Vasudevan, Vijay and Le, Quoc V. and Adam, Hartwig},
  booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
  year      = {2019}
}
```

---

## 🔗 Resources

| Resource | Link |
|----------|------|
| **Paper** | [arXiv:1905.02244](https://arxiv.org/abs/1905.02244) |
| **PyTorch Docs** | [torchvision MobileNetV3](https://pytorch.org/vision/stable/models/mobilenetv3.html) |
| **Source Code** | [pytorch/vision](https://github.com/pytorch/vision/blob/main/torchvision/models/mobilenetv3.py) |
| **edgeai-tidl-tools** | [GitHub](https://github.com/TexasInstruments/edgeai-tidl-tools) |
| **edgeai-tidlrunner** | [GitHub](https://github.com/TexasInstruments/edgeai-tidlrunner) |
| **EdgeAI SDK** | [Documentation](https://github.com/TexasInstruments/edgeai/blob/main/edgeai-mpu/readme_sdk.md) |

---

## Related Models

<table>
<tr>
<td align="center">

**ResNet**
Deeper CNN
Higher accuracy

</td>
<td align="center">

**ConvNeXt**
Modern CNN
ViT-inspired design

</td>
<td align="center">

**ViT**
Vision Transformer
Attention-based

</td>
<td align="center">

**DINOv2**
Self-supervised
Rich feature embeddings

</td>
</tr>
</table>

---

<div align="center">

**Maintained by:** Texas Instruments EdgeAI Team  
**Last Updated:** August 2026

</div>