PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.81k stars 2.89k forks source link

求助 deploy c++部署 jetson nano平台无法完成编译 #2296

Closed EasitMickly closed 3 years ago

EasitMickly commented 3 years ago

运行 sh ./scripts/build.sh报错如下: 望大佬帮助。

-- The CXX compiler identification is GNU 7.5.0 -- The C compiler identification is GNU 7.5.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Found Git: /usr/bin/git (found version "2.17.1")

-- Found OpenCV: /usr (found version "4.1.1") -- Configuring done -- Generating done -- Build files have been written to: /home/easitmickly/Detection/build Scanning dependencies of target ext-yaml-cpp [ 8%] Creating directories for 'ext-yaml-cpp' [ 16%] Performing download step (download, verify and extract) for 'ext-yaml-cpp' -- ext-yaml-cpp download command succeeded. See also /home/easitmickly/Detection/build/ext/yaml-cpp/src/ext-yaml-cpp-stamp/ext-yaml-cpp-download-.log [ 25%] No patch step for 'ext-yaml-cpp' [ 33%] No update step for 'ext-yaml-cpp' [ 41%] Performing configure step for 'ext-yaml-cpp' -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test FLAG_WEXTRA -- Performing Test FLAG_WEXTRA - Success -- Configuring done -- Generating done -- Build files have been written to: /home/easitmickly/Detection/build/ext/yaml-cpp/src/ext-yaml-cpp-build [ 50%] Performing build step for 'ext-yaml-cpp' -- ext-yaml-cpp build command succeeded. See also /home/easitmickly/Detection/build/ext/yaml-cpp/src/ext-yaml-cpp-stamp/ext-yaml-cpp-build-.log [ 58%] No install step for 'ext-yaml-cpp' [ 66%] Completed 'ext-yaml-cpp' [ 66%] Built target ext-yaml-cpp Scanning dependencies of target main [ 75%] Building CXX object CMakeFiles/main.dir/src/main.cc.o /home/easitmickly/Detection/src/main.cc:34:14: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_string(model_dir, "", "Path of inference model"); ^ /home/easitmickly/Detection/src/main.cc:35:14: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_string(image_path, "", "Path of input image"); ^ /home/easitmickly/Detection/src/main.cc:36:14: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_string(video_path, "", "Path of input video"); ^ /home/easitmickly/Detection/src/main.cc:37:12: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_bool(use_gpu, false, "Infering with GPU or CPU"); ^ /home/easitmickly/Detection/src/main.cc:38:12: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_bool(use_camera, false, "Use camera or not"); ^ /home/easitmickly/Detection/src/main.cc:39:14: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_string(run_mode, "fluid", "Mode of running(fluid/trt_fp32/trt_fp16)"); ^ /home/easitmickly/Detection/src/main.cc:40:13: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_int32(gpu_id, 0, "Device id of GPU to execute"); ^ /home/easitmickly/Detection/src/main.cc:41:13: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_int32(camera_id, -1, "Device id of camera to predict"); ^ /home/easitmickly/Detection/src/main.cc:42:12: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_bool(run_benchmark, false, "Whether to predict a image_file repeatedly for benchmark"); ^ /home/easitmickly/Detection/src/main.cc:43:14: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_double(threshold, 0.5, "Threshold of score."); ^ /home/easitmickly/Detection/src/main.cc:44:14: error: expected constructor, destructor, or type conversion before ‘(’ token DEFINE_string(output_dir, "output", "Directory of output visualization files."); ^ /home/easitmickly/Detection/src/main.cc: In function ‘void PredictVideo(const string&, PaddleDetection::ObjectDetector)’: /home/easitmickly/Detection/src/main.cc:91:7: error: ‘FLAGS_camera_id’ was not declared in this scope if (FLAGS_camera_id != -1){ ^~~~~~~ /home/easitmickly/Detection/src/main.cc:102:50: error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope int video_width = static_cast(capture.get(CV_CAP_PROP_FRAME_WIDTH)); ^~~~~~~ /home/easitmickly/Detection/src/main.cc:103:51: error: ‘CV_CAP_PROP_FRAME_HEIGHT’ was not declared in this scope int video_height = static_cast(capture.get(CV_CAP_PROP_FRAME_HEIGHT)); ^~~~~~~~ /home/easitmickly/Detection/src/main.cc:104:48: error: ‘CV_CAP_PROP_FPS’ was not declared in this scope int video_fps = static_cast(capture.get(CV_CAP_PROP_FPS)); ^~~~~~~ /home/easitmickly/Detection/src/main.cc:104:48: note: suggested alternative: ‘CV_CPU_POPCNT’ int video_fps = static_cast(capture.get(CV_CAP_PROP_FPS)); ^~~~~~~ CV_CPU_POPCNT /home/easitmickly/Detection/src/main.cc:106:13: error: ‘VideoWriter’ has not been declared int codec=VideoWriter::fourcc('m','p','4','v'); ^~~ /home/easitmickly/Detection/src/main.cc: In function ‘void PredictImage(const string&, double, bool, PaddleDetection::ObjectDetector, const string&)’: /home/easitmickly/Detection/src/main.cc:180:34: error: ‘CV_IMWRITE_JPEG_QUALITY’ was not declared in this scope compression_params.push_back(CV_IMWRITE_JPEG_QUALITY); ^~~~~~~ /home/easitmickly/Detection/src/main.cc: In function ‘int main(int, char)’: /home/easitmickly/Detection/src/main.cc:194:11: error: ‘ParseCommandLineFlags’ is not a member of ‘google’ google::ParseCommandLineFlags(&argc, &argv, true); ^~~~~ /home/easitmickly/Detection/src/main.cc:195:7: error: ‘FLAGS_model_dir’ was not declared in this scope if (FLAGS_model_dir.empty() ^~~~~~~ /home/easitmickly/Detection/src/main.cc:196:11: error: ‘FLAGS_image_path’ was not declared in this scope || (FLAGS_image_path.empty() && FLAGS_video_path.empty())) { ^~~~ /home/easitmickly/Detection/src/main.cc:196:39: error: ‘FLAGS_video_path’ was not declared in this scope || (FLAGS_image_path.empty() && FLAGS_video_path.empty())) { ^~~~ /home/easitmickly/Detection/src/main.cc:201:9: error: ‘FLAGS_run_mode’ was not declared in this scope if (!(FLAGS_run_mode == "fluid" || FLAGS_run_mode == "trt_fp32" ^~~~~~ /home/easitmickly/Detection/src/main.cc:208:39: error: ‘FLAGS_model_dir’ was not declared in this scope PaddleDetection::ObjectDetector det(FLAGS_model_dir, FLAGS_use_gpu, ^~~~~~~ /home/easitmickly/Detection/src/main.cc:208:56: error: ‘FLAGS_use_gpu’ was not declared in this scope PaddleDetection::ObjectDetector det(FLAGS_model_dir, FLAGS_use_gpu, ^~~~~ /home/easitmickly/Detection/src/main.cc:209:5: error: ‘FLAGS_run_mode’ was not declared in this scope FLAGS_run_mode, FLAGS_gpu_id); ^~~~~~ /home/easitmickly/Detection/src/main.cc:209:21: error: ‘FLAGS_gpu_id’ was not declared in this scope FLAGS_run_mode, FLAGS_gpu_id); ^~~~ /home/easitmickly/Detection/src/main.cc:211:8: error: ‘FLAGS_video_path’ was not declared in this scope if (!FLAGS_video_path.empty() || FLAGS_use_camera) { ^~~~ /home/easitmickly/Detection/src/main.cc:211:36: error: ‘FLAGS_use_camera’ was not declared in this scope if (!FLAGS_video_path.empty() || FLAGS_use_camera) { ^~~~ /home/easitmickly/Detection/src/main.cc:213:15: error: ‘FLAGS_image_path’ was not declared in this scope } else if (!FLAGS_image_path.empty()) { ^~~~ /home/easitmickly/Detection/src/main.cc:214:21: error: ‘FLAGS_output_dir’ was not declared in this scope if (!PathExists(FLAGS_output_dir)) { ^~~~ /home/easitmickly/Detection/src/main.cc:217:36: error: ‘FLAGS_threshold’ was not declared in this scope PredictImage(FLAGS_image_path, FLAGS_threshold, FLAGS_run_benchmark, &det, FLAGS_output_dir); ^~~~~~~ /home/easitmickly/Detection/src/main.cc:217:53: error: ‘FLAGS_run_benchmark’ was not declared in this scope PredictImage(FLAGS_image_path, FLAGS_threshold, FLAGS_run_benchmark, &det, FLAGS_output_dir); ^~~~~~~ /home/easitmickly/Detection/src/main.cc:217:80: error: ‘FLAGS_output_dir’ was not declared in this scope PredictImage(FLAGS_image_path, FLAGS_threshold, FLAGS_run_benchmark, &det, FLAGS_output_dir); ^~~~ CMakeFiles/main.dir/build.make:62: recipe for target 'CMakeFiles/main.dir/src/main.cc.o' failed make[2]: ** [CMakeFiles/main.dir/src/main.cc.o] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/main.dir/all' failed make[1]: [CMakeFiles/main.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 make finished!

liuhuiCNN commented 3 years ago

你好,已经验证2.0-rc是可以正常编译的。请问用的是2.0-rc的原始代码吗?如有改动,请检查改动是否正确,是否缺少 } 或 )。

EasitMickly commented 3 years ago

你好,已经验证2.0-rc是可以正常编译的。请问用的是2.0-rc的原始代码吗?如有改动,请检查改动是否正确,是否缺少 } 或 )。

您好,我是按照这篇教程(https://zhuanlan.zhihu.com/p/319371293)来操作的,又使用未更改的源码进行编译,还是相同的问题,请您再帮我看看,谢谢

liuhuiCNN commented 3 years ago

请检查:(1)使用的硬件平台是TX2还是nano?(2) gcc版本符合要求吗?(3)paddle预测库版本符合要求吗? 可参考文档:https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/05_inference_deployment/inference/build_and_install_lib_cn.html https://paddleinference.paddlepaddle.org.cn/product_introduction/inference_intro.html

CHNingMing commented 3 years ago

我也遇到了相同问题,他是使用了gflags,在源码main.cc添加#include <gflags/gflags.h>解决问题