ComputeLibrary

Jump to: navigation, search

Installation

You can install ComputeLibrary from:

Tests

neon_cartoon_effect

You need an input image at PPM format. You have some in /usr/share/ComputeLibrary/sample-data/images/, from ComputeLibrary-sample-data package.

Run the following command:

 neon_cartoon_effect myimage.ppm

And you will get myimage.ppm_out.ppm as a result (in the same folder as myimage.ppm)

More information on how it works can be found here https://community.arm.com/developer/tools-software/graphics/b/blog/posts/cartoonifying-images-on-raspberry-pi-with-the-compute-library

neon_convolution

You need an input image at PPM format. You have some in /usr/share/ComputeLibrary/sample-data/images/, from ComputeLibrary-sample-data package.

Run the following command:

 neon_convolution myimage.ppm

And you will get myimage.ppm_out.ppm as a result (in the same folder as myimage.ppm)

neon_scale

You need an input image at PPM format. You have some in /usr/share/ComputeLibrary/sample-data/images/, from ComputeLibrary-sample-data package.

Run the following command to resize (half sizes):

 neon_scale myimage.ppm

And you will get myimage.ppm_out.ppm as a result (in the same folder as myimage.ppm)


graph_alexnet

This test is based on this article: https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/running-alexnet-on-raspberry-pi-with-compute-library

Once ComputeLibrary is installed, please download compute_library_alexnet.zip and extract it to assets_alexnet/ folder.

Run the following command:

 export PATH_ASSETS=./assets_alexnet
 graph_alexnet --data=$PATH_ASSETS --image=$PATH_ASSETS/go_kart.ppm --labels=$PATH_ASSETS/labels.txt

and you will get:

 graph_alexnet
 
 Threads : 1
 Target : NEON
 Data type : F32
 Data layout : NHWC
 Tuner enabled? : false
 Tuner file : 
 Fast math enabled? : false
 Data path : ./assets_alexnet
 Image file : ./assets_alexnet/go_kart.ppm
 Labels file : ./assets_alexnet/labels.txt
 
 Can't load libOpenCL.so: libOpenCL.so: cannot open shared object file: No such file or directory
 Can't load libGLES_mali.so: libGLES_mali.so: cannot open shared object file: No such file or directory
 Can't load libmali.so: libmali.so: cannot open shared object file: No such file or directory
 Couldn't find any OpenCL library.
 ---------- Top 5 predictions ----------
 
 0.9736 - [id = 573], n03444034 go-kart
 0.0118 - [id = 518], n03127747 crash helmet
 0.0108 - [id = 751], n04037443 racer, race car, racing car
 0.0022 - [id = 817], n04285008 sports car, sport car
 0.0006 - [id = 670], n03791053 motor scooter, scooter
 
 Test passed

You can also try other images from the list: go_kart.ppm, gold_fish.ppm, gondola.ppm, school_bus.ppm

If you want to use your own image, you must convert it to a 227x227 PPM image. For this operation, you can use ImageMagick:

 convert square_image.jpg -resize 227x227 myimage.ppm
If you have libOpenCL.so, libGLES_mali.so or libmali.so, the graph API will use OpenCL backend, otherwise it will fall back to NEON backend.