@@ -7,9 +7,9 @@ add_compile_options(-std=c++11)
77## Optional parts of library
88set (opencv_contrib OFF )
99set (zbar_lib OFF )
10- set (TensorFlow OFF )
1110set (DLib OFF )
1211set (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)
4040endif (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
155162if (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)
169176endif (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
172183add_executable (
173184 hsv_color_params_collector_node
@@ -499,11 +510,30 @@ if(igraph)
499510 )
500511endif (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
503532target_link_libraries (extended_object_detection_node
504533 ${OpenCV_LIBRARIES}
505534 ${TinyXML_LIBRARIES}
506535 ${catkin_LIBRARIES}
536+
507537)
508538
509539target_link_libraries (hsv_color_params_collector_node
0 commit comments