From f453b03f392ea77d091018a303a0c661770e4753 Mon Sep 17 00:00:00 2001 From: Davis King Date: Wed, 22 Jun 2016 22:26:48 -0400 Subject: [PATCH] Added an example showing how to classify imagenet images. --- examples/CMakeLists.txt | 1 + examples/dnn_imagenet_ex.cpp | 141 +++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 examples/dnn_imagenet_ex.cpp diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 153fe6b0e..7500b5dc6 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -34,6 +34,7 @@ if (COMPILER_CAN_DO_CPP_11) add_example(dnn_mnist_ex) add_example(dnn_mnist_advanced_ex) add_example(dnn_inception_ex) + add_example(dnn_imagenet_ex) endif() #here we apply our macros diff --git a/examples/dnn_imagenet_ex.cpp b/examples/dnn_imagenet_ex.cpp new file mode 100644 index 000000000..2c8d98bb6 --- /dev/null +++ b/examples/dnn_imagenet_ex.cpp @@ -0,0 +1,141 @@ +// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt +/* + This example shows how to classify an image into one of the 1000 imagenet clategories + using the deep learning tools from the dlib C++ Library. We will use the pretrained + ResNet34 model available on the dlib website. + + + These tools will use CUDA and cuDNN to drastically accelerate network + training and testing. CMake should automatically find them if they are + installed and configure things appropriately. If not, the program will + still run but will be much slower to execute. +*/ + + + +#include +#include +#include +#include +#include + +using namespace std; +using namespace dlib; + +// ---------------------------------------------------------------------------------------- + + +template