(与本节内容无关///////////////////////////保存图片参数为—-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