@Frank, 您好,用您发的软件包更新完之后还是没法直接执行aml_npu_demo_binaries下的程序,好像还要依赖opencv4.2
@cbtogu 你用的如果是opencv4的版本话,
$ sudo apt remove opencv3
然后安装opencv4
sudo apt install libopencv-dev python3-opencv
@Frank, 都更新完了,gitlab下载的demo程序能正常跑了,但是运行我转换后的yolov4模型还是提示跟前面一样的错误。
@cbtogu 可以转换,但是不能运行是么,把你的转换脚本设置的参数贴出来
@Frank, 刚才忘了用新的sdk重新编译一下代码了,不过编译的时候也碰到问题了,好像detect_yolo_v4目录下的编译脚本没有得到更新,里面还是用opencv3去编译,我看gitlab仓库里也这样。另外编译也提示以下错误:
In file included from vnn_yolov4.c:16:0:
./include/vnn_yolov4.h:37:11: error: unknown type name ‘vsi_nn_preprocess_map_element_t’
const vsi_nn_preprocess_map_element_t * pre_process_map,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/vnn_yolov4.h:39:11: error: unknown type name ‘vsi_nn_postprocess_map_element_t’
const vsi_nn_postprocess_map_element_t * post_process_map,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vnn_yolov4.c:130:11: error: unknown type name ‘vsi_nn_preprocess_map_element_t’
const vsi_nn_preprocess_map_element_t * pre_process_map,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vnn_yolov4.c:132:11: error: unknown type name ‘vsi_nn_postprocess_map_element_t’
const vsi_nn_postprocess_map_element_t * post_process_map,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vnn_yolov4.c: In function ‘vnn_CreateYolov4’:
vnn_yolov4.c:288:77: error: request for member ‘graph_input_idx’ in something not a structure or union
status = vsi_nn_AddGraphPreProcess(graph, pre_process_map[i].graph_input_idx,
^
vnn_yolov4.c:289:70: error: request for member ‘preprocesses’ in something not a structure or union
pre_process_map[i].preprocesses,
^
vnn_yolov4.c:290:70: error: request for member ‘preprocess_count’ in something not a structure or union
pre_process_map[i].preprocess_count);
^
vnn_yolov4.c:299:80: error: request for member ‘graph_output_idx’ in something not a structure or union
status = vsi_nn_AddGraphPostProcess(graph, post_process_map[i].graph_output_idx,
^
vnn_yolov4.c:300:73: error: request for member ‘postprocesses’ in something not a structure or union
post_process_map[i].postprocesses,
^
vnn_yolov4.c:301:73: error: request for member ‘postprocess_count’ in something not a structure or union
post_process_map[i].postprocess_count);
^
vnn_yolov4.c:145:29: warning: unused variable ‘data’ [-Wunused-variable]
uint8_t * data;
^~~~
At top level:
vnn_yolov4.c:94:17: warning: ‘load_data’ defined but not used [-Wunused-function]
static uint8_t* load_data
^~~~~~~~~
/media/zdyd/code/khadas_vim3/npu/aml_npu_sdk_6.4.2.1/linux_sdk/linux_sdk_6.4.2.1//common.target:99: recipe for target ‘bin_r/vnn_yolov4.o’ failed
make: *** [bin_r/vnn_yolov4.o] Error 1
我在aml_npu_sdk_6.4.2.1/linux_sdk/linux_sdk_6.4.2.1/acuity-ovxlib-dev/include目录下也没找到vsi_nn_postprocess_map_element_t的声明。
以下是三个转换脚本内容:
0_import_model.sh
#!/bin/bash
NAME=yolov4
ACUITY_PATH=…/bin/convert_caffe=${ACUITY_PATH}convertcaffe
convert_tf=${ACUITY_PATH}convertensorflow
convert_tflite=${ACUITY_PATH}convertflite
convert_darknet=${ACUITY_PATH}convertdarknet
convert_onnx=${ACUITY_PATH}convertonnx$convert_darknet
–net-input /media/zdyd/data/meters_recog/models/watch_sword/watch_sword.cfg
–weight-input /media/zdyd/data/meters_recog/models/watch_sword/backup/watch_sword_final.weights
–net-output ${NAME}.json
–data-output ${NAME}.data
1_quantize_model.sh
#!/bin/bash
NAME=yolov4
ACUITY_PATH=…/bin/tensorzone=${ACUITY_PATH}tensorzonex
#dynamic_fixed_point-i8 asymmetric_affine-u8
$tensorzone
–action quantization
–dtype float32
–source text
–source-file ./data/validation_tf.txt
–channel-mean-value ‘0 0 0 256’
–model-input ${NAME}.json
–model-data ${NAME}.data
–model-quantize ${NAME}.quantize
–quantized-dtype dynamic_fixed_point-i8
–quantized-rebuild
2_export_case_code.sh
#!/bin/bash
NAME=yolov4
ACUITY_PATH=…/bin/export_ovxlib=${ACUITY_PATH}ovxgenerator
$export_ovxlib
–model-input ${NAME}.json
–data-input ${NAME}.data
–reorder-channel ‘2 1 0’
–channel-mean-value ‘0 0 0 256’
–export-dtype quantized
–model-quantize ${NAME}.quantize
–optimize VIPNANOQI_PID0XB9
–viv-sdk ${ACUITY_PATH}vcmdtools
–pack-nbg-unify#save normal case demo export.data
#mkdir normal_case_demo
#mv *.h *.c .project .cproject *.vcxproj *.lib BUILD *.linux *.export.data normal_case_demorm *.h *.c .project .cproject *.vcxproj *.lib BUILD *.linux *.export.data
麻烦看看有什么问题没?谢谢!
@cbtogu 这个参数不对,VIM3这里应该使用参数VIPNANOQI_PID0X88
.
Docs目录下的转换指南里面有对这个的详细描述,你可以看看
你要把app的仓库切换到4.x的分支,才是使用opencv4的
@Frank 这次更新的sdk里的转换脚本里参数设置跟之前不太一样,我是按照网页上的转换说明来做的,里面好像也没提到这个参数设置的问题。如果新的sdk默认使用opencv4的话,仓库里的编译脚本里是不是也应该设置成opencv4?
@cbtogu SDK在转换时是不需要使用opencv的,opencv是为了app仓库服务的,SDK里面opencv3和opencv4是同时兼容的. 使用opencv3还是opencv4,是app仓库在编译是的build_vx.sh
决定的,这个文件里面设置opencv的版本变量.因此,你在app仓库的分支上可以看到,opencv4.x的分支是使用opencv4的.master分支是opencv3的,你可以对比两个分支的build_vx.sh
文件
SDK转换时不涉及opencv,没有版本区别的
@Frank 对,转换的时候是没有用opencv, 我说的也是转换完之后需要编译新的libnn_yolo_v4.so, 用到build_vx.sh脚本,不过我确实也没注意看分支里的编译脚本
@cbtogu 你按照你板子上的opencv版本,现在你板子上使用那个版本,你就切换app的不不同分支编译,现在这几个仓库比较复杂,不大好用,我们后续会优化的
@Frank 好的,另外转换脚本里的参数设置除了您提出的那个问题,还有别的问题吗?
@cbtogu 其他的参数主要是影响精度,刚才这个参数决定了是不是能不能跑起来
@cbtogu 你好,请问你的模型成功跑起来了么
@Frank 还不行,按照您说的改了转换参数,重新转换了模型,模型文件大小确实跟昨天不一样了,但是编译libnn_yolo_v4.so时还是提示昨天一样的错误,找不到 vsi_nn_preprocess_map_element_t的声明
$tensorzone \
--action quantization \
--source text \
--source-file ./data/validation_tf.txt \
--channel-mean-value '0 0 0 256' \
--model-input ${NAME}.json \
--model-data ${NAME}.data \
--quantized-dtype dynamic_fixed_point-8 \
--quantized-rebuild
$export_ovxlib \
--model-input ${NAME}.json \
--data-input ${NAME}.data \
--reorder-channel '2 1 0' \
--channel-mean-value '0 0 0 256' \
--export-dtype quantized \
--model-quantize ${NAME}.quantize \
--optimize VIPNANOQI_PID0X88 \
--viv-sdk ../bin/vcmdtools \
--pack-nbg-unify
这是我的参数,你参考一下
@cbtogu 这个参数不要加, 转换是使用的8位的int型
@Frank 参考您的参数设置,转换完之后还是编译不通过,仍然一样的错误,您这边生成的vnn_yolov4.h里面有用到vsi_nn_preprocess_map_element_t 类型吗?我转换了这么好几次都有,然后sdk里又找不到这个声明
@cbtogu 没有使用到这个类型,这个类型在SDK里面有定义,是转换工具的vxcode定义的一个结构,你转换完的代码,你复制了哪些到app仓库