Table Of Contents
This sample, sampleGoogleNet, demonstrates how to import a model trained with Caffe into TensorRT using GoogleNet as an example. Specifically, this sample builds a TensorRT engine from the saved Caffe model, sets input values to the engine, and runs it.
This sample constructs a network based on a saved Caffe model and network description. This sample comes with a pre-trained model called googlenet.caffemodel
located in the data/googlenet
directory. The model used by this sample was trained using ImageNet. For more information, see the BAIR/BVLC GitHub page. The sample reads two Caffe files to build the network:
googlenet.prototxt
- The prototxt file that contains the network design. googlenet.caffemodel
- The model file which contains the trained weights for the network.For more information, see Importing A Caffe Model Using The C++ Parser API.
The sample then builds the TensorRT engine using the constructed network. See Building an Engine in C++ for more information on this. Finally, the sample runs the engine with the test input (all zeroes) and reports if the sample ran as expected.
In this sample, the following layers are used. For more information about these layers, see the TensorRT Developer Guide: Layers documentation.
Activation layer The Activation layer implements element-wise activation functions. Specifically, this sample uses the Activation layer with the type kRELU
.
Concatenation layer The Concatenation layer links together multiple tensors of the same non-channel sizes along the channel dimension.
Convolution layer The Convolution layer computes a 2D (channel, height, and width) convolution, with or without bias.
FullyConnected layer The FullyConnected layer implements a matrix-vector product, with or without bias.
LRN layer The LRN layer implements cross-channel Local Response Normalization.
Pooling layer The Pooling layer implements pooling within a channel. Supported pooling types are maximum
, average
and maximum-average blend
.
SoftMax layer The SoftMax layer applies the SoftMax function on the input tensor along an input dimension specified by the user.
make
in the <TensorRT root directory>/samples/sampleGoogleNet
directory. The binary named sample_googlenet
will be created in the <TensorRT root directory>/bin
directory. ``` cd <TensorRT root directory>/samples/sampleGoogleNet make `` Where
<TensorRT root directory>` is where you installed TensorRT../sample_googlenet --datadir=<path_to_data_directory> --useDLACore=N
Where <path_to_data_directory>
is the path to your data
directory. Note: By default, this sample assumes both googlenet.prototxt
and googlenet.caffemodel
files are located in either the data/samples/googlenet/
or data/googlenet/
directories. The default directory can be changed by supplying the --datadir=<new_path/>
path as a command line argument. This output shows that the input to the sample is called
data, the output tensor is called
proband the sample ran successfully;
PASSED`.--help
optionsTo see the full list of available options and their descriptions, use the -h
or --help
command line option.
The following resources provide a deeper understanding about GoogleNet:
GoogleNet
Documentation
For terms and conditions for use, reproduction, and distribution, see the TensorRT Software License Agreement documentation.
February 2019 This README.md
file was recreated, updated and reviewed.
There are no known issues in this sample.