交叉编译ARM平台、移植ArmNN

    技术2022-07-11  79

    参考文章:

    检查lib文件的软连接方向:

    ls -l libboost_system.so

    进入板子linux系统:

    ssh root@10.6.5.134 ping 10.6.5.134

    用ssh将本地资源复制到服务器

    https://blog.csdn.net/qq_39377418/article/details/89367041

    //查看当前系统磁盘使用空间

    df -h

    //查看当前目录文件占用空间大小

    du -sh *

    Linux -- 查询某个文件夹下的文件数量

    https://www.cnblogs.com/gengyufei/p/12804376.html

    ubuntu16.04系统安装且挂载硬盘且设为开机启动项

    https://blog.csdn.net/weixin_42652125/article/details/81171233

    命令行批量替换字符串

    sed命令替换字符包含斜杠\,引号的处理方法 - franjia - 博客园

    https://www.cnblogs.com/franjia/p/6690060.html

    【转载】linux中批量替换文本中字符串命令 - -天道酬勤- - 博客园

    https://www.cnblogs.com/wbl001/p/12492055.html

    sed -i 's#home/gavin/桌面/TOF_Doc/libroyale_ningbosunnyopotech#home/robert/DeepLearning/royale#g' `grep home/gavin/桌面/TOF_Doc/libroyale_ningbosunnyopotech -rl *`

    杀死从文件夹启动的可执行程序

    查序号,https://www.cnblogs.com/hml-blog-com/p/11558369.html

    ps aux kill -s 9 3960

    Linux创建连接命令 ln -s创建软连接

    https://www.cnblogs.com/zhangna1998517/p/11347364.html

    ARM交叉编译工具链分类说明

    https://blog.csdn.net/qq_16149777/article/details/82349868

    命令行分区

    linux将其他分区空间划分给root分区的方法(ext4文件系统)

    https://blog.csdn.net/qq_26514685/article/details/106673825

    linux如何查看磁盘剩余空间

    https://www.cnblogs.com/jasonxu19900827/p/5282237.html

    在ARM Linux下挂载SD卡分区

    https://blog.csdn.net/timeless_2014/article/details/82319554

    ubuntu 硬盘管理工具

    https://blog.csdn.net/bluebird_shao/article/details/8241698

    ubuntu16.04使用GParted对/根目录扩容

    https://blog.csdn.net/Carina_Cao/article/details/90270389

    linux 如何查看硬盘大小,存储空间大小等系统信息及硬件信息

    https://www.cnblogs.com/lixuejian/p/12100166.html

    Linux下tempfs及/dev/shm原理与应用

    https://blog.csdn.net/guo8113/article/details/28590963

    烧SD卡和通信

    Ubuntu下安装ssh与配置

    https://www.cnblogs.com/cookiewu/p/9664062.html

    如何在Ubuntu下向TF/SD卡中烧写镜像(程序),较好

    https://blog.csdn.net/zyc_csdn/article/details/89062686

    Ubuntu14.04下tftp安装,并与开发板通信

    https://blog.csdn.net/smz958150/article/details/75307463

    ubuntu下的tftp上传和下载操作方法

    https://blog.csdn.net/long0814long0814/article/details/65477673

    ubantu下ssh: connect to host xxxxxxxxxx port 22: Connection refused问题

    https://blog.csdn.net/yundou520/article/details/82658809

    如何在ubuntu中通过串口访问开发板(如:树莓派),putty

    https://blog.csdn.net/dgj8300/article/details/51045874/

    ubuntu下串口工具的安装与使用,minicom

    https://blog.csdn.net/lzhitwh/article/details/80304579

    深度学习与程序移植

    深度强化学习实验中的paper绘图方法

    https://mp.weixin.qq.com/s/94nwkxn20ZixmcsX8oUJIw

    dair-ai/ml-visuals: Visuals contains figures and templates which you can reuse and customize to improve your scientific writing.

    https://github.com/dair-ai/ml-visuals

    Linux 中最常用 150 个命令汇总

    https://mp.weixin.qq.com/s/Lbp6_pz_UYrrGUtdQKwfBQ

    Linux指定动态库搜索路径五种方法及优先级

    https://blog.csdn.net/wwwtovvv/article/details/41477249

    linux下cmake-3.11.4安装

    https://blog.csdn.net/Jeffxu_lib/article/details/80712414

    小技巧

    linux查看可执行程序的链接库及文件位置

    https://blog.csdn.net/weixin_42404296/article/details/82632354

    Linux下使用SSH进行远程登录主机及操作

    https://blog.csdn.net/Hellowenpan/article/details/82904109

    linux下如何查看cpu信息

    https://blog.csdn.net/liuli9/article/details/84112680

    shell脚本中的条件测试if中的-z到-d的意思

    https://blog.csdn.net/xiaodingqq/article/details/79981372

    移植boost_1_55_0至arm的方法小结(有错误)

    https://blog.csdn.net/dotphoenix/article/details/41114523

    arm交叉编译器编译boost库并调用(有错误)

    https://blog.csdn.net/jiangheng0535/article/details/18225775

    移植ArmNN

    在imx8qm上开心把玩Machine Learning(写得较简单,有一点参考意义)

    https://blog.csdn.net/u013739490/article/details/84314290

    Configuring the Arm NN SDK build environment for Caffe(较完善,主要还是参考官方编译教程)

    https://blog.csdn.net/liugan528/article/details/80272763

    ARM NN:Ubuntu 14.04 Caffe和TensorFlow以及TF-lite的ARM NN SDK编译环境搭建及MNIST程序测试(有一定参考意义)

    https://blog.csdn.net/coinv2014/article/details/83582747

    为Tensorflow、Tensorflow lite配置Arm NN SDK编译环境(有一定参考意义)

    https://blog.csdn.net/a845414332/article/details/102718813

    官方教程避坑:编译ARM NN/Tensorflow Lite

    https://www.cnblogs.com/pepetang/p/10627542.html

    在ARM板子上把玩Tensorflow Lite(操作复杂,暂无参考意义)

    https://blog.csdn.net/computerme/article/details/80345065

    ARMNN使用例程(有参考性,但不够完善)

    https://github.com/ARM-software/ML-examples

    官方指导网站

    https://developer.arm.com/solutions/machine-learning-on-arm/developer-material/how-to-guides

     

    我的编译代码,主要还是参考官方的编译文档:BuildGuideCrossCompilation.md

    根据上述参考安装scons-2.4.1

    protobuf version 3.5.2

    build_x86_64.sh

    #git submodule update --init --recursive #./autogen.sh mkdir x86_64_build cd x86_64_build ../configure --prefix=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/x86_64_pb_install make install -j16 cd ..

    build_arm64.sh

    mkdir arm64_build cd arm64_build export LD_LIBRARY_PATH=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux ../configure --host=aarch64-poky-linux \ CC=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc \ CFLAGS="--sysroot=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux" \ CXX=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++ \ CXXFLAGS="--sysroot=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux" \ --prefix=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install \ --with-protoc=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/x86_64_pb_install/bin/protoc make install -j16 cd ..

    Build Boost library for arm64

    build.sh

    echo "building boost 1.64.0" echo "using gcc : arm : aarch64-poky-linux-g++ ;" > user_config.jam sh ./bootstrap.sh --prefix=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/boost_arm64_install export LD_LIBRARY_PATH=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux ./b2 toolset=gcc-arm link=static cxxflags="-fPIC --sysroot=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux" --with-filesystem --with-test --with-log --with-program_options --user-config=user_config.jam #./b2 install

    Build Caffe for x86_64

    参考:https://blog.csdn.net/yiyayiya557/article/details/105796768

    和官方文档

    Build Compute Library

    build.sh

    sudo dd if=/dev/zero of=/home/swap bs=64M count=16 sudo mkswap /home/swap sudo swapon /home/swap export LD_LIBRARY_PATH=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux scons extra_cxx_flags="-fPIC --sysroot=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux" arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 -j8 internal_only=0 # install_dir="/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/ComputeLibrary" sudo swapoff /home/swap sudo rm /home/swap

    Build Tensorflow 1.15.3

    build.sh

    ../armnn-branches-armnn_20_05/scripts/generate_tensorflow_protobuf.sh ../armnn-devenv/tensorflow-protobuf/ ../armnn-devenv/google/x86_64_pb_install

    Build Flatbuffer 1.10.0

    build_x86_64.sh

    mkdir build_x86_64 cd build_x86_64 cmake .. -DFLATBUFFERS_BUILD_FLATC=1 \ -DCMAKE_INSTALL_PREFIX=/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/flatbuffer/x86_64_fb_install \ -DFLATBUFFERS_BUILD_TESTS=0 make all install

    build_arm64.sh

    mkdir build_arm64 cd build_arm64 export LD_LIBRARY_PATH=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux CC=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc \ CXX=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++ \ cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_INSTALL_PREFIX=/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/flatbuffer/arm64_fb_install make all install

    toolchain.cmake

    # this is required SET(CMAKE_SYSTEM_NAME Linux) # specify the cross compiler SET(CMAKE_C_COMPILER /opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc) SET(CMAKE_CXX_COMPILER /opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++) SET(CMAKE_SYSROOT /opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux) # where is the target environment SET(CMAKE_FIND_ROOT_PATH /opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux) # specify the compiler flag SET(CMAKE_C_FLAGS -O3 -mtune=cortex-a35 -mcpu=cortex-a35 -march=armv8-a+fp+simd+crc+crypto) SET(CMAKE_CXX_FLAGS -std=c++11 -O3 -mtune=cortex-a35 -mcpu=cortex-a35 -march=armv8-a+fp+simd+crc+crypto) # search for programs in the build host directories (not necessary) SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # for libraries and headers in the target directories SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

    Build Onnx

    build.sh

    export LD_LIBRARY_PATH=/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/x86_64_pb_install/lib:$LD_LIBRARY_PATH ../armnn-devenv/google/x86_64_pb_install/bin/protoc ./onnx/onnx.proto --proto_path=. --proto_path=../armnn-devenv/google/x86_64_pb_install/include --cpp_out ../onnx

    Build TfLite

    build.sh

    ../flatbuffers-1.10.0/build_x86_64/flatc -c --gen-object-api --reflect-types --reflect-names schema.fbs

    Build ArmNN

    build.sh

    mkdir build cd build export LD_LIBRARY_PATH=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux cmake .. \ -DARMCOMPUTE_ROOT=$HOME/DeepLearning/NXP-imx8QX/CompileResult/ArmComputeLibrary-master-v20.05 \ -DARMCOMPUTE_BUILD_DIR=$HOME/DeepLearning/NXP-imx8QX/CompileResult/ArmComputeLibrary-master-v20.05/build/ \ -DBOOST_ROOT=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/boost_arm64_install/ \ -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \ -DCAFFE_GENERATED_SOURCES=$HOME/DeepLearning/NXP-imx8QX/CompileResult/caffe-master-cpu/build/src \ -DBUILD_CAFFE_PARSER=1 \ -DONNX_GENERATED_SOURCES=$HOME/DeepLearning/NXP-imx8QX/CompileResult/onnx \ -DBUILD_ONNX_PARSER=1 \ -DTF_GENERATED_SOURCES=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/tensorflow-protobuf \ -DBUILD_TF_PARSER=1 \ -DBUILD_TF_LITE_PARSER=1 \ -DTF_LITE_GENERATED_PATH=$HOME/DeepLearning/NXP-imx8QX/CompileResult/tflite \ -DTF_LITE_SCHEMA_INCLUDE_PATH=$HOME/DeepLearning/NXP-imx8QX/CompileResult/tensorflow-1.15.3/tensorflow/lite/schema \ -DFLATBUFFERS_ROOT=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/flatbuffer/arm64_fb_install \ -DFLATC_DIR=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/flatbuffer/arm64_fb_install/bin \ -DFLATBUFFERS_LIBRARY=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/flatbuffer/arm64_fb_install/lib/libflatbuffers.a \ -DFLATBUFFERS_INCLUDE_PATH=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/flatbuffer/arm64_fb_install/include \ -DPROTOBUF_ROOT=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install \ -DPROTOBUF_INCLUDE_DIRS=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install/include \ -DPROTOBUF_LIBRARY_DEBUG=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.15.0.1 \ -DPROTOBUF_LIBRARY_RELEASE=$HOME/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.15.0.1 \ -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \ -DCMAKE_INSTALL_PREFIX=/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/armnn-install #--no-warn-unused-cli #-DBUILD_TESTS=1 make -j$(nproc) install

    toolchain.cmake

    # this is required SET(CMAKE_SYSTEM_NAME Linux) # specify the cross compiler SET(CMAKE_C_COMPILER /opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc) SET(CMAKE_CXX_COMPILER /opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion -pthread") set(Boost_NO_BOOST_CMAKE ON) set(Boost_USE_STATIC_LIBS ON) SET(CMAKE_SYSROOT /opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux) # where is the target environment SET(CMAKE_FIND_ROOT_PATH /opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux) # specify the compiler flag SET(CMAKE_C_FLAGS -O3 -mtune=cortex-a35 -mcpu=cortex-a35 -march=armv8-a+fp+simd+crc+crypto) SET(CMAKE_CXX_FLAGS -std=c++11 -O3 -mtune=cortex-a35 -mcpu=cortex-a35 -march=armv8-a+fp+simd+crc+crypto) # search for programs in the build host directories (not necessary) SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # for libraries and headers in the target directories SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

    测试armnn-mnist

    build.sh

    mkdir build cd build export LD_LIBRARY_PATH=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux aarch64-poky-linux-g++ -O3 --sysroot=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux -std=c++14 \ -I/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/armnn-install/include \ ../mnist_caffe.cpp -o mnist_caffe \ -L/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/armnn-install/lib \ -L/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install/lib \ -larmnn -larmnnCaffeParser -lprotobuf -lprotoc -lpthread

    Makefile

    ARMNN_LIB = ${HOME}/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/armnn-install/lib ARMNN_INC = ${HOME}/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/armnn-install/include PROTOBUF = ${HOME}/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install/lib all: mnist_caffe mnist_tf mnist_caffe: mnist_caffe.cpp mnist_loader.hpp aarch64-poky-linux-g++ -O3 -std=c++14 -I$(ARMNN_INC) mnist_caffe.cpp -o mnist_caffe -L$(ARMNN_LIB) -L$(PROTOBUF) -lprotobuf -larmnn -larmnnCaffeParser -lpthread mnist_tf: mnist_tf.cpp mnist_loader.hpp aarch64-poky-linux-g++ -O3 -std=c++14 -I$(ARMNN_INC) mnist_tf.cpp -o mnist_tf -L$(ARMNN_LIB) -L$(PROTOBUF) -lprotobuf -larmnn -larmnnTfParser -lpthread clean: -rm -f mnist_tf mnist_caffe test: mnist_caffe mnist_tf LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$(ARMNN_LIB) ./mnist_caffe LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$(ARMNN_LIB) ./mnist_tf

    测试armnn-mobilenet-quant

    build.sh

    #!/bin/bash set -e # Exit immediately if a command exits with a non-zero status. BuildDir=build if [ ! -d "$BuildDir" ]; then # Take action if $BuildDir doesn‘t exists. echo "create ${BuildDir}..." mkdir -p ${BuildDir} fi cd ${BuildDir} echo "building mobilenet quant" export LD_LIBRARY_PATH=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DBUILD_SHARED_LIBS=ON –build –config Release .. make -j$(nproc)

    CMakeLists.txt

    cmake_minimum_required(VERSION 2.8.4) #版本最小为2.8.4 PROJECT(mobilenet_quant) #设置工程名 set(ARMNN_BUILD "/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/armnn-install/lib") set(ARMNN_ROOT "/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-branches-armnn_20_05") set(PROTOBUF "/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/google/arm64_pb_install/lib") set(BOOST_ROOT "/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/boost_arm64_install") set(FLATBUFFERS "/home/robert/DeepLearning/NXP-imx8QX/CompileResult/armnn-devenv/flatbuffer/arm64_fb_install/lib") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3 -lpthread -DDLIB_JPEG_SUPPORT -DDLIB_PNG_SUPPORT -DARMNN_TF_LITE_PARSER -fPIE -pie") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${ARMNN_ROOT}/include -I${ARMNN_ROOT}/src/backends -I${ARMNN_ROOT}/src/armnnUtils -I${ARMNN_ROOT}/tests -I${BOOST_ROOT}/include") IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything") ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") ENDIF() FIND_PACKAGE(OpenCV REQUIRED) INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) message(STATUS "Opencv include dir found at ${OpenCV_INCLUDE_DIRS}") find_package(Threads) set(envSTR "arm") if(envSTR STREQUAL "x64") INCLUDE_DIRECTORIES(/home/robert/DeepLearning/NXP-imx8QX/CompileResult/mydlib-19.19.0) LINK_DIRECTORIES(/home/robert/DeepLearning/NXP-imx8QX/CompileResult/mydlib-19.19.0/x64_build_second/dlib/) ELSEIF(envSTR STREQUAL "arm") INCLUDE_DIRECTORIES(/home/robert/DeepLearning/NXP-imx8QX/CompileResult/dlib-19.19.0) LINK_DIRECTORIES(/home/robert/DeepLearning/NXP-imx8QX/CompileResult/dlib-19.19.0/dlib_build_second_armv8/dlib/) # INCLUDE_DIRECTORIES(${ARMNN_ROOT}/include) # INCLUDE_DIRECTORIES(${ARMNN_ROOT}/src/backends) # INCLUDE_DIRECTORIES(${ARMNN_ROOT}/src/armnnUtils) # INCLUDE_DIRECTORIES(${ARMNN_ROOT}/tests) # INCLUDE_DIRECTORIES(${BOOST_ROOT}/include) LINK_DIRECTORIES(${ARMNN_BUILD}) LINK_DIRECTORIES(${BOOST_ROOT}/lib) LINK_DIRECTORIES(${PROTOBUF}) LINK_DIRECTORIES(${FLATBUFFERS}) ENDIF() message(${ARMNN_ROOT}/include) FILE(GLOB SRC_FILES "./*.cpp") FILE(GLOB HEAD_FILES "./*.h") ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_FILES} ${HEAD_FILES}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} dlib armnn armnnTfLiteParser boost_system boost_filesystem boost_program_options protobuf pthread flatbuffers ${OpenCV_LIBS} ${CMAKE_THREAD_LIBS_INIT})

    toolchain.cmake

    同上

    板上测试,针对CPU

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./mobilenet_quant -m ./models/mobilenet_v1_1.0_224_quant.tflite -d ./data/Dog.jpg -p ./models/labels.txt -c CpuAcc

    mobilenet_v1_1.0_224_quant.tgz下载地址:https://www.tensorflow.org/lite/guide/hosted_models

    labels.txt在源码的/armnn-branches-armnn_20_05/tests/TfLiteMobilenetQuantized-Armnn

    Dog.jpg为kaggle猫狗二分类竞赛图片

    Processed: 0.013, SQL: 9