Skip to content
Rethinking the Inception Architecture for Computer Vision
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Torch port of Inception V3

Scripts to dump TensorFlow Inception V3 weights and to reconstruct the network in Torch.

The approach is inspired by soumith/inception.torch.


  • a Python/TensorFlow script to dump all the weights of Inception V3
  • inceptionv3.lua: reads the weights and builds the Torch binary equivalent network
  • example.lua: example use of the Torch network


Step 1: TensorFlow

Here are instructions using Docker:

# From the host
docker run -it \
-p 8888:8888 \
-v /home/myuser/code/inception-v3.torch/ \
-v /home/myuser/data/dump:/root/dump \

# From the container
apt-get update
apt-get install -y libhdf5-dev
pip install h5py

If you have already installed TensorFlow, just run and the script will generate a directory dump with all the filters.

Step 2: Torch

Install pre-requisite:

luarocks install hdf5

Given that the filters are dumped in /home/myuser/data/dump, execute:

luajit inceptionv3.lua -i /home/myuser/data/dump \
-o /home/myuser/networks/
-b cudnn

The parameter -b sets the backend to use: nn, cunn, or cudnn. The produced binary Torch model will be saved in /home/myuser/networks/

Test it with an image as follows:

luajit example.lua -m /home/myuser/networks/ \
-b cudnn \
-i myimage.jpg \
-s synsets.txt

With TensorFlow example image you should obtain a result like this:

RESULTS (top-5):
score = 0.847576: n02510455 giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca (170)
score = 0.020494: n02500267 indri, indris, Indri indri, Indri brevicaudatus (76)
score = 0.003694: n02509815 lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens (8)
score = 0.001323: n13044778 earthstar (879)
score = 0.001301: n07760859 custard apple (326)
You can’t perform that action at this time.