【AIWIN 提问-极市开发平台使用】+ 测试 SDK 那里的编译的问题

比赛 acci ⋅ 于 8个月前 ⋅ 最后回复由 sophie 8个月前 ⋅ 651 阅读

问题1

我把-DUSE_PYTHON_API=OFF 改成 ON,可以test -ji - 还是一直在调用c++的代码
【换成官方的demo可以用python api】

问题2 可是,换成官方的tf demo之后用不了c++

想用libtorch试一下,结果不行

-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/ev_sdk/build
[ 28%] Built target cjson
Scanning dependencies of target ji
[ 42%] Building CXX object CMakeFiles/ji.dir/src/ji.cpp.o
In file included from /usr/local/ev_sdk/src/ji.cpp:18:0:
/usr/local/ev_sdk/include/SampleClassifierImpl.hpp:10:26: fatal error: torch/script.h: No such file or directory
compilation terminated.
CMakeFiles/ji.dir/build.make:62: recipe for target 'CMakeFiles/ji.dir/src/ji.cpp.o' failed
make[2]: *** [CMakeFiles/ji.dir/src/ji.cpp.o] Error 1
CMakeFiles/Makefile2:110: recipe for target 'CMakeFiles/ji.dir/all' failed
make[1]: *** [CMakeFiles/ji.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

然后用官方的demo直接编译,也不行
我想了一下,pytorch的镜像没有tf还挺正常的,那为什么没有torch/torch.h呢

-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/ev_sdk/build
[ 28%] Built target cjson
Scanning dependencies of target ji
[ 42%] Building CXX object CMakeFiles/ji.dir/src/ji.cpp.o
In file included from /usr/local/ev_sdk/src/ji.cpp:18:0:
/usr/local/ev_sdk/include/SampleClassifierImpl.hpp:8:32: fatal error: tensorflow/c/c_api.h: No such file or directory
compilation terminated.
CMakeFiles/ji.dir/build.make:62: recipe for target 'CMakeFiles/ji.dir/src/ji.cpp.o' failed
make[2]: *** [CMakeFiles/ji.dir/src/ji.cpp.o] Error 1
CMakeFiles/Makefile2:110: recipe for target 'CMakeFiles/ji.dir/all' failed
make[1]: *** [CMakeFiles/ji.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error

看起来都有啊, 不太懂c++

root:~/train/src_repo  master ✔                                                                                                                                         9m  
▶ find / -name 'torch.h' 
/opt/libtorch/include/torch/csrc/api/include/torch/torch.h
/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/torch.h

root:~/train/src_repo  master ✔                                                                                                                                        10m  
▶ find / -name 'script.h'
/opt/libtorch/include/torch/script.h
/usr/local/lib/python3.6/dist-packages/torch/include/torch/script.h

要改环境变量?

把CMakeLists.txt 改了 编译通过,但是有很多警告

问题3,换了很多张图片 测试结果都一样

[【官方的demo没问题】

问题4,怎么在构建镜像的时候选择c++

【看官方教程】

ps:本地环境的编译的脚本

mkdir -p /usr/local/ev_sdk/build
cd /usr/local/ev_sdk/build
cmake -DUSE_PYTHON_API=OFF ..
make install

成为第一个点赞的人吧 :bowtie:
回复数量: 3
您需要登陆以后才能留下评论!