Got it

How to convert Yolov3-Resnet18 from ModelArts into Atlas 200 DK and use it for video object detection?

Created: Apr 23, 2021 17:21:36Latest reply: May 12, 2021 00:55:16 530 6 1 0 1
  HiCoins as reward: 0 (problem unresolved)

Dear all,


I use the same samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video project that can run successfully before. 

Then I use YoloV3-Resnet18 Algorithm inside ModelArts to train with my own dataset. It can from  

https://marketplace.huaweicloud.com/markets/aihub/modelhub/detail/?id=948196c8-3e7a-4729-850b-069101d6e95c

I download the output files.

yol


Using MindStudio 2.0.0 (beta 3), from Menu --> Ascend --> Tool Converter

I open output_Yolov3-Resnet18\frozen_graph\yolo3_resnet18.pb

aa

I put Dynamic Batch=1,2,4,8. What are the number mean?


I activate Input Node (images) and Image Input Format = RGB package. Is it correct? Or I need to change it into BGR package??

rrr


I don't have modelzoo directory. 

Why the atc command

/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/bin/atc --input_shape="images:-1,352,640,3" --check_report=/home/suryadi/modelzoo/yolo3_resnet18/device/network_analysis.report --input_format=NHWC --output="/home/suryadi/modelzoo/yolo3_resnet18/device/yolo3_resnet18" --soc_version=Ascend310 --insert_op_conf=/home/suryadi/modelzoo/yolo3_resnet18/device/insert_op.cfg --framework=3 --model="/home/suryadi/AscendProjects/output_Yolov3-Resnet18/frozen_graph/yolo3_resnet18.pb" --dynamic_batch_size="1,2,4,8" 


I got at this directory: $HOME\AscendProjects\output_Yolov3-Resnet18\frozen_graph\insert_op.cfg

ss


In the meantime, I create modelzoo/yolo3_resnet18/device and copy insert_op.cfg from  $HOME\AscendProjects\output_Yolov3-Resnet18\frozen_graph\insert_op.cfg

How to make the correction for the wrong directory?


I got the result

ssa

2021-04-23 17:33  Start to convert model

2021-04-23 17:33  export PATH=/usr/local/python3.7.5/bin:$PATH:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/ccec_compiler/bin:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/bin && export PYTHONPATH=$PYTHONPATH:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/python/site-packages:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/python/site-packages/auto_tune.egg/auto_tune:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/python/site-packages/schedule_search.egg:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/opp/op_impl/built-in/ai_core/tbe && export LD_LIBRARY_PATH=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/lib64:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/driver/lib64:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/add-ons:/usr/local/python3.7.5/lib:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib/lib64 && export SLOG_PRINT_TO_STDOUT=1 && export ASCEND_OPP_PATH=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/opp && /home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/bin/atc --input_shape="images:-1,352,640,3" --check_report=/home/suryadi/modelzoo/yolo3_resnet18/device/network_analysis.report --input_format=NHWC --output="/home/suryadi/modelzoo/yolo3_resnet18/device/yolo3_resnet18" --soc_version=Ascend310 --insert_op_conf=/home/suryadi/modelzoo/yolo3_resnet18/device/insert_op.cfg --framework=3 --model="/home/suryadi/AscendProjects/output_Yolov3-Resnet18/frozen_graph/yolo3_resnet18.pb" --dynamic_batch_size="1,2,4,8" 

2021-04-23 17:33  ATC start working now, please wait for a moment.

2021-04-23 17:33  ATC run success, welcome to the next use.

2021-04-23 17:33  Convert model environment variables: 

2021-04-23 17:33  export PATH=/usr/local/python3.7.5/bin:$PATH:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/ccec_compiler/bin:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/bin && export PYTHONPATH=$PYTHONPATH:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/python/site-packages:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/python/site-packages/auto_tune.egg/auto_tune:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/python/site-packages/schedule_search.egg:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/opp/op_impl/built-in/ai_core/tbe && export LD_LIBRARY_PATH=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/lib64:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/driver/lib64:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/add-ons:/usr/local/python3.7.5/lib:/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib/lib64 && export SLOG_PRINT_TO_STDOUT=1 && export ASCEND_OPP_PATH=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/opp

2021-04-23 17:33  Convert model command: 

2021-04-23 17:33  /home/suryadi/Ascend/ascend-toolkit/20.2.rc1/atc/bin/atc --input_shape="images:-1,352,640,3" --check_report=/home/suryadi/modelzoo/yolo3_resnet18/device/network_analysis.report --input_format=NHWC --output="/home/suryadi/modelzoo/yolo3_resnet18/device/yolo3_resnet18" --soc_version=Ascend310 --insert_op_conf=/home/suryadi/modelzoo/yolo3_resnet18/device/insert_op.cfg --framework=3 --model="/home/suryadi/AscendProjects/output_Yolov3-Resnet18/frozen_graph/yolo3_resnet18.pb" --dynamic_batch_size="1,2,4,8" 

2021-04-23 17:33  Model converted successfully.

2021-04-23 17:33  Model input path:/home/suryadi/AscendProjects/output_Yolov3-Resnet18/frozen_graph/yolo3_resnet18.pb

2021-04-23 17:33  Model output path:/home/suryadi/modelzoo/yolo3_resnet18

2021-04-23 17:33  Model conversion log file path:/home/suryadi/modelzoo/yolo3_resnet18/ModelConvert.txt

2021-04-23 17:33  Model conversion config file path:/home/suryadi/modelzoo/yolo3_resnet18/device/yolo3_resnet18_config.json


I copy  from /home/suryadi/modelzoo/yolo3_resnet18/device/yolo3_resnet18.om into  /home/suryadi/samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video/model/


Strange, suddenly I can not choose build configuration correctly.

sssss


Which environment variable to check and the correct value for it?


I push the build icon

bb

Information:export DDK_PATH=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib && export NPU_HOST_LIB=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib/lib64/stub && export && cd /home/suryadi/samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video/build/intermediates && rm -rf * && cmake /home/suryadi/samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video -DCMAKE_BUILD_TYPE=Debug -DCMAKE_SKIP_RPATH=TRUE -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ && make && echo YOLOV3_coco_detection_video build successfully.


Error:src/CMakeFiles/main.dir/build.make:81: recipe for target 'src/CMakeFiles/main.dir/utils.cpp.o' failed

Error:make[2]: *** [src/CMakeFiles/main.dir/utils.cpp.o] Error 1

Error:CMakeFiles/Makefile2:112: recipe for target 'src/CMakeFiles/main.dir/all' failed

Error:make[1]: *** [src/CMakeFiles/main.dir/all] Error 2

Error:Makefile:148: recipe for target 'all' failed

Error:make: *** [all] Error 2

/home/suryadi/samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video

Error:/home/suryadi/samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video/src/../inc/utils.h:28:10: fatal error: acl/acl.h: No such file or directory


How to solve this problem?


Thank you very much in advance.


Warmest Regards,

Suryadi        


Featured Answers

Recommended answer

windyxyz
Created Apr 25, 2021 01:12:10

Hi, the error is ”fatal error: acl/acl.h: No such file or directory“
You may check src/Cmakelists.txt, make sure whether “include_directories” include acl/acl.h directory ? If not add it 。

include_directories(
$ENV{HOME}/ascend_ddk/${ARCH}/include/
$ENV{HOME}/ascend_ddk/${ARCH}/include/opencv4
${INC_PATH}/acllib/include/
../inc/
View more
  • x
  • convention:

All Answers
Thanks for contacting the Huawei community!

We are checking your question and will provide an answer to you shortly...
View more
  • x
  • convention:

Hi, the error is ”fatal error: acl/acl.h: No such file or directory“
You may check src/Cmakelists.txt, make sure whether “include_directories” include acl/acl.h directory ? If not add it 。

include_directories(
$ENV{HOME}/ascend_ddk/${ARCH}/include/
$ENV{HOME}/ascend_ddk/${ARCH}/include/opencv4
${INC_PATH}/acllib/include/
../inc/
View more
  • x
  • convention:

At src/CMakeList.txt, I add line 47

aa


Why I cannot select Target OS and Target Architecture at Build Configuration?

build


However, I still have src/.build_project

x

Is the .build_project correct?


I try to reinstall MindStudio 2.0.0 (beta)

tar -zxvf $HOME/Downloads/MS200/MindStudio_2.0.0-beta3_linux.tar.gz

But, it still give blank Target OS and Target Architecture.

I open another project such as 

/home/suryadi/samples/cplusplus/level2_simple_inference/1_classification/googlenet_imagenet_picture/

But, it still give blank Target OS and Target Architecture.


I think this export DDK_PATH should be set to 

DDK_PATH= /home/suryadi/Ascend/ascend-toolkit/latest/arm64-linux


How to set this build command?

Information:Build command: 

Information:

export DDK_PATH=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib && 

export NPU_HOST_LIB=/home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib/lib64/stub && 

export lang="C" &&

cd /home/suryadi/samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video/build/intermediates && 

rm -rf * && 

cmake /home/suryadi/samples/cplusplus/level2_simple_inference/2_object_detection/YOLOV3_coco_detection_video -DCMAKE_BUILD_TYPE=Debug -DCMAKE_SKIP_RPATH=TRUE -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ && 

make && 

echo YOLOV3_coco_detection_video build successfully.


The errors

eer


Information:[ 80%] Building CXX object src/CMakeFiles/main.dir/main.cpp.o

Information:[100%] Linking CXX executable ../../../out/main

Information:/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib/lib64/stub/libascendcl.so when searching for -lascendcl

Information:/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: cannot find -lascendcl

Information:/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /home/suryadi/Ascend/ascend-toolkit/20.2.rc1/acllib/lib64/stub/libacl_dvpp.so when searching for -lacl_dvpp

Information:/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: cannot find -lacl_dvpp

Information:/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/lib/libprotobuf.so when searching for -lprotobuf

Information:/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/lib/libprotobuf.a when searching for -lprotobuf

Error:collect2: error: ld returned 1 exit status

Error:src/CMakeFiles/main.dir/build.make:147: recipe for target '../../out/main' failed

Error:make[2]: *** [../../out/main] Error 1

Error:CMakeFiles/Makefile2:112: recipe for target 'src/CMakeFiles/main.dir/all' failed

Error:make[1]: *** [src/CMakeFiles/main.dir/all] Error 2

Error:Makefile:148: recipe for target 'all' failed

Error:make: *** [all] Error 2


How to solve this problem?

Thank you very much in advance.


Warmest Regards,

Suryadi

View more
  • x
  • convention:

Hi,It seems that  you didn‘t  configure MindStudio toolkit ?

You can refer to:

https://support.huaweicloud.com/intl/en-us/usermanual-mindstudio301/atlasms_02_0039.html


View more
  • x
  • convention:

Dear all,


I can run Model Converter inside MindStudio 3.0.1 and try to convert yolo3_resnet


co


The ATC run success.

ss


However, I try to run the YOLOV3_VOC_detection_picture program


[INFO]  load model ../model/yolo3_resnet18.om success

modelDesc_ = 0xaaaab688e740

modelId_ = /strong>


I change kModelHeight = 352 and  kModelWidth = 640 


The following is the yolo3_resnet18_config.json content:

{"convertConfig":{"advancedArgs":"--output_type=FP32 --save_original_model=false --log=info","aippBtnSelection":[{"aippButtonName":"images","aippCropBtnSelected":false,"aippMeanBtnSelected":true,"aippMinBtnSelected":false,"aippMultiplierBtnSelected":false,"aippOpenBtSelected":true,"aippPaddingBtnSelected":false,"aippPreImgBtnSelected":true,"aippResizeBtnSelected":false}],"aippData":[{"aippMode":"STATIC","bottomPaddingSize":"","crop":false,"cropH":"","cropStartX":"","cropStartY":"","cropW":"","enable":true,"inputImageFormat":"BGR888_U8","inputImageFormatShowValue":"BGR package","inputImageSizeH":"352","inputImageSizeW":"640","inputIndex":"0","leftPaddingSize":"","maxImageSize":"","meanLess0":"104","meanLess1":"117","meanLess2":"123","meanLess3":"","minChn0":"0.0","minChn1":"0.0","minChn2":"0.0","minChn3":"","modelImageFormat":"RGB","modelImageType":"BT_601NARROW","multiFactor0":"1.0","multiFactor1":"1.0","multiFactor2":"1.0","multiFactor3":"","padding":false,"resize":false,"resizeOutputH":"","resizeOutputW":"","rightPaddingSize":"","topPaddingSize":""}],"aippMode":"static","aippSelection":true,"autoTuneBtnSeleted":false,"autoTuneMode":"","batchList":[],"batchNum":"0","calData":[],"closeFusionRule":"false","customOpsPath":"","dynamicBatch":false,"dynamicBatchContent":"","dynamicImgSize":false,"dynamicImgSizeContent":"","encryptBtnSelection":true,"history":false,"historyItemName":"","inputFormat":"NHWC","inputFormatChooseEnable":true,"inputShape":[{"name":"images","number":"1","channel":"3","width":"640","height":"352","inputShape":"1,352,640,3","inputIndex":"0","inputType":"FP32","addByUser":false,"imagesFile":""}],"inputType":"FP32","inputTypeChanged":false,"markedNodes":[],"modelFilePath":"/home/suryadi/AscendProjects/output_Yolov3-Resnet18/frozen_graph/yolo3_resnet18.pb","modelName":"yolo3_resnet18","modelType":"TENSORFLOW","needAdvancedArgs":true,"outNodes":[],"outNodesItem":[],"outputFolderPath":"/home/suryadi/modelzoo/yolo3_resnet18","outputSoc":"Ascend310","outputType":"FP32","outputTypeSwitch":false,"pluginPath":"","quantParamFilePath":"","targetType":"DEVICE","weightFilePath":""},"name":"yolo3_resnet18_config"}


ff


However, it stuck at execture model failed, modelId is 1.


How to resolve this problem?


Thank you very much in advance.


Warmest Regards,

Suryadi

View more
  • x
  • convention:

Hi, your model is different with the sample which you use。 please refer to this sample:
https://gitee.com/ascend/samples/tree/master/python/level2_simple_inference/2_object_detection/YOLOV3_mask_detection_picture
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.