树莓派4B使用ARM Compute Library运行AlexNet

# Install Build Tools 
$ pip install scons 

# Reload Environment
$ source ~/.profile

# Clone Compute Library 
$ git clone https://github.com/Arm-software/ComputeLibrary.git 

# or wget https://www.mobibrw.com/wp-content/uploads/2019/10/ComputeLibrary.zip

# Enter ComputeLibrary folder 
$ cd ComputeLibrary  

# Build the library and the examples 
$ scons Werror=1 debug=0 asserts=0 neon=1 opencl=1 examples=1 os=linux arch=armv7a -j4 

# Run on the Raspberry Pi
$ export LD_LIBRARY_PATH=build/ 

# Download AlexNet

# Install unzip
$ sudo apt-get install unzip

# Download the zip file with the AlexNet model, input images and labels
$ wget https://armkeil.blob.core.windows.net/developer/developer/technologies/Machine%20learning%20on%20Arm/Tutorials/Running%20AlexNet%20on%20Pi%20with%20Compute%20Library/compute_library_alexnet.zip

# or wget https://www.mobibrw.com/wp-content/uploads/2019/10/compute_library_alexnet.zip

# Create a new folder
$ mkdir assets_alexnet

# Unzip
$ unzip compute_library_alexnet.zip -d assets_alexnet

$ PATH_ASSETS=./assets_alexnet 

$ ./build/examples/graph_alexnet 0 $PATH_ASSETS  $PATH_ASSETS/go_kart.ppm $PATH_ASSETS/labels.txt

参考链接


发布者

《树莓派4B使用ARM Compute Library运行AlexNet》上有2条评论

  1. 题主你好,我的设备是树莓派4B(2GB),我的树莓派安装了Raspbian Buster系统。我按照你的操作进行Alexnet的安装,在执行最后一行命令./build/examples/graph_alexnet的时候,树莓派报错说是没有opencl的环境,然后就不能进行下去了。我看参考链接里的文章要求装的是Ubuntu MATE系统,请问是不是系统的原因呢?以及按照你的命令过程安装之后应该如何使用Alexnet进行训练呢?求具体指教,谢谢!

    1. 最新的版本可能已经支持OpenCL了吧,当时编译的时候,是没有OpenCL支持的,因此只需要CPU是ARM的即可。当时执行的是CPU版本的,因此按照CPU的设置即可运行测试。这个当时只是推理,不是训练,训练的话,性能跟不上的。

回复 默默 取消回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注