ArmNN SDK ENV variable set:
...
cd $BASEDIR/ComputeLibrary/build/examples export LD_LIBRARY_PATH=$BASEDIR/ComputeLibrary/build:$LD_LIBRARY_PATH ./graph_mobilenet_v2
| |
grep "Caff"
| |
...
2.2.2 CaffeInception_BN-Armnn
- Use A linux host with py-caffe installed
Download the model files:
cd ~/ArmnnTests
curl -L -o deploy.prototxt https://raw.githubusercontent.com/pertusa/InceptionBN-21K-for-Caffe/master/deploy.prototxt
curl -L -o Inception21k.caffemodel http://www.dlsi.ua.es/~pertusa/deep/Inception21k.caffemodel
cp deploy.prototxt Inception-BN-batchsize1.prototxt
nano Inception-BN-batchsize1.prototxt
...
2.1.3 CaffeMnist-Armnn
Use A linux host with py-caffe installed
Download the model files:
cd ~/ArmnnTests
curl -L -o lenet.prototxt https://raw.githubusercontent.com/BVLC/caffe/master/examples/mnist/lenet.prototxt
curl -L -o lenet_iter_9000_ori.caffemodel https://github.com/ARM-software/ML-examples/blob/master/armnn-mnist/model/lenet_iter_9000.caffemodel
cp lenet.prototxt lenet_iter_9000.prototxt
nano lenet_iter_9000.prototxt
change the batch size to 1Original content:
name: "LeNet"
layer {
name: "data"
type: "Input"
top: "data"
input_param { shape: { dim: 64 dim: 1 dim: 28 dim: 28 } }
Modified content:
name: "LeNet"
layer {
name: "data"
type: "Input"
top: "data"
input_param { shape: { dim: 1 dim: 1 dim: 28 dim: 28 } }
Run the following python script to transform the network
python3
import caffe
net = caffe.Net(lenet.prototxt', lenet_iter_9000_ori.caffemodel', caffe.TEST)
new_net = caffe.Net(' lenet_iter_9000.prototxt', lenet_iter_9000_ori.caffemodel', caffe.TEST)
new_net.save(' lenet_iter_9000.caffemodel')
Copy lenet_iter_9000.caffemodel to ~/ArmnnTests/models in SP7021- Find a .jpg file containing a shark (great white shark). Rename it to shark.jpg and copy it to the data folder on SP7021.
- Download the two archives below and unpack them:
...
2.2.1 TfInceptionV3-Armnn
1. Download the model files. Unzip and move file to action folder :
cd ~/ArmnnTests
curl -L -o inception_v3_2016_08_28_frozen.pb.tar.gz https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz
tar zxvf inception_v3_2016_08_28_frozen.pb.tar.gz
mv inception_v3_2016_08_28_frozen.pb ./models/
2. Find a .jpg file containing a shark (great white shark). Rename it to shark.jpg and copy it to the data folder on the SP7021.
...
TfInceptionV3-Armnn --data-dir=data --model-dir=models
This is not an execution error. This occurs because the TfInceptionV3-Armnn test expects a specific type of dog, cat and shark to be found so if a different type/breed of these animals is passed to the test, it returns a case failed.
The expected inputs for this test are:
ID | Label | File name |
208 | Golden Retriever | Dog.jpg |
283 | Tiger Cat | Cat.jpg |
3 | White Shark | shark.jpg |
The complete list of supported objects can be found in https://github.com/ARM-software/armnn/blob/branches/armnn_18_11/tests/TfLiteMobilenetQuantized-Armnn/labels.txt
...
Arm NN SDK provides the following test for TensorFlow Lite models:
pi@raspberrypi:~/ArmnnTests$ ls -l ~/armnn-pi/armnn/build/tests/ | grep "TfL"
-rwxr-xr-x 1 pi pi 919808 Sep 2 05:08 TfLiteInceptionV3Quantized-Armnn
-rwxr-xr-x 1 pi pi 919808 Sep 2 05:28 TfLiteInceptionV4Quantized-Armnn
-rwxr-xr-x 1 pi pi 919656 Sep 2 05:42 TfLiteMnasNet-Armnn
-rwxr-xr-x 1 pi pi 921120 Sep 2 05:29 TfLiteMobilenetQuantized-Armnn
-rwxr-xr-x 1 pi pi 919812 Sep 2 05:14 TfLiteMobileNetQuantizedSoftmax-Armnn
-rwxr-xr-x 1 pi pi 915588 Sep 2 05:20 TfLiteMobileNetSsd-Armnn
-rwxr-xr-x 1 pi pi 919808 Sep 2 05:15 TfLiteMobilenetV2Quantized-Armnn
-rwxr-xr-x 1 pi pi 919808 Sep 2 05:02 TfLiteResNetV2-50-Quantized-Armnn
-rwxr-xr-x 1 pi pi 919656 Sep 2 05:06 TfLiteResNetV2-Armnn
-rwxr-xr-x 1 pi pi 919800 Sep 2 05:42 TfLiteVGG16Quantized-Armnn
-rwxr-xr-x 1 pi pi 666068 Sep 2 05:23 TfLiteYoloV3Big-Armnn
2.3.1 TfLiteInceptionV3Quantized-Armn
...
The Arm NN provides the following set of tests for ONNX models:
pi@raspberrypi:~/ArmnnTests$ ls -l ~/armnn-pi/armnn/build/tests/ | grep "Onn"
-rwxr-xr-x 1 pi pi 729136 Sep 2 05:08 OnnxMnist-Armnn
-rwxr-xr-x 1 pi pi 915132 Sep 2 05:01 OnnxMobileNet-Armnn
2.4.1 OnnxMnist-Armnn
1. Download and unpack the model file:
cd ~/ArmnnTests
curl -L -o mnist.tar.gz https://onnxzoo.blob.core.windows.net/models/opset_8/mnist/mnist.tar.gz
tar zxvf mnist.tar.gz
2. Rename the model.onnx file to mnist_onnx.onnx and copy it to the models folder on the SP7021
mv ./mnist/model.onnx ./mnist/mnist_onnx.onnx
cp ./mnist/mnist_onnx.onnx ./models/
3. Download the two archives below and unpack them:
curl -L -o t10k-images-idx3-ubyte.gz http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz
curl -L -o t10k-labels-idx1-ubyte.gz http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz
gzip -d t10k-images-idx3-ubyte.gz
gzip -d t10k-labels-idx1-ubyte.gz
4. Rename two files to be t10k-images.idx3-ubyte and t10k-labels.idx1-ubyte and copy files to the data folder on the SP7021.
mv t10k-images-idx3-ubyte t10k-images.idx3-ubyte
mv t10k-labels-idx1-ubyte t10k-labels.idx1-ubyte
cp t10k-images-idx3-ubyte ./data/
cp t10k-labels-idx1-ubyte ./data/
5. Run the test:
OnnxMnist-Armnn --data-dir=data --model-dir=models
2.4.2 OnnxMobileNet-Armnn
- Download and unpack the model file:
cd ~/ArmnnTests
curl -L -o mobilenetv2-1.0.tar.gz https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/mobilenetv2-1.0.tar.gz
tar zxvf mobilenetv2-1.0.tar.gz
2. Copy the unpacked mobilenetv2-1.0.onnx file to the models folder on the SP7021
cp ./mobilenetv2-1.0/mobilenetv2-1.0.onnx ./models/
3. Find a .jpg file containing a shark (great white shark). Rename it to shark.jpg and copy it to the data folder on the SP7021.
4. Find a .jpg file containing a dog (labrador retriever). Rename it to Dog.jpg and copy it to the data folder on the SP7021.
5. Find a .jpg file containing a cat (tiger cat). Rename it to Cat.jpg and copy it to the data folder on the SP7021.
6. Run the test:
OnnxMobileNet-Armnn --data-dir=data --model-dir=models
3. Python interface to Arm NN (PyArmNN)
cd ~/armnn-pi/armnn/python/pyarmnn/examples/
python3 tflite_mobilenetv1_quantized.py
python3 onnx_mobilenetv2.py
Anchor | ||||
---|---|---|---|---|
|