添加仓库
sudo apt install software-properties-common
sudo add-apt-repository ppa:armnn/ppa
sudo apt update
安装pyarmnn
sudo apt-get install -y python3-pyarmnn armnn-latest-all python3-pip
安装PIL的package
运行测试脚本的时候,可能会报找不到PIL
pip3 install Pillow
安装opencv库
sudo apt-get install python3-opencv
下载pyarmnn仓库
git clone https://github.com/nxp-imx/pyarmnn-release.git
测试图片分类推理
默认会下载一个小猫的图片还有标签文件
cd pyarmnn-release/python/pyarmnn/examples
python3 tflite_mobilenetv1_quantized.py -d . -m .
可以看大,tabby的概率最高
firefly@firefly:~/pyarmnn-release/python/pyarmnn/examples$ python3 tflite_mobilenetv1_quantized.py -d . -m .
WARNING: PyArmNN is deprecated. To use ArmNN on python, please use the tflite delegate. Expected to be removed in release 24.05.
Your ArmNN library instance does not support Onnx models parser functionality. Skipped IOnnxParser import.
Your ArmNN library instance does not have ArmNN model (.armnn) parser functionality. Skipped IDeserializer import.
Found model (./mobilenet_v1_1.0_224_quant.tflite) and labels (./labels_mobilenet_quant_v1_224.txt).
Running inference(0) ...
class=tabby ; value=99
class=Egyptian cat ; value=84
class=tiger cat ; value=71
class=cricket ; value=0
class=zebra ; value=0