(與本節內容無關///////////////////////////保存圖片參數爲—-gui.save_all_screenshots true////////////////////)
在咱們安裝好CUDA、boost、OpenCV以後,接下來的一些庫(libSDL、protobuf等)的安裝,咱們均可以用系統內部的程序進行安裝。好比css
安裝libSDL,咱們終端輸入html
apt
-cache search libsdl
系統會給出一系列程序,咱們選擇其中的libsdl1.2-dev進行安裝。node
sudo apt
-get install libsdl1
.2-dev
(這裏注意不要安裝libsdl2-dev,由於安裝以後生成的文件夾是SDL2,以後doppia調用時會出現找不到「SDL files」的錯誤)python
安裝protobuf庫,則是我通過多番測試,獲得的可以經過v1,v2測試的安裝方法。(以前嘗試安裝protobuf2.5.0和protobuf2.4.1,doppia都找不到路徑,而想把它們刪除又刪除不了,很麻煩),以後我測試了幾個自帶的protobuf庫,發現安裝如下四個庫可以經過v1,v2的測試,安裝命令爲:ios
sudo apt
-get install libprotobuf
-dev libprotoc
-dev python
-protobuf protobuf
-compiler
切換到doppia目錄下,運行c++
sudo sh ./generate_protocol_buffer_files.sh
protobuf經過doppia-v1檢測的返回信息爲sass
Generating objects detection
files...
(Ground plane
and video input
files not yet handled
by this script)
End
of game. Have
a nice day!
protobuf經過doppia-v2檢測的返回信息爲ruby
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
+ cd src/objects_detection/
+ protoc --cpp_out=./ detector_model.proto detections.proto
+ protoc --python_out=../../tools/objects_detection/ detector_model.proto detections.proto
+ cd ../..
+ cd src/stereo_matching/ground_plane/
+ protoc --cpp_out=./ plane3d.proto
+ protoc --python_out=../../../tools/stixels_evaluation plane3d.proto
+ cd ../../..
+ cd src/stereo_matching/stixels/
+ protoc --cpp_out=./ -I. -I../ground_plane --include_imports stixels.proto ground_top_and_bottom.proto
--include_imports only makes sense when combined with --descriptor_set_out.
+ protoc --python_out=../../../tools/stixels_evaluation -I. -I../ground_plane --include_imports stixels.proto ground_top_and_bottom.proto
--include_imports only makes sense when combined with --descriptor_set_out.
+ cd ../../..
+ cd src/video_input/calibration
+ protoc --cpp_out=./ calibration.proto
+ cd ../../..
+ cd src/helpers/data
+ protoc --cpp_out=./ DataSequenceHeader.proto
+ protoc --python_out=../../../tools/data_sequence DataSequenceHeader.proto
+ cd ../../..
+ cd src/helpers
+ cd ../..
+ cd src/tests/data_sequence/
+ protoc --cpp_out=./ TestData.proto
+ cd ../../..
+ echo End of game. Have a nice day!
End of game. Have a nice day!
到這裏,咱們該安裝的庫大部分已經安裝成功,接下來就能夠開始編譯doppia啦!(至於可能還缺乏的庫,能夠根據doppia的錯誤提示進行安裝)bash
編譯運行doppia/src/applications/objects_detection
因爲我只須要用到doppia的objects_detection的功能,而以前我在編譯doppia-v2時,ground_estimation和stixel_world都能編譯運行。因此此次在編譯doppia-v1時,我就直接切入「主題」,編譯運行objects_detection。下面也主要是列出我在編譯objects_detection是遇到的問題以及相應的解決方案。app
錯誤一,建立(build)錯誤
error:
/home/mx/doppia/src/applications/objects_detection
/../../../src/helpers/
data/DataSequence
.hpp:
293:
56: error: invalid use of incomplete
type ‘class google
::protobuf::io::CodedInputStream’
const bool read_size_success
= input_coded_stream_p
->ReadLittleEndian64(
&size);
solution:
在
doppia/src/helpers/
data/DataSequence.hpp
頭文件中,在
#include "DataSequenceHeader.pb.h"
#include <google/protobuf/io/zero_copy_stream_impl.h>
兩行之間添加一行新的引用,以下,
#include "DataSequenceHeader.pb.h"
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
錯誤二,建立(build)錯誤
error:
/home/mx/doppia/src/applications/objects_detection/../../../src/objects_detection/gpu/integral_channels_detector.cu.
hpp:23:9: error: ‘fast_stage_t’
in ‘
class doppia::SoftCascadeOverIntegralChannelsModel’ does not name a type
typedef
SoftCascadeOverIntegralChannelsModel::fast_stage_t cascade_stage_t;
^
/home/mx/doppia/src/applications/objects_detection/../../../src/objects_detection/gpu/integral_channels_detector.cu.
hpp:33:36: error: ‘cascade_stage_t’ was
not declared
in this scope
typedef
Cuda::DeviceMemoryLinear2D<cascade_stage_t> gpu_detection_cascade_per_scale_t;
^
/home/mx/doppia/src/applications/objects_detection/../../../src/objects_detection/gpu/integral_channels_detector.cu.
hpp:33:51: error: template argument
1 is invalid
typedef
Cuda::DeviceMemoryLinear2D<cascade_stage_t> gpu_detection_cascade_per_scale_t;
^
/home/mx/doppia/src/applications/objects_detection/../../../src/objects_detection/gpu/integral_channels_detector.cu.
hpp:33:86: error: invalid type
in declaration before ‘;’ token
typedef
Cuda::DeviceMemoryLinear2D<cascade_stage_t> gpu_detection_cascade_per_scale_t;
這裏出現錯誤緣由是由於common_settings.cmake中沒有添加cuda連接庫路徑。
solution:
編輯common_settings.cmake,在其中添加一個條件項
elseif(
${HOSTNAME} STREQUAL "mx-pc")
message(STATUS
"Using mx-pc optimisation options")
option(USE_GPU
"Should the GPU be used ?" TRUE)
set(CUDA_BUILD_CUBIN
OFF)
set(local_CUDA_LIB_DIR
"/usr/local/cuda/lib64")
set(cuda_LIBS
"")
這裏mx-pc是我電腦的主機名,你須要將它改爲本身電腦的主機名。
錯誤三,建立(build)錯誤
error:
/home/mx/doppia/src/objects_detection/SoftCascadeOverIntegralChannelsFastFractionalStage
.cpp:
24:
9: error: ‘
swap’ is not a member of ‘
std’
std::
swap(weak_classifier
.level2_true_node, weak_classifier
.level2_false_node)
solution:
在
doppia/src/objects_detection/SoftCascadeOverIntegralChannelsFastFractionalStage
.cpp
文件開頭添加一行引用
#include<iostream>
解決了以上三個錯誤後,doppia就能夠建立(build)成功啦!但要想運行成功,還得改正如下2個錯誤。
錯誤四,連接(link)錯誤
error:
Linking CXX executable objects_detection
/usr/bin/ld: cannot find
-lboost_program_options-mt
/usr/bin/ld: cannot find
-lboost_filesystem-mt
/usr/bin/ld: cannot find
-lboost_system-mt
/usr/bin/ld: cannot find
-lboost_thread-mt
collect2: error: ld returned
1 exit status
make
[2]: *** [objects_detection
] 錯誤 1 make[1]: *** [CMakeFiles/objects_detection
.dir/
all] 錯誤 2 make: *** [all] 錯誤 2
這裏出現錯誤的緣由,是boost庫連接出錯,這時候咱們須要修改CMakeList.txt文件,這裏我就直接把CMakeList.txt貼出來,修改的地方作過註釋。
solution:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
cmake_minimum_required (VERSION
2.6)
set(doppia_root
"../../..")
set(CMAKE_MODULE_PATH
$ENV{CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH
"./" ${doppia_root} ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH
"/home/rodrigob/work/code/doppia_references/cuda/FindCUDA/CMake/cuda" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH
"/users/visics/rbenenso/code/references/cuda/FindCUDA/CMake/cuda" ${CMAKE_MODULE_PATH})
include(FindPkgConfig)
project (ObjectsDetection)
include(
${doppia_root}/common_settings.cmake)
pkg_check_modules(libpng REQUIRED libpng)
pkg_check_modules(opencv REQUIRED opencv>=
2.3)
set(opencv_LIBRARIES
opencv_core opencv_imgproc opencv_highgui opencv_ml
opencv_video opencv_features2d
opencv_calib3d
opencv_legacy opencv_flann
)
find_package(Boost REQUIRED
COMPONENTS program_options filesystem system thread
)
if(USE_GPU)
find_package(CUDA
4.0 REQUIRED)
include_directories(
${CUDA_INCLUDE_DIRS} ${CUDA_CUT_INCLUDE_DIR})
endif(USE_GPU)
set(local_LIBRARY_DIRS
"/usr/local/lib"
"/users/visics/rbenenso/no_backup/usr/local/lib"
"/usr/lib64"
"/usr/lib64/atlas"
"/usr/lib/sse2/atlas"
"/usr/lib/llvm-2.8/lib"
${local_CUDA_LIB_DIR}
)
set(local_INCLUDE_DIRS
"/users/visics/rbenenso/no_backup/usr/local/include"
"/usr/include/eigen2/"
"/usr/local/include/eigen2"
"/usr/local/cuda/include"
${CUDA_INCLUDE_DIRS}
)
link_directories(
${libpng_LIBRARY_DIRS}
${OpenEXR_LIBRARY_DIRS}
${opencv_LIBRARY_DIRS}
${local_LIBRARY_DIRS}
)
include_directories(
"${doppia_root}/libs"
"${doppia_root}/src"
${libpng_INCLUDE_DIRS}
${OpenEXR_INCLUDE_DIRS}
${opencv_INCLUDE_DIRS}
${local_INCLUDE_DIRS}
"${doppia_root}/libs/cudatemplates/include"
)
if(USE_GPU)
cuda_include_directories(
"${doppia_root}/libs/")
endif(USE_GPU)
set(doppia_src
"${doppia_root}/src")
set(doppia_stereo
"${doppia_root}/src/stereo_matching")
file(GLOB SrcCpp
"./ObjectsDetection*.cpp"
"./draw*.cpp"
"${doppia_src}/*.cpp"
"${doppia_src}/objects_detection/Abstract*.c*"
"${doppia_src}/objects_detection/*Converter.c*"
"${doppia_src}/objects_detection/Base*.c*"
"${doppia_src}/objects_detection/*Factory.c*"
"${doppia_src}/objects_detection/Greedy*.c*"
"${doppia_src}/objects_detection/Detection*.c*"
"${doppia_src}/objects_detection/*Model.c*"
"${doppia_src}/objects_detection/*Stage.c*"
"${doppia_src}/objects_detection/*Integral*.c*"
"${doppia_src}/objects_detection/MultiscalesIntegral*.c*"
"${doppia_src}/objects_detection/integral_channels/Integral*.cpp"
"${doppia_src}/objects_detection/FastestPedestrian*.c*"
"${doppia_src}/objects_detection/DetectorSearchRange.c*"
"${doppia_src}/objects_detection/*.pb.c*"
"${doppia_src}/objects_detection/non_maximal_suppression/*.c*"
"${doppia_src}/objects_tracking/*.cpp"
"${doppia_src}/applications/*.cpp"
"${doppia_src}/applications/stixel_world/*Gui.cpp"
"${doppia_src}/applications/stixel_world/draw*.cpp"
"${doppia_stereo}/cost_volume/*CostVolume.cpp"
"${doppia_stereo}/cost_volume/*CostVolumeEstimator*.cpp"
"${doppia_stereo}/cost_volume/DisparityCostVolumeFromDepthMap.cpp"
"${doppia_stereo}/cost_functions.cpp"
"${doppia_stereo}/CensusCostFunction.cpp"
"${doppia_stereo}/CensusTransform.cpp"
"${doppia_stereo}/GradientTransform.cpp"
"${doppia_stereo}/AbstractStereoMatcher.cpp"
"${doppia_stereo}/AbstractStereoBlockMatcher.cpp"
"${doppia_stereo}/SimpleBlockMatcher.cpp"
"${doppia_stereo}/MutualInformationCostFunction.cpp"
"${doppia_stereo}/ConstantSpaceBeliefPropagation.cpp"
"${doppia_stereo}/qingxiong_yang/*.cpp"
"${doppia_stereo}/SimpleTreesOptimizationStereo.cpp"
"${doppia_stereo}/OpenCvStereo.cpp"
"${doppia_stereo}/ground_plane/*.cpp"
"${doppia_stereo}/stixels/*.cpp"
"${doppia_src}/video_input/*.cpp"
"${doppia_src}/video_input/calibration/*.c*"
"${doppia_src}/video_input/preprocessing/*.cpp"
"${doppia_src}/image_processing/*.cpp"
"${doppia_src}/drawing/gil/*.cpp"
)
file(GLOB HelpersCpp
"${doppia_src}/helpers/data/*.c*"
"${doppia_src}/helpers/any_to_string.cpp"
"${doppia_src}/helpers/get_section_options.cpp"
"${doppia_src}/helpers/Log.cpp"
"${doppia_src}/helpers/loggers.cpp"
"${doppia_src}/helpers/AlignedImage.cpp"
"${doppia_src}/helpers/replace_environment_variables.cpp"
"${doppia_src}/helpers/objects_detection/*.cpp"
)
file(GLOB SrcGpuCpp
"${doppia_src}/objects_detection/Gpu*.cpp"
"${doppia_src}/objects_detection/integral_channels/Gpu*.cpp"
"${doppia_src}/helpers/gpu/*.cpp"
)
file(GLOB SrcCuda
"${doppia_src}/objects_detection/integral_channels/gpu/*.cu"
"${doppia_src}/objects_detection/integral_channels/gpu/*.cpp"
"${doppia_src}/objects_detection/gpu/*.cu"
"${doppia_src}/objects_detection/gpu/*.cpp"
)
list(REMOVE_ITEM SrcCpp
${SrcCuda})
if(USE_GPU)
list(APPEND SrcCpp
${SrcGpuCpp})
list(APPEND opencv_LIBRARIES opencv_gpu)
cuda_include_directories(
${local_CUDA_CUT_INCLUDE_DIRS})
cuda_include_directories(
${CUDA_INCLUDE_DIRS} ${CUDA_CUT_INCLUDE_DIR} ${local_CUDA_CUT_INCLUDE_DIR})
link_directories(
${local_CUDA_CUT_LIBRARY_DIRS})
cuda_add_library(cuda_stuff_library
${SrcCuda})
target_link_libraries(cuda_stuff_library
${CUDA_LIBRARIES}
${cutil_LIB}
)
endif(USE_GPU)
add_library(cpp_stuff_library
${SrcCpp} ${HelpersCpp})
add_executable(objects_detection
"./objects_detection.cpp")
target_link_libraries(objects_detection
cpp_stuff_library
${cg_LIBRARIES}
${Boost_LIBRARIES}
protobuf pthread
SDL X11 Xext
gomp
${libpng_LIBRARIES} jpeg
${opencv_LIBRARIES}
${google_perftools_LIBS}
)
if(USE_GPU)
target_link_libraries(objects_detection cuda_stuff_library
${local_CUDA_LIB})
endif(USE_GPU)
到這裏就OK啦!
最後運行成功你會看到一個簡短地video,以及下面這樣的信息
2015-
05-
09 16:
33:
23 {
7feb06974880} [ BaseIntegralChannelsDetector ] : Warning: At scale index
47 the detection window size is larger than
the biggest ground plane corridor. Setting
the detection search
to a single
line.
scale_index ==
47, original_height ==
18, updated_height ==
1
Expected speed gain ==
5.28x (
num pixels original/updated)
GpuVeryFastIntegralChannelsDetector::compute_v2
max search range (min_x, min_y; max_x, max_y) == (
0,
0;
153,
58)
2015-
05-
09 16:
33:
23 {
7feb06974880} [ GpuIntegralChannelsDetector ] : scaled_x ==
640, scaled_y ==
480
Requested frame
number 11 but frames should be
in range (
0,
10)
Processed
a total
of 10 input frames
Average objects detection speed per iteration
29.36 [Hz] (
in the last 10 iterations)
End
of game, have
a nice day.
好啦,doppia編譯到此也就結束啦!
但願這幾篇文章能幫助正在讀博客的你。
doppia及做者相關介紹連接:
http://blog.csdn.net/xizero00/article/details/43227019
https://bitbucket.org/rodrigob/doppia