John Welsh 9c9b213b1f added argument checking to classify_image | vor 6 Jahren | |
---|---|---|
.. | ||
CMakeLists.txt | vor 6 Jahren | |
README.md | vor 6 Jahren | |
classify_image.cu | vor 6 Jahren | |
utils.h | vor 6 Jahren |
This example demonstrates how to classify a single image using one of the TensorFlow pretrained models converted to TensorRT.
If you haven't already, follow the installation instructions here.
Assuming you have a trained and frozen image classification model, convert it to a plan using the following convert_plan script.
python scripts/convert_plan.py data/frozen_graphs/inception_v1.pb data/plans/inception_v1.plan input 224 224 InceptionV1/Logits/SpatialSqueeze 1 1048576 float
For reference, the inputs to the convert_plan.py script are
Once the plan file is generated, run the example Cpp/CUDA program to classify the image.
./build/examples/classify_image/classify_image data/images/gordon_setter.jpg data/plans/inception_v1.plan data/imagenet_labels_1001.txt input InceptionV1/Logits/SpatialSqueeze inception
You should see that the most probable index is 215, which using our label file corresponds to a "Gordon setter". For reference, the inputs to the classify_image example are
To use other networks, supply the classify_image executable with arguments corresponding to the default networks table (link). You will need to generate the corresponding PLAN file as well.