@@ -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 ON )
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/Libs/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 ##
@@ -121,6 +130,7 @@ set( EOD_SRC
121130 src/lib/detectors/ExtractedInfoStringChecker.cpp
122131 src/lib/detectors/UnitTranslationExtracter.cpp
123132 src/lib/detectors/SquareObjectDistanceDetector.cpp
133+ src/lib/detectors/TorchDetector.cpp
124134
125135 # lib relations
126136 src/lib/relations/ImageRangeRelation.cpp
@@ -146,9 +156,6 @@ add_executable(
146156 ${EOD_SRC}
147157)
148158
149- if (TensorFlow)
150- target_compile_definitions (extended_object_detection_node PUBLIC USE_TF)
151- endif (TensorFlow)
152159
153160if (opencv_contrib)
154161 target_compile_definitions (extended_object_detection_node PUBLIC USE_OPENCV_CONTRIB)
@@ -166,6 +173,10 @@ if(igraph)
166173 target_compile_definitions (extended_object_detection_node PUBLIC USE_IGRAPH)
167174endif (igraph)
168175
176+ if (torch)
177+ target_compile_definitions (extended_object_detection_node PUBLIC USE_TORCH)
178+ endif (torch)
179+
169180#collect hsv color c++ utility
170181add_executable (
171182 hsv_color_params_collector_node
@@ -497,11 +508,30 @@ if(igraph)
497508 )
498509endif (igraph)
499510
511+ if (torch)
512+ set_property (TARGET extended_object_detection_node PROPERTY CXX_STANDARD 14)
513+ set_property (TARGET offline_video PROPERTY CXX_STANDARD 14)
514+ set_property (TARGET offline_image PROPERTY CXX_STANDARD 14)
515+
516+ target_link_libraries (extended_object_detection_node
517+ ${TORCH_LIBRARIES}
518+ )
519+
520+ target_link_libraries (offline_video
521+ ${TORCH_LIBRARIES}
522+ )
523+
524+ target_link_libraries (offline_image
525+ ${TORCH_LIBRARIES}
526+ )
527+ endif (torch)
528+
500529
501530target_link_libraries (extended_object_detection_node
502531 ${OpenCV_LIBRARIES}
503532 ${TinyXML_LIBRARIES}
504533 ${catkin_LIBRARIES}
534+
505535)
506536
507537target_link_libraries (hsv_color_params_collector_node
0 commit comments