File size: 1,700 Bytes
4249ce0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# TensorFlow Inception

Image classification with the Inception v1 (GoogLeNet) network trained on ImageNet.
The model was originally distributed as a frozen TensorFlow graph
(`tensorflow_inception_graph.pb`) and converted to ONNX for use with OpenCV's DNN module.

## Model Details
- **Architecture**: Inception v1 / GoogLeNet
- **Input**: RGB image, 224×224, raw 0–255 float, NHWC layout (`input:0`, shape `[1, 224, 224, 3]`)
- **Output**: ImageNet class scores, softmax over 1008 classes (`softmax2:0`)
- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
- **Original weights**: https://github.com/petewarden/tf_ios_makefile_example/raw/master/data/tensorflow_inception_graph.pb

## Usage

### Python
```bash
python demo.py --model tensorflow_inception_graph_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
```

Or import directly:
```python
import cv2

net = cv2.dnn.readNet("tensorflow_inception_graph_2026jul.onnx")
# see demo.py for the full inference pipeline
```

### C++
```bash
cmake -B build && cmake --build build
./build/demo --model tensorflow_inception_graph_2026jul.onnx --image example_outputs/input_image.png
```

## Conversion
The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
via [convert_to_onnx.py](./convert_to_onnx.py) — inputs `input:0`, outputs `softmax2:0`,
input shape overridden to `[1, 224, 224, 3]`. Requires `tensorflow`, `tf2onnx`, and `onnx`.

```bash
python convert_to_onnx.py --pb ../pb/tensorflow_inception_graph.pb
```

## License
See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.