Extracting Arm NN to Your Raspberry Pi and Running a Sample Program

Creating an archive of cross-compiled libraries, binaries, and directories

To create an archive of cross-compiled libraries, binaries, and directories:

  1. Copy the following libraries, binaries, and directories from your virtual machine. To copy these libraries, binaries, and directories enter the following commands:

    cd $BASEDIR 
    mkdir armnn-dist 
    mkdir armnn-dist/armnn 
    mkdir armnn-dist/armnn/lib 
    
    cp $BASEDIR/armnn/build/libarmnn.so $BASEDIR/armnn-dist/armnn/lib 
    cp $BASEDIR/armnn/build/libarmnnTfParser.so $BASEDIR/armnn-dist/armnn/lib 
    cp $BASEDIR/protobuf-arm/lib/libprotobuf.so.15.0.0 $BASEDIR/armnn-dist/armnn/lib/libprotobuf.so 
    cp $BASEDIR/protobuf-arm/lib/libprotobuf.so.15.0.0 $BASEDIR/armnn-dist/armnn/lib/libprotobuf.so.15 
    cp -r $BASEDIR/armnn/include $BASEDIR/armnn-dist/armnn/include 
    cp -r $BASEDIR/boost $BASEDIR/armnn-dist/boost
  2. Copy the Unit Tests and a sample Arm NN program. To copy this test and program, enter the following commands:

    cp $BASEDIR/armnn/build/UnitTests $BASEDIR/armnn-dist
    cp $BASEDIR/armnn/samples/SimpleSample.cpp $BASEDIR/armnn-dist
  3. Create the archive for your Raspberry Pi. To create the archive, enter the following command:

    tar -czf $BASEDIR/armnn-dist.tar.gz armnn-dist

Extract the libraries, binaries, and directories to your Raspberry Pi

Extract the libraries, binaries, and directories to your Raspberry Pi. To extract the libraries, binaries and directories enter the following commands:

cd /home/pi
tar -xzf /home/pi/armnn-dist.tar.gz

Compiling and running a sample Arm NN program on your Raspberry Pi

To compile and run a sample C++ program that uses Arm NN on your Raspberry Pi:

  1. Enter the following commands:

    export LD_LIBRARY_PATH=/home/pi/armnn-dist/armnn/lib
    cd /home/pi/armnn-dist

    To compile the program, enter the following commands:

    g++ SimpleSample.cpp -I/home/pi/armnn-dist/armnn/include -I/home/pi/armnn-dist/boost/include -L/home/pi/armnn-dist/armnn/lib -larmnn -larmnnTfParser -lprotobuf -o SimpleSample
  2. To run the program, enter the following command:

    ./SimpleSample

    The console returns the following:

    Please enter a number:

    Enter your number. For example:

    345

    The console returns the following:

    Your number was 345
Previous Next