Skip to content

Commit e71e4bb

Browse files
merged torch and multicam
2 parents b7d03d0 + 169c346 commit e71e4bb

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

CMakeLists.txt

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ add_compile_options(-std=c++11)
77
## Optional parts of library
88
set(opencv_contrib OFF)
99
set(zbar_lib OFF)
10-
set(TensorFlow OFF)
1110
set(DLib OFF)
1211
set(igraph OFF)
12+
set(torch OFF)
1313

1414
## Find catkin macros and libraries
1515
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
@@ -39,6 +39,15 @@ if(DLib)
3939
add_subdirectory(/home/anton/Lib/dlib dlib_build)
4040
endif(DLib)
4141

42+
if(torch)
43+
#set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}/home/anton/Libs/libtorch")
44+
list(APPEND CMAKE_PREFIX_PATH "/home/anton/Lib/libtorch")
45+
message(${CMAKE_PREFIX_PATH})
46+
find_package(Torch REQUIRED)
47+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
48+
endif(torch)
49+
50+
4251

4352
################################################
4453
## Declare ROS messages, services and actions ##
@@ -123,6 +132,7 @@ set( EOD_SRC
123132
src/lib/detectors/ExtractedInfoStringChecker.cpp
124133
src/lib/detectors/UnitTranslationExtracter.cpp
125134
src/lib/detectors/SquareObjectDistanceDetector.cpp
135+
src/lib/detectors/TorchYOLOv7Detector.cpp
126136

127137
# lib relations
128138
src/lib/relations/ImageRangeRelation.cpp
@@ -148,9 +158,6 @@ add_executable(
148158
${EOD_SRC}
149159
)
150160

151-
if(TensorFlow)
152-
target_compile_definitions(extended_object_detection_node PUBLIC USE_TF)
153-
endif(TensorFlow)
154161

155162
if(opencv_contrib)
156163
target_compile_definitions(extended_object_detection_node PUBLIC USE_OPENCV_CONTRIB)
@@ -168,6 +175,10 @@ if(igraph)
168175
target_compile_definitions(extended_object_detection_node PUBLIC USE_IGRAPH)
169176
endif(igraph)
170177

178+
if(torch)
179+
target_compile_definitions(extended_object_detection_node PUBLIC USE_TORCH)
180+
endif(torch)
181+
171182
#collect hsv color c++ utility
172183
add_executable(
173184
hsv_color_params_collector_node
@@ -499,11 +510,30 @@ if(igraph)
499510
)
500511
endif(igraph)
501512

513+
if(torch)
514+
set_property(TARGET extended_object_detection_node PROPERTY CXX_STANDARD 14)
515+
set_property(TARGET offline_video PROPERTY CXX_STANDARD 14)
516+
set_property(TARGET offline_image PROPERTY CXX_STANDARD 14)
517+
518+
target_link_libraries(extended_object_detection_node
519+
${TORCH_LIBRARIES}
520+
)
521+
522+
target_link_libraries(offline_video
523+
${TORCH_LIBRARIES}
524+
)
525+
526+
target_link_libraries(offline_image
527+
${TORCH_LIBRARIES}
528+
)
529+
endif(torch)
530+
502531

503532
target_link_libraries(extended_object_detection_node
504533
${OpenCV_LIBRARIES}
505534
${TinyXML_LIBRARIES}
506535
${catkin_LIBRARIES}
536+
507537
)
508538

509539
target_link_libraries(hsv_color_params_collector_node

src/extended_object_detection_node/eod_node.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,6 @@ void EOD_ROS::rgbd_info_cb(const sensor_msgs::ImageConstPtr& rgb_image, const se
301301

302302

303303
void EOD_ROS::detect(const eod::InfoImage& rgb, const eod::InfoImage& depth, std_msgs::Header header){
304-
//ROS_INFO("Detecting...");
305-
306-
// if( frame_sequence != 0 ){
307-
// stats[header.frame_id].detect_rate_values->push_back((ros::Time::now() - stats[header.frame_id].prev_detected_time).toSec());
308-
// }
309-
//
310304
// store data for detect rate calculus
311305
if( stats[header.frame_id].proceeded_frames != 0){
312306
stats[header.frame_id].detect_rate_values->push_back((ros::Time::now() - stats[header.frame_id].prev_detected_time).toSec());

0 commit comments

Comments
 (0)