Work side by side with : https://developer.arm.com/solutions/machine-learning-on-arm/developer-material/how-to-guides/image-recognition-on-arm-cortex-m-with-cmsis-nn/before-you-begin
# home...
cd
# Get the compilation toolchain archive
wget https://developer.arm.com/-/media/Arm%20Developer%20Community/Images/Tutorial%20Guide%20Diagrams%20and%20Screenshots/Machine%20Learning/Image%20recognition%20on%20Arm%20Cortex-M%20with%20CMSIS-NN/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2?revision=09f5c905-fb63-4870-85fb-b5b911c0304c&la=en&hash=97C8EB7737FA9221B4A166CD9B040E6FEB624BDA
# Extract archive
tar -jf gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
# Update environnement variables
export PATH=$PATH:"~/gcc-arm-none-eabi-7-2017-q4-major/bin"
echo 'export PATH=$PATH:~/gcc-arm-none-eabi-7-2017-q4-major/bin' >> ~/.bashrc
Once Arm Mbed CLI is installed in the arm tutorial :
mbed config -G GCC_ARM_PATH "~/gcc-arm-none-eabi-7-2017-q4-major/bin"
Follow below instructions or check offical source :
# home...
cd
# clone caffee repository
git clone https://github.com/BVLC/caffe.git
# Update environnement variables
export CAFFE_ROOT="~/caffe"
echo 'export CAFFE_ROOT=~/caffe' >> ~/.bashrc
export PYTHONPATH="${PYTHONPATH}:~/caffe/python"
echo 'export PYTHONPATH="${PYTHONPATH}:~/caffe/python"' >> ~/.bashrc
# Setup compilation and compile
mkdir build
cd build
cmake .. # or cmake .. -DCPU_ONLY=ON if no GPU. You can also use cmake-gui .. and generate once to see options
make all
make install
make runtest
source : https://caffe.berkeleyvision.org/gathered/examples/cifar10.html
cd $CAFFE_ROOT
./data/cifar10/get_cifar10.sh
./examples/cifar10/create_cifar10.sh
If you work in CPU_Only, change GPU by CPU in every prototxt files in the folder CAFFE_ROOT/examples/cifar10
Then launch the training (roughly an hour in CPU mode) :
cd $CAFFE_ROOT
./examples/cifar10/train_quick.sh
Just follow the tutorial...
Don't forget to change paths to your "caffe/examples/cifar10" files in ~/CMSISNN_Webinar/ML-examples/cmsisnn-cifar10/models/cifar10_m7_train_test.prototxt
Warning A step is missing in the tutorial : Converting the caffemodel file in h5 file. For this you can use caffemodel_convertor.py
Just follow the tutorial...
Just follow the tutorial...
cd ~/CMSISNN_Webinar/cmsisnn_demo/
mbed compile -m DISCO_F746NG -t GCC_ARM --source . --source ../ML-examples/cmsisnn-cifar10/code/m7 --source ../ML-examples/cmsisnn-cifar10/camera_demo/camera_with_nn/ --source ../CMSIS_5/CMSIS/NN/Include --source ../CMSIS_5/CMSIS/NN/Source --source ../CMSIS_5/CMSIS/DSP/Include --source ../CMSIS_5/CMSIS/Core/Include -j8
Drag & drop the bin file generated into the usb mass storage available on plugin the board