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
python demo.py --model tensorflow_inception_graph_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
Or import directly:
import cv2
net = cv2.dnn.readNet("tensorflow_inception_graph_2026jul.onnx")
# see demo.py for the full inference pipeline
C++
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 — inputs input:0, outputs softmax2:0,
input shape overridden to [1, 224, 224, 3]. Requires tensorflow, tf2onnx, and onnx.
python convert_to_onnx.py --pb ../pb/tensorflow_inception_graph.pb
License
See LICENSE — the model is released by the TensorFlow Authors under the Apache License 2.0.