Run the classifier

The CNN has been trained to recognize 1000 object categories. A go-kart is one of these. This step demonstrates how the object is recognized when the CNN is passed an image of a go-kart. In contrast, if you defined a random image which is not part of the 1000 categories then the CNN will not be able to recognize it it.

If you compiled natively on your Raspberry Pi, enter the following on the command line to run the classifier against the go_kart.ppm image:

./build/examples/graph_alexnet --data=$PATH_ASSETS --image=$PATH_ASSETS/go_kart.ppm --labels=$PATH_ASSETS/labels.txt --target=neon –type=f32 –threads=4 

Or, if you cross-compiled, on your host machine open an SSH session by entering:

ssh <username_raspberrypi>@<ip_addr_raspberrypi>&gt;?</ip_addr_raspberrypi></username_raspberrypi>

And in the SSH session, enter the Desktop folder and run the classifier against the go-kart .ppm image:

cd Desktop
export LD_LIBRARY_PATH=build/
./build/examples/graph_alexnet 0 $PATH_ASSETS  $PATH_ASSETS/go_kart.ppm $PATH_ASSETS/labels.txt

Whether or not you are building the library natively, the output should look like this if a successful classification has been performed:

screen shot of the top 5 object category predictions

This screenshot shows that the classifier has provided five predictions of the content of the image against the object categories that the CNN has been trained with. If the output does not look like the screenshot, then it is highly likely that the assets have not been correctly copied to the SD card.

Previous Next