/Jetson_Nano_Sample_CPP

Writing Your Own Object Recognition Code C++ on Jetson Nano

Primary LanguageC++

Writing Your Own Object Recognition Code C++ on Jetson Nano with NVIDIA TensorRT

Credit

Writing Your Own Object Recognition Code

Writing your own object recognition code isn’t actually that hard, and even in C++ can be done in a fairly compact manner if you’re not trying to do any complicated stuff around the task of classification.

The first thing you need to make sure is that cmake and git is installed.

$ sudo apt-get install cmake
$ sudo apt-get install git
$ git clone https://github.com/dusty-nv/jetson-inference
$ cd jetson-inference
$ git submodule update --init
$ mkdir build
$ cd build
$ cmake ../
$ make
$ sudo make install

You can grab the C++ code and the associated build file from the command line using wget, and then build it as follows.

$ cd ~
$ mkdir object_recognition
$ cd object_recognition
$ wget https://gist.githubusercontent.com/aallan/4de3a74676d4ff10a476c2d6c20b9255/raw/818eb292805520a9fc01aaaee2f7a5692cdf1f92/object_recognition.cpp
$ wget https://gist.githubusercontent.com/aallan/9945105f8ae2aed47d96e23adb8dddc1/raw/fef4e1249de9f4be6763e40cfcd8e1a7b92a40d4/CMakeLists.txt
$ cmake .
$ make
$ ./object_recognition polar.jpeg imageNet -- loaded 1000 class info entries
networks/bvlc_googlenet.caffemodel initialized.
class 0279 - 0.018535 (Arctic fox, white fox, Alopex lagopus)
class 0294 - 0.015127 (brown bear, bruin, Ursus arctos)
class 0296 - 0.746165 (ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus)
class 0342 - 0.017142 (wild boar, boar, Sus scrofa)
class 0360 - 0.085703 (otter)
image is recognized as 'ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus' (class #296) with 74.616531% confidence