Giter VIP home page Giter VIP logo

alexnetrt's Introduction

AlexNetRT, a simple TensorRT tutorial

AlexNetRT is a simple deployment of AlexNet using TensorRT.

Alexnet's authors are Alex Krizhevsky, Ilya Sutskever and Geoffrey Hinton.

The purpose of this code is to deploy an already trained (using Caffe with Nvidia Digits) network using TensorRT.

AlexNet

The architecture of Alexnet can be seen in the deploy.prototxt in this file, it's also available on Netscope here but you can also get a glimpse in this image:

alexnet

Building

In order to build this project make sure you have the following requirements:

  • CUDA > 8 (I used 9.0)
  • CMake > 3.8 (I used 3.12) - This make it easier to find the Cuda dependencies.
  • TensorRT >3 (I used 4.0)
  • The original .caffemodel that you can get from here or just run:
wget -P data/alexnet/ http://dl.caffe.berkeleyvision.org/bvlc_alexnet.caffemodel

from the root of this project.

  • Imagemagick to convert input images to the required format .ppm

To build the code do the following:

git clone https://github.com/bpinaya/AlexNetRT.git alexnetrt && cd alexnetrt
mkdir build && cd build
cmake ..
make

Running

The code itself is documented so you can navigate it and see what each part does, I tried to be as explanatory as possible but also avoided unnecessary details. You can run it by just calling:

./alexnetrt

from the build directory but that will launch with the default image (a dog) and run the inference as you can see in this gif:

alexnet_basic

You can pass it with any image you want as long as it complies with the input format (a 227x227 .ppm image), if you want to prepare you image use the prepare_image.sh script from the data/alexnet/ folder as:

bash prepare_image.sh image_to_prepare.format

Check the cpp file or run ./alexnetrt --help to check the options, to use a different image as input just run:

./alexnetrt --input ../data/alexnet/cat.ppm

and you'll see something like this: alexnet_cat

Hotdog not hotdog mode

Finally, making reference to Silicon Valley's TV show you can run it with hotdog mode like this:

./alexnetrt --input ../data/alexnet/hotdog.ppm --hotdog

alexnet_hotdog

TODOs

  • Check on FP16 and FP8 precision.
  • Run clang-tidy and check for errors.

If you have any question or suggestion for improvement let me know creating an issue, PRs are also welcomed.

alexnetrt's People

Contributors

bpinaya avatar

Watchers

James Cloos 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.