【玄铁杯第三届RISC-V应用创新大赛】LicheePi 4A+YOLOX 目标检测案例测试记录
[复制链接]
测试过程主要是按照文档下载安装相关的软件包,大概流程如下:
安装SHL库,这里使用的是c920,cpu版本
wget https://github.com/T-head-Semi/csi-nn2/releases/download/v2.4-beta.1/c920.tar.gz
tar xf c920.tar.gz
cp c920/lib/* /usr/lib/riscv64-linux-gnu/ -rf
最新的已经有th1520了,但是例程里面用的是cpu,暂时没有用上
配置python环境
apt install python3-pip
apt install python3.11-venv
python3 -m venv ort
source /home/sipeed/ort/bin/activate
这里激活虚拟环境很重要,不然后面安装whl包会出错,报以下错误:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
下载并安装yolo及其相关的软件包
git clone -b python3.11 https://github.com/zhangwm-pt/prebuilt_whl.git
cd prebuilt_whl
pip install numpy-1.25.0-cp311-cp311-linux_riscv64.whl
pip install opencv_python-4.5.4+4cd224d-cp311-cp311-linux_riscv64.whl
pip install kiwisolver-1.4.4-cp311-cp311-linux_riscv64.whl
pip install Pillow-9.5.0-cp311-cp311-linux_riscv64.whl
pip install matplotlib-3.7.2.dev0+gb3bd929cf0.d20230630-cp311-cp311-linux_riscv64.whl
pip install pycocotools-2.0.6-cp311-cp311-linux_riscv64.whl
pip3 install loguru-0.7.0-py3-none-any.whl
pip3 install torch-2.0.0a0+gitc263bd4-cp311-cp311-linux_riscv64.whl
pip3 install MarkupSafe-2.1.3-cp311-cp311-linux_riscv64.whl
pip3 install torchvision-0.15.1a0-cp311-cp311-linux_riscv64.whl
pip3 install psutil-5.9.5-cp311-abi3-linux_riscv64.whl
pip3 install tqdm-4.65.0-py3-none-any.whl
pip3 install tabulate-0.9.0-py3-none-any.whl
wget https://github.com/zhangwm-pt/onnxruntime/releases/download/riscv_whl/onnxruntime-1.14.1-cp311-cp311-linux_riscv64.whl
pip install onnxruntime-1.14.1-cp311-cp311-linux_riscv64.whl
下载测试样例及模型
git clone https://github.com/Megvii-BaseDetection/YOLOX.git
cd YOLOX/demo/ONNXRuntime
wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.onnx
下载测试图片,我是直接保存了文档中的足球照片进行的测试。
运行测试:
python3 onnx_inference.py -m yolox_s.onnx -i soccer.jpg -o ~/outdir -s 0.3 --input_shape 640,640
这里的命令根据实际情况进行-i、-o等参数的修改。
最后得到测试结果的照片,与文档描述一致,测试完成。
测试命令日志截图:
最后对测试前后磁盘空间进行了观察,发现空间满了,这个比较尴尬了,不知道系统怎么安装到tf卡来启动,这样空间可以灵活扩展。
磁盘空间对比,主要是安装yolo相关的pip包
Before:
Filesystem Size Used Avail Use% Mounted on
/dev/root 6.7G 3.8G 2.6G 60% /
After:
Filesystem Size Used Avail Use% Mounted on
/dev/root 6.7G 5.3G 1.1G 83% /
测试结果图片截图:
|