如果对深度学习感兴趣可以加我微信,互相交流(本人是做嵌入式的,但对深度学习感兴趣):15737978512
2017年6月29日更:
关于ive:
海思已经移植好了caffe库,而且提供了将pc训练好的模型转换为可以导入ive中运行的模型方法,具体参考如下文档:
sdk中ive开发包路径:Hi3519 V100R001C01SPC040\01.software\pc\IVE_CLIB\HiIVE_PC_V2.1.0.5.rar\HiIVE_PC_V2.1.0.5\
2017年6月27日更:
关于移植出现问题有网友已解决,
原因:
openblas库移植的有问题,由于3519浮点运算不支持函数的参数直接传递到FPU的寄存器(s0、d0)中(hard模式),而移植的openblas库使用的是hard模式。
解决方法:
3519浮点运算支持softfp模式,对应openblas分支如下,编译即可:
https://github.com/xianyi/OpenBLAS/tree/arm_soft_fp_abi
1.移植环境
2.移植步骤:
1)LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
2)BLAS ?= open
3)COMMON_FLAGS += -mcpu=cortex-a17.cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -mno-unaligned-access -fno-aggressive-loop-optimizations
1)CPU_ONLY := 1
2)OPENCV_VERSION := 3 #
3)CUSTOM_CXX := arm-hisiv500-linux-g++
4)BLAS := open
5)INCLUDE_DIRS := $(PYTHON_INCLUDE) /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/include /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/include /usr/local/include
96 LIBRARY_DIRS := $(PYTHON_LIB) /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/lib
6)#PYTHON_LIB := /usr/lib
7)USE_PKG_CONFIG := 1
3.移植问题汇总
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libboost_filesystem.so: warning: the use of OBSOLESCENT `utime' is discouraged, use `utimes'
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_video.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_shape.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_imgproc.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_shape.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_core.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_shape.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_objdetect.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_calib3d.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_features2d.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_flann.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_ml.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_highgui.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_videoio.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_imgcodecs.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_stitching.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: warning: ../../lib/libopencv_photo.so, needed by /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libopencv_videostab.so, not found (try using -rpath or -rpath-link)
CXX tools/convert_imageset.cpp
CXX/LD -o .build_release/tools/convert_imageset.bin
shunzhi@ubuntu:/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib$ arm-hisiv500-linux-readelf -d libopencv_shape.so
Dynamic section at offset 0x2f7c0 contains 30 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [../../lib/libopencv_video.so]
0x00000001 (NEEDED) Shared library: [../../lib/libopencv_imgproc.so]
0x00000001 (NEEDED) Shared library: [../../lib/libopencv_core.so]
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.0]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.0]
0x0000000c (INIT) 0x37a8
0x0000000d (FINI) 0x2b388
0x00000019 (INIT_ARRAY) 0x3f000
0x0000001b (INIT_ARRAYSZ) 32 (bytes)
0x0000001a (FINI_ARRAY) 0x3f020
0x0000001c (FINI_ARRAYSZ) 4 (bytes)
0x00000004 (HASH) 0xd4
0x00000005 (STRTAB) 0x10bc
0x00000006 (SYMTAB) 0x5ac
0x0000000a (STRSZ) 5274 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000003 (PLTGOT) 0x3f8d0
0x00000002 (PLTRELSZ) 872 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x3440
0x00000011 (REL) 0x26d8
0x00000012 (RELSZ) 3432 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x26b8
0x6fffffff (VERNEEDNUM) 1
0x6ffffff0 (VERSYM) 0x2556
0x6ffffffa (RELCOUNT) 234
0x00000000 (NULL) 0x0
解决方案:
mkdir ../../lib
cp libopencv* ../../lib
问题二描述:
CXX/LD -o .build_release/test/test_all.testbin src/caffe/test/test_caffe_main.cpp
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/local/lib/libboost_filesystem.so: warning: the use of OBSOLESCENT `utime' is discouraged, use `utimes'
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../lib/gcc/arm-hisiv500-linux-uclibcgnueabi/4.9.4/../../../../arm-hisiv500-linux-uclibcgnueabi/bin/ld: /opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../target/lib/libpthread.so.0: undefined reference to symbol 'dlclose'
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/../target/lib/libdl.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:606: recipe for target '.build_release/test/test_all.testbin' failed
make: *** [.build_release/test/test_all.testbin] Error 1
原因:缺少ptread,dl,rt库
解决方案:Makefile中添加这三个库。
183 LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 pthread dl rt
I0406 10:54:27.313168 722 net.cpp:242] This network produces output accuracy
I0406 10:54:27.313230 722 net.cpp:242] This network produces output loss
I0406 10:54:27.313371 722 net.cpp:255] Network initialization done.
I0406 10:54:27.314100 722 solver.cpp:56] Solver scaffolding done.
I0406 10:54:27.314471 722 caffe.cpp:248] Starting Optimization
I0406 10:54:27.314553 722 solver.cpp:273] Solving LeNet
I0406 10:54:27.314610 722 solver.cpp:274] Learning Rate Policy: inv
I0406 10:54:27.321142 722 solver.cpp:331] Iteration 0, Testing net (#0)
*** Aborted at 1491504867 (unix time) try "date -d @1491504867" if you are using GNU date ***
PC: @ 0xb6ea7c54 (unknown)
Segmentation fault
目前caffe和其依赖库已经移植完成,但是在训练数据时出现了错误(运行训练好的模型执行时也会出现这种问题),不知道是否由于依赖库的移植有问题,如果有遇到这种问题欢迎交流([email protected])。