当前位置:网站首页>Huawei ascend910 running yolov3 tutorial
Huawei ascend910 running yolov3 tutorial
2022-07-19 10:01:00 【Flower boy】
One 、 Key steps
Download the source code : ACL_YOLOV3
1.1 install opencv
Install compiled opencv Static link library .
1.1.1 download
link :https://pan.baidu.com/s/1sdCsP3_NU48Nz8PYw-wpkg
Extraction code :1234perhaps
link : https://pan.baidu.com/s/1Z8sGoSI3eqUfime9aF5wSQ password : r80o
1.1.2 decompression
decompression opencv Compress the package to the specified directory , for example :/home/ma-user/work/opencv-4.5.1.
1.2 modify CMakeLists.txt
# modify OpenCV_DIR route
# OpenCV_DIR Directory contains OpenCVConfig.cmake
set(OpenCV_DIR /home/ma-user/work/opencv-4.5.1/lib/cmake/opencv4)
# Find OpenCV, you may need to set OpenCV_DIR variable
# to the absolute path to the directory containing OpenCVConfig.cmake file
# via the command line or GUI
find_package(OpenCV REQUIRED)
# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
if(${OPENCV_FOUND})
message(STATUS "OpenCV version: ${OpenCV_VERSION}")
message(STATUS "OpenCV include path: ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV libraries: ${OpenCV_LIBS}")
endif()
# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})
# modify ACL_PATH route
set(ACL_PATH /home/ma-user/Ascend/ascend-toolkit/latest)
1.3 Model transformation
1.3.1 Model download
https://pan.baidu.com/s/1yiCrnmsOm0hbweJBiiUScQ
perhaps
link :https://pan.baidu.com/s/1xZ2UuQAchtnpVrcCO6zQPA
Extraction code :1234
1.3.2 modify prototxt The configuration file
Modify completely according to the template :YOLOv3 A network model prototxt modify
upsample operator upsample_param Attribute parameter modification ;
Two changes .
Add three Yolo operator ;
Add the last layer YoloV3DetectionOutput operator ;
New input ;
Original input :
input: "data" input_shape { dim: 1 dim: 3 dim: 416 dim: 416 }New input :
input: "img_info" input_shape { dim: 1 dim: 4 }
1.3.3 modify aipp The configuration file
Don't modify .
1.3.4 Model transformation
cd yolov3
atc --model=./yolov3.prototxt \
--weight=./yolov3.caffemodel \
--framework=0 \
--output=./yolov3_aipp \
--output_type=FP32 \
--soc_version=Ascend910 \
--insert_op_conf=./aipp_yolov3.cfg
1.4 The successful running
[[email protected] acl_yolov3]$ ./ACL_YOLOV3 ./data/model/yolov3_aipp.om ./test.jpg
acl init successfully
Create context successfully
set context successfully
Create stream successfully
ModelProcess:Begin to init instance.
finish init AclProcess
ModelProcess:Begin to inference.
begin postprocess
The number of output buffers of yolov3 model is 2
Object detected number is 1
#Obj0, box(427.5, 424.25, 1513, 851.5) confidence: 1 lable: 2
model run success!
cost time : 18.924ms
ModelProcess:Begin to deinit instance.
ModelProcess:Finished deinit instance.
all tasks in stream done
Destroy Stream successfully
Destroy Context successfully
acl deinit successfully
Two 、FAQ
Q: The lack of -fPIC
/usr/bin/ld: CMakeFiles/ACL_YOLOV3.dir/main.cpp.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `[email protected]@GLIBCXX_3.4' which may bind externally can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: CMakeFiles/ACL_YOLOV3.dir/main.cpp.o(.text+0x2c): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `[email protected]@GLIBCXX_3.4'
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ACL_YOLOV3.dir/build.make:144: ../ACL_YOLOV3] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/ACL_YOLOV3.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
terms of settlement :
modify CMakeLists.txt
add_definitions(-fPIC)
Q: The lack of dlsym
/usr/bin/ld: /home/ma-user/work/opencv-4.5.1/lib/libopencv_core.a(filesystem.cpp.obj): in function `cv::plugin::impl::DynamicLib::getSymbol(char const*) const': filesystem.cpp:(.text._ZNK2cv6plugin4impl10DynamicLib9getSymbolEPKc+0x8): undefined reference to `dlsym' /usr/bin/ld: /home/ma-user/work/opencv-4.5.1/lib/libopencv_core.a(filesystem.cpp.obj): in function `cv::plugin::impl::DynamicLib::libraryLoad(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
filesystem.cpp:(.text._ZN2cv6plugin4impl10DynamicLib11libraryLoadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x3c): undefined reference to `dlopen' /usr/bin/ld: /home/ma-user/work/opencv-4.5.1/lib/libopencv_core.a(filesystem.cpp.obj): in function `cv::plugin::impl::DynamicLib::libraryRelease()': filesystem.cpp:(.text._ZN2cv6plugin4impl10DynamicLib14libraryReleaseEv+0x3b4): undefined reference to `dlclose'
/usr/bin/ld: /home/ma-user/work/opencv-4.5.1/lib/libopencv_core.a(datafile.cpp.obj): in function `cv::utils::getModuleLocation(void const*)': datafile.cpp:(.text._ZN2cv5utilsL17getModuleLocationEPKv+0x2c): undefined reference to `dladdr' /usr/bin/ld: /home/ma-user/work/opencv-4.5.1/lib/libopencv_core.a(datafile.cpp.obj): in function `cv::utils::getBinLocation(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
datafile.cpp:(.text._ZN2cv5utils14getBinLocationERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x30): undefined reference to `dladdr'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ACL_YOLOV3.dir/build.make:144: ../ACL_YOLOV3] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/ACL_YOLOV3.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
terms of settlement :
modify CMakeLists.txt, add to dl
target_link_libraries(${PROJECT_NAME} ascendcl ${OpenCV_LIBS} pthread -Wl,-z,relro,-z,now,-z,noexecstack -pie -s stdc++)
It is amended as follows
target_link_libraries(${PROJECT_NAME} ascendcl ${OpenCV_LIBS} pthread -Wl,-z,relro,-z,now,-z,noexecstack -pie -s stdc++ dl)
Q: The lack of acl.json file
[[email protected] acl_yolov3]$ ./ACL_YOLOV3 ./data/model/yolov3_aipp.om ./test.jpg
Failed to init acl, ret = 100003
AclProcess Init faild.
some tasks in stream not done, ret = 107002
all tasks in stream done
Destroy Stream faild, ret = 100000
Destroy Stream successfully
Destroy Context faild, ret = 100000
Destroy Context successfully
acl deinit successfully
The reason for the error :
The lack of acl.json file , Lead to aclInit initialization failed
terms of settlement :
aclError ret = aclprocess.Init(0,"./data/acl.json",argv[1]);
Change it to
aclError ret = aclprocess.Init(0,"",argv[1]);
Q: The saved picture cannot be displayed
The reason for the error :
As a result of opencv Static link library , Lead to jpg Encoder cannot be used ( The function is not complete )
terms of settlement :
Use png Format save picture
imwrite("result.jpg",img);
Change it to
imwrite("result.png",img);
边栏推荐
- Chapter 13 set/ multiset of STL
- 自己创建的模块 使用cmd打开报 ModuleNotFoundError: No module named 解决方案
- set、vector与list的构造与排序的耗时测试
- 氮杂环分子改性UiO-66-NH2|聚乙烯亚胺改性UiO-66-NH2|[email protected]@ZIF67纳米材料
- 第4章-一阶多智体系统一致性 -> 领航跟随系统一致性【程序代码】
- 金纳米粒子修饰MIL-101骨架材料(AuNPs/MIL-101)/负载COF-TpPa-1(Au NPs/COF-TpPa-1)|齐岳试剂
- Conversion between two-dimensional array and sparse array
- 565. 数组嵌套 / 剑指 Offer II 001. 整数除法
- Fiddler replay attack, simple simulated replay attack
- Construction practice of pipeline engine of engineering efficiency ci/cd
猜你喜欢

CLWY权限管理(一)--- 项目搭建

第4章-一阶多智体系统一致性 -> 领航跟随系统一致性

Part I - Fundamentals of C language_ 5. Arrays and strings

Convert video format to GIF picture format

SSH连接华为ModelArts notebook

卫星网络中基于时变图的节能资源分配策略

Anaconda and jupyter notebook entry level detailed tutorial

数组模拟队列

fiddler 重放攻击,简单的模拟重放攻击
[email protected]纳米复合材料|ZIF-8/聚偏氟乙烯复合纳米纤维膜PVDF"/>mof定制材料|双金属CuNi-MOF纳米材料|核—壳结构[email protected]纳米复合材料|ZIF-8/聚偏氟乙烯复合纳米纤维膜PVDF
随机推荐
TLS四次握手
Clwy permission management (I) -- project construction
金属有机骨架材料/聚合物复合材料ZIF-8/P(TDA-co-HDA)|氧化锌[email protected](Fe)复合纳米材料
Rhcsa the next day 7.15
pfSense配置Tailscal站点到站点连接
JS 之 操作 String 字符串
CLWY权限管理(三)--- 用户组模块
Memory LDA LDA in Blas level-3 sgemm cublesgemmex cubulassgemm
Chapter 4 - first order multi-agent system consistency - > continuous time system consistency with time delay [program code]
Series operation of vector container (detailed explanation)
[C language] data type and meaning
Why is SaaS so important for enterprise digital transformation?
Relationship between standardization, normalization and regularization
18、shell脚本编程(1)
Mux256to1v,Hadd,Fadd
程序员成长第二十一篇:做任务分配时,要考虑员工的成长。
Brilliant use output
mof定制材料|双金属CuNi-MOF纳米材料|核—壳结构[email protected]纳米复合材料|ZIF-8/聚偏氟乙烯复合纳米纤维膜PVDF
[动态规划]DP27 跳跃游戏(二)-中等
金属有机骨架/碳化氮纳米片(UiO-66/HOCN)复合材料|MIL-101负载Au-Pd合金纳米粒子|化学试剂mof定制