Coder Social home page Coder Social logo

techbhatia / inception-v3.torch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moodstocks/inception-v3.torch

0.0 2.0 0.0 47 KB

Rethinking the Inception Architecture for Computer Vision

Home Page: http://arxiv.org/abs/1512.00567

License: Other

Python 50.01% Lua 49.99%

inception-v3.torch's Introduction

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.

Overview

  • dump_filters.py: 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

Usage

Step 1: TensorFlow

Here are instructions using Docker:

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

# From the container
apt-get update
apt-get install -y libhdf5-dev
pip install h5py
python dump_filters.py

If you have already installed TensorFlow, just run dump_filters.py 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/inceptionv3.net
-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/inceptionv3.net.

Test it with an image as follows:

luajit example.lua -m /home/myuser/networks/inceptionv3.net \
-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)

inception-v3.torch's People

Contributors

mdelakis avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.