Project update‎ > ‎

2012/11/29-David-Pedestrian detection at 100 frames per second的source code編譯

posted Nov 28, 2012, 8:53 AM by 梁仲偉
2012/11/29

因為前面有在前一篇中
進行source code網站編譯的第二步時會出現下列錯誤
islab@islab:~/doppia/src/applications/ground_estimation$ make
Linking CXX executable ground_estimation
/usr/bin/ld: CMakeFiles/ground_estimation.dir/home/islab/doppia/src/stereo_matching/ground_plane/GroundPlaneEstimator.cpp.o: undefined reference to symbol 'cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&)'
/usr/bin/ld: note: 'cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&)' is defined in DSO /usr/local/lib/libopencv_core.so.2.4 so try adding it to the linker command line
/usr/local/lib/libopencv_core.so.2.4: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [ground_estimation] Error 1
make[1]: *** [CMakeFiles/ground_estimation.dir/all] Error 2
make: *** [all] Error 2
 
然後今天跟宗霆討論後發現可能是
doppia/common_settings.cmake
內部設定問題
因此就仔細看了一下
發現第13行
site_name(HOSTNAME)
這邊有hostname
因此從網路搜尋是否linux上有這個設定
發現真的能找到目前電腦主機的名稱
另外因為我們不使用CUDA
因此我把common_settings.cmake內所有有關CUDA和CPU的設定全部刪掉
另外將原本88行
elseif(${HOSTNAME} STREQUAL "rodrigob-laptop")
改成
elseif(${HOSTNAME} STREQUAL  "ubuntu")
此外
liblinear_INCLUDE_DIRS和liblinear_LIBRARY_DIRS
這兩個路徑都設為
/home/islab/doppia/libs/liblinear-1.8
到此將common_settings.cmake改寫完成
重新進行編譯
同樣有
Linking CXX executable ground_estimation
/usr/bin/ld: CMakeFiles/ground_estimation.dir/home/islab/doppia/src/stereo_matching/ground_plane/GroundPlaneEstimator.cpp.o: undefined reference to symbol 'cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&)'
/usr/bin/ld: note: 'cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&)' is defined in DSO /usr/local/lib/libopencv_core.so.2.4 so try adding it to the linker command line
/usr/local/lib/libopencv_core.so.2.4: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [ground_estimation] Error 1
make[1]: *** [CMakeFiles/ground_estimation.dir/all] Error 2
make: *** [all] Error 2
 
再從網路上找答案
發現我的錯誤可能是少加-lopencv_core選項
因此我想說將common_settings.cmake中20行內
set(OPT_CXX_FLAGS "-fopenmp -ffast-math -funroll-loops -march=native")加入-lopencv_core變成
set(OPT_CXX_FLAGS "-lopencv_core -fopenmp -ffast-math -funroll-loops -march=native")
 
再重新編譯
出現下列錯誤
/usr/bin/ld: CMakeFiles/ground_estimation.dir/home/islab/doppia/src/stereo_matching/ground_plane/GroundPlaneEstimator.cpp.o: undefined reference to symbol 'cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&)'
/usr/bin/ld: note: 'cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&)' is defined in DSO /usr/local/lib/libopencv_core.so so try adding it to the linker command line
/usr/local/lib/libopencv_core.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [ground_estimation] Error 1
make[1]: *** [CMakeFiles/ground_estimation.dir/all] Error 2
make: *** [all] Error 2
發現還是有錯誤
因此我就亂加一些opencv的lib
但發現都沒法解
因此我覺得應該不是在common_settings.cmake中加入-lopencv_core就能解決
 
因此我猜測是source code第二步驟編譯的目錄ground_estimation目錄內的config.make檔有問題
因此去查看ground_estimation目錄中是否有相關的.make檔案
 
 在doppia/src/applications/ground_estimation找到CMakeLists.txt檔
猜測這個檔案是因為宗霆說Cmake的設定黨會放在此類文字黨內
因此進去裡面查看
檔案中第129行查看到
${opencv_LIBRARIES} opencv_legacy
猜測這個是用來調用opencv library的設定
可是這個地方只有opencv_legacy
猜測是不是這就是代表全部opencv的library
因此在網路上搜尋opencv_legacy
發現好像不只opencv_legacy
因此把前面錯誤中的
/usr/local/lib/libopencv_core.so.2.4
要加入
因此我加入
opencv_core
從新編譯
出現錯誤
/usr/bin/ld: CMakeFiles/ground_estimation.dir/home/islab/doppia/src/image_processing/OpenCvLinesDetector.cpp.o: undefined reference to symbol 'cv::HoughLines(cv::_InputArray const&, cv::_OutputArray const&, double, double, int, double, double)'
/usr/bin/ld: note: 'cv::HoughLines(cv::_InputArray const&, cv::_OutputArray const&, double, double, int, double, double)' is defined in DSO /usr/local/lib/libopencv_imgproc.so.2.4 so try adding it to the linker command line
/usr/local/lib/libopencv_imgproc.so.2.4: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [ground_estimation] Error 1
make[1]: *** [CMakeFiles/ground_estimation.dir/all] Error 2
make: *** [all] Error 2
出現不同的opencv錯誤
猜測此解決方向是對的
因此在CMakeLists.txt的129行再加入opencv_imgproc
再次編譯
出現下列錯誤
 /usr/bin/ld: CMakeFiles/ground_estimation.dir/home/islab/doppia/src/stereo_matching/OpenCvStereo.cpp.o: undefined reference to symbol 'cv::StereoBM::init(int, int, int)'
/usr/bin/ld: note: 'cv::StereoBM::init(int, int, int)' is defined in DSO /usr/local/lib/libopencv_calib3d.so.2.4 so try adding it to the linker command line
/usr/local/lib/libopencv_calib3d.so.2.4: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [ground_estimation] Error 1
make[1]: *** [CMakeFiles/ground_estimation.dir/all] Error 2
make: *** [all] Error 2
在CMakeLists.txt的129行再加入opencv_calib3d
再次編譯
成功解決
[100%] Built target ground_estimation
編譯成功
出現ground_estimation執行檔
 
根據source code步驟二說明
進行執行
./ground_estimation -c test.config.ini
 
結果能成功執行
執行圖
 
執行後訊息
islab@ubuntu:~/doppia/src/applications/ground_estimation$ ./ground_estimation -c test.config.ini
Ground estimation. Rodrigo Benenson @ KULeuven. 2010-2011.
Parsed the configuration file test.config.ini
Overwriting existing log file stixel_world.out.txt
Using stereo camera calibration file: ../../video_input/calibration/stereo_calibration_bahnhof.proto.txt
2012-11-28 08:57:22 {0x95a6a50} [ StereoCameraCalibration ] : stereo_calibration_data name: Andreas Ess Bahnhofstrasse sequence stereo calibration
Reading files:
../../../data/sample_test_images/bahnhof/image_00000000_0.png
../../../data/sample_test_images/bahnhof/image_00000000_1.png
User interface keyboards inputs:
 pause   the application with  SPACE or P
 quit   the application with  ESC, Q or closing the window
 screenshots  are saved with  S
 view_mode  is changed with  1, 2, 3, etc.
Average iteration speed  15.3483 [Hz] (in the last 10 iterations)
Requested frame number 11 but frames should be in range (0, 10)
Processed a total of 10 input frames
End of game, have a nice day.
 
進行第二步第4點編譯
編譯doppia/src/applications/stixel_world
cmake . 
make -j4
OMP_NUM_THREADS=4 ./stixel_world -c fast.config.ini --gui.disable false
 
執行後的圖
 
 
執行後訊息
islab@ubuntu:~/doppia/src/applications/stixel_world$ OMP_NUM_THREADS=4 ./stixel_world -c fast.config.ini --gui.disable false
Stixel world scene understanding. Rodrigo Benenson @ KULeuven. 2010-2011.
Parsed the configuration file fast.config.ini
Using stereo camera calibration file: ../../video_input/calibration/stereo_calibration_bahnhof.proto.txt
Reading files:
../../../data/sample_test_images/bahnhof/image_00000000_0.png
../../../data/sample_test_images/bahnhof/image_00000000_1.png
User interface keyboards inputs:
 pause   the application with  SPACE or P
 quit   the application with  ESC, Q or closing the window
 screenshots  are saved with  S
 view_mode  is changed with  1, 2, 3, etc.
The application is running in silent mode. No information will be printed until all the frames have been processed.
Requested frame number 11 but frames should be in range (0, 10)
Processed a total of 10 input frames
Average stixel world estimation speed per iteration 44.03 [Hz] (in the last 10 iterations)
End of game, have a nice day.
 
 
另一種執行方式
OMP_NUM_THREADS=4 ./stixel_world -c fast_uv.config.ini --gui.disable false
 
僅有執行後訊息
islab@ubuntu:~/doppia/src/applications/stixel_world$ OMP_NUM_THREADS=4 ./stixel_world -c fast_uv.config.ini --gui.disable false
Stixel world scene understanding. Rodrigo Benenson @ KULeuven. 2010-2011.
Parsed the configuration file fast_uv.config.ini
Using stereo camera calibration file: ../../video_input/calibration/stereo_calibration_bahnhof.proto.txt
Reading files:
../../../data/sample_test_images/bahnhof/image_00000000_0.png
../../../data/sample_test_images/bahnhof/image_00000000_1.png
Segmentation fault (core dumped)
 
 
 
進行source code所說的第三步編譯
嘗試是否能成功
結果出現下列錯誤
islab@ubuntu:~/doppia/src/applications/objects_detection$ cmake ./
-- Using rodrigob-laptop optimisation options
-- Configuring done
-- Generating done
-- Build files have been written to: /home/islab/doppia/src/applications/objects_detection
islab@ubuntu:~/doppia/src/applications/objects_detection$ make -j4
[  0%] Building CXX object CMakeFiles/cpp_stuff_library.dir/ObjectsDetectionApplication.cpp.o
[  2%] [  2%] [  3%] Building CXX object CMakeFiles/cpp_stuff_library.dir/ObjectsDetectionGui.cpp.o
Building CXX object CMakeFiles/cpp_stuff_library.dir/draw_the_detections.cpp.o
Building CXX object CMakeFiles/cpp_stuff_library.dir/home/islab/doppia/src/objects_detection/AbstractObjectsDetector.cpp.o
In file included from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:5:0,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractModelWindowToObjectWindowConverter.hpp:5,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractObjectsDetector.hpp:6,
                 from /home/islab/doppia/src/applications/objects_detection/draw_the_detections.hpp:4,
                 from /home/islab/doppia/src/applications/objects_detection/draw_the_detections.cpp:1:
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:90:17: error: expected unqualified-id before numeric constant
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:90:17: error: expected ‘)’ before numeric constant
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:116:1: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:124:7: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
In file included from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractModelWindowToObjectWindowConverter.hpp:5:0,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractObjectsDetector.hpp:6,
                 from /home/islab/doppia/src/applications/objects_detection/draw_the_detections.hpp:4,
                 from /home/islab/doppia/src/applications/objects_detection/draw_the_detections.cpp:1:
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:32:13: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:25: error: ‘fast_stage_t’ was not declared in this scope
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:37: error: template argument 1 is invalid
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:37: error: template argument 2 is invalid
In file included from /home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:5:0,
                 from /home/islab/doppia/src/objects_detection/AbstractModelWindowToObjectWindowConverter.hpp:5,
                 from /home/islab/doppia/src/objects_detection/AbstractObjectsDetector.hpp:6,
                 from /home/islab/doppia/src/objects_detection/AbstractObjectsDetector.cpp:1:
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:90:17: error: expected unqualified-id before numeric constant
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:90:17: error: expected ‘)’ before numeric constant
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:116:1: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:124:7: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
In file included from /home/islab/doppia/src/objects_detection/AbstractModelWindowToObjectWindowConverter.hpp:5:0,
                 from /home/islab/doppia/src/objects_detection/AbstractObjectsDetector.hpp:6,
                 from /home/islab/doppia/src/objects_detection/AbstractObjectsDetector.cpp:1:
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:32:13: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:25: error: ‘fast_stage_t’ was not declared in this scope
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:37: error: template argument 1 is invalid
/home/islab/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:37: error: template argument 2 is invalid
make[2]: *** [CMakeFiles/cpp_stuff_library.dir/draw_the_detections.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/integral_channels/GpuIntegralChannelsForPedestrians.hpp:15:0,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/GpuIntegralChannelsDetector.hpp:4,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/GpuVeryFastIntegralChannelsDetector.hpp:4,
                 from /home/islab/doppia/src/applications/objects_detection/ObjectsDetectionGui.cpp:24:
/home/islab/doppia/src/applications/objects_detection/../../../libs/cudatemplates/include/cudatemplates/devicememorypitched.hpp:25:26: fatal error: cuda_runtime.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/cpp_stuff_library.dir/ObjectsDetectionGui.cpp.o] Error 1
make[2]: *** [CMakeFiles/cpp_stuff_library.dir/home/islab/doppia/src/objects_detection/AbstractObjectsDetector.cpp.o] Error 1
In file included from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:5:0,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractModelWindowToObjectWindowConverter.hpp:5,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractObjectsDetector.hpp:6,
                 from /home/islab/doppia/src/applications/objects_detection/ObjectsDetectionGui.hpp:5,
                 from /home/islab/doppia/src/applications/objects_detection/ObjectsDetectionApplication.cpp:7:
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:90:17: error: expected unqualified-id before numeric constant
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:90:17: error: expected ‘)’ before numeric constant
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:116:1: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsFastStage.hpp:124:7: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
In file included from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractModelWindowToObjectWindowConverter.hpp:5:0,
                 from /home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/AbstractObjectsDetector.hpp:6,
                 from /home/islab/doppia/src/applications/objects_detection/ObjectsDetectionGui.hpp:5,
                 from /home/islab/doppia/src/applications/objects_detection/ObjectsDetectionApplication.cpp:7:
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:32:13: error: ‘SoftCascadeOverIntegralChannelsFastStage’ does not name a type
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:25: error: ‘fast_stage_t’ was not declared in this scope
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:37: error: template argument 1 is invalid
/home/islab/doppia/src/applications/objects_detection/../../../src/objects_detection/SoftCascadeOverIntegralChannelsModel.hpp:33:37: error: template argument 2 is invalid
make[2]: *** [CMakeFiles/cpp_stuff_library.dir/ObjectsDetectionApplication.cpp.o] Error 1
make[1]: *** [CMakeFiles/cpp_stuff_library.dir/all] Error 2
make: *** [all] Error 2
 
 
Comments