rosyolodarknet

Unsure why yolo_v3.launch file in darknet_ros package gives me error


When I roslaunch darknet_ros yolo_v3.launch I get this :


  `/
    darknet_ros (darknet_ros/darknet_ros)

ROS_MASTER_URI=http://localhost:11311

process[darknet_ros-1]: started with pid [17269]
[ INFO] [1673750946.743184246]: [YoloObjectDetector] Node started.
[ INFO] [1673750946.749640549]: [YoloObjectDetector] Xserver is running.
[ INFO] [1673750946.752220959]: [YoloObjectDetector] init().
YOLO V3
layer     filters    size              input                output
    0 conv     32  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  32  0.299 BFLOPs
    1 conv     64  3 x 3 / 2   416 x 416 x  32   ->   208 x 208 x  64  1.595 BFLOPs
    2 conv     32  1 x 1 / 1   208 x 208 x  64   ->   208 x 208 x  32  0.177 BFLOPs
    3 conv     64  3 x 3 / 1   208 x 208 x  32   ->   208 x 208 x  64  1.595 BFLOPs
    4 res    1                 208 x 208 x  64   ->   208 x 208 x  64
    5 conv    128  3 x 3 / 2   208 x 208 x  64   ->   104 x 104 x 128  1.595 BFLOPs
    6 conv     64  1 x 1 / 1   104 x 104 x 128   ->   104 x 104 x  64  0.177 BFLOPs
    7 conv    128  3 x 3 / 1   104 x 104 x  64   ->   104 x 104 x 128  1.595 BFLOPs
    8 res    5                 104 x 104 x 128   ->   104 x 104 x 128
    9 conv     64  1 x 1 / 1   104 x 104 x 128   ->   104 x 104 x  64  0.177 BFLOPs
   10 conv    128  3 x 3 / 1   104 x 104 x  64   ->   104 x 104 x 128  1.595 BFLOPs
   11 res    8                 104 x 104 x 128   ->   104 x 104 x 128
   12 conv    256  3 x 3 / 2   104 x 104 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   13 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   14 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   15 res   12                  52 x  52 x 256   ->    52 x  52 x 256
   16 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   17 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   18 res   15                  52 x  52 x 256   ->    52 x  52 x 256
   19 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   20 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   21 res   18                  52 x  52 x 256   ->    52 x  52 x 256
   22 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   23 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   24 res   21                  52 x  52 x 256   ->    52 x  52 x 256
   25 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   26 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   27 res   24                  52 x  52 x 256   ->    52 x  52 x 256
   28 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   29 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   30 res   27                  52 x  52 x 256   ->    52 x  52 x 256
   31 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   32 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   33 res   30                  52 x  52 x 256   ->    52 x  52 x 256
   34 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
   35 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
   36 res   33                  52 x  52 x 256   ->    52 x  52 x 256
   37 conv    512  3 x 3 / 2    52 x  52 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   38 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   39 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   40 res   37                  26 x  26 x 512   ->    26 x  26 x 512
   41 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   42 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   43 res   40                  26 x  26 x 512   ->    26 x  26 x 512
   44 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   45 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   46 res   43                  26 x  26 x 512   ->    26 x  26 x 512
   47 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   48 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   49 res   46                  26 x  26 x 512   ->    26 x  26 x 512
   50 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   51 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   52 res   49                  26 x  26 x 512   ->    26 x  26 x 512
   53 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   54 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   55 res   52                  26 x  26 x 512   ->    26 x  26 x 512
   56 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   57 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   58 res   55                  26 x  26 x 512   ->    26 x  26 x 512
   59 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   60 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   61 res   58                  26 x  26 x 512   ->    26 x  26 x 512
   62 conv   1024  3 x 3 / 2    26 x  26 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   63 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512  0.177 BFLOPs
   64 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   65 res   62                  13 x  13 x1024   ->    13 x  13 x1024
   66 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512  0.177 BFLOPs
   67 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   68 res   65                  13 x  13 x1024   ->    13 x  13 x1024
   69 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512  0.177 BFLOPs
   70 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   71 res   68                  13 x  13 x1024   ->    13 x  13 x1024
   72 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512  0.177 BFLOPs
   73 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   74 res   71                  13 x  13 x1024   ->    13 x  13 x1024
   75 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512  0.177 BFLOPs
   76 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   77 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512  0.177 BFLOPs
   78 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   79 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512  0.177 BFLOPs
   80 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   81 conv    255  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 255  0.088 BFLOPs
   82 yolo
   83 route  79
   84 conv    256  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 256  0.044 BFLOPs
   85 upsample            2x    13 x  13 x 256   ->    26 x  26 x 256
   86 route  85 61
   87 conv    256  1 x 1 / 1    26 x  26 x 768   ->    26 x  26 x 256  0.266 BFLOPs
   88 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   89 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   90 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   91 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256  0.177 BFLOPs
   92 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512  1.595 BFLOPs
   93 conv    255  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 255  0.177 BFLOPs
   94 yolo
   95 route  91
   96 conv    128  1 x 1 / 1    26 x  26 x 256   ->    26 x  26 x 128  0.044 BFLOPs
   97 upsample            2x    26 x  26 x 128   ->    52 x  52 x 128
   98 route  97 36
   99 conv    128  1 x 1 / 1    52 x  52 x 384   ->    52 x  52 x 128  0.266 BFLOPs
  100 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
  101 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
  102 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
  103 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
  104 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
  105 conv    255  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 255  0.353 BFLOPs
  106 yolo
Loading weights from /home/philip/obj_ws/src/darknet_ros/darknet_ros/yolo_network_config/weights/yolov3.weights...Done!
Waiting for image.
[darknet_ros-1] process has died [pid 17269, exit code -11, cmd /home/philip/obj_ws/devel/lib/darknet_ros/darknet_ros camera/rgb/image_raw:=wam_v/front/image_raw __name:=darknet_ros __log:=/home/philip/.ros/log/c81dc520-947e-11ed-8da9-d43b04207196/darknet_ros-1.log].
log file: /home/philip/.ros/log/c81dc520-947e-11ed-8da9-d43b04207196/darknet_ros-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done`

I assume this must have something to do with the camera topic which in this case is wam_v\front\image_raw. This topic is what I have for my image topic in my launch file, and I know data is being published t this topic. I also tried rosnode info darknet_ros:

Node [/darknet_ros]
Publications: 
 * /darknet_ros/bounding_boxes [darknet_ros_msgs/BoundingBoxes]
 * /darknet_ros/check_for_objects/feedback [darknet_ros_msgs/CheckForObjectsActionFeedback]
 * /darknet_ros/check_for_objects/result [darknet_ros_msgs/CheckForObjectsActionResult]
 * /darknet_ros/check_for_objects/status [actionlib_msgs/GoalStatusArray]
 * /darknet_ros/detection_image [sensor_msgs/Image]
 * /darknet_ros/found_object [darknet_ros_msgs/ObjectCount]
 * /rosout [rosgraph_msgs/Log]

Subscriptions: 
 * /clock [rosgraph_msgs/Clock]
 * /darknet_ros/check_for_objects/cancel [unknown type]
 * /darknet_ros/check_for_objects/goal [unknown type]
 * /wam_v/front/image_raw [sensor_msgs/Image]

Services: 
 * /darknet_ros/get_loggers
 * /darknet_ros/set_logger_level


contacting node http://localhost:39865/ ...
Pid: 17766
Connections:
 * topic: /rosout
    * to: /rosout
    * direction: outbound (51267 - 127.0.0.1:59632) [14]
    * transport: TCPROS
 * topic: /clock
    * to: /gazebo (http://localhost:39329/)
    * direction: inbound (56290 - localhost:48481) [13]
    * transport: TCPROS
 * topic: /wam_v/front/image_raw
    * to: /gazebo (http://localhost:39329/)
    * direction: inbound (40672 - localhost:48481) [12]
    * transport: TCPROS

It seems the camera topic is being subscribed to. I'm not sure what going on. I try catkin_make -DCMAKE_BUILD_TYPE=Debug: I get ......

[ 98%] Linking CXX shared library /home/philip/obj_ws/devel/lib/libdarknet_ros_lib.so
[ 98%] Built target darknet_ros_lib
[ 98%] Building CXX object darknet_ros/darknet_ros/CMakeFiles/darknet_ros.dir/src/yolo_object_detector_node.cpp.o
In file included from /home/philip/obj_ws/src/darknet_ros/darknet_ros/include/darknet_ros/YoloObjectDetector.hpp:56:0,
                 from /home/philip/obj_ws/src/darknet_ros/darknet_ros/src/yolo_object_detector_node.cpp:9:
/home/philip/obj_ws/src/darknet_ros/darknet_ros/include/darknet_ros/image_interface.h:15:14: warning: ‘float get_pixel(image, int, int, int)’ declared ‘static’ but never defined [-Wunused-function]
 static float get_pixel(image m, int x, int y, int c);
              ^~~~~~~~~
[100%] Linking CXX executable /home/philip/obj_ws/devel/lib/darknet_ros/darknet_ros
/home/philip/obj_ws/devel/lib/libdarknet_ros_lib.so: undefined reference to `cv::VideoCapture::VideoCapture(int)'
/home/philip/obj_ws/devel/lib/libdarknet_ros_lib.so: undefined reference to `cv::VideoCapture::VideoCapture(cv::String const&)'
collect2: error: ld returned 1 exit status
darknet_ros/darknet_ros/CMakeFiles/darknet_ros.dir/build.make:173: recipe for target '/home/philip/obj_ws/devel/lib/darknet_ros/darknet_ros' failed
make[2]: *** [/home/philip/obj_ws/devel/lib/darknet_ros/darknet_ros] Error 1
CMakeFiles/Makefile2:2048: recipe for target 'darknet_ros/darknet_ros/CMakeFiles/darknet_ros.dir/all' failed
make[1]: *** [darknet_ros/darknet_ros/CMakeFiles/darknet_ros.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

Solution

  • This is solved now, I had to attach linker flags or something. Here's a snippet how to change your CMakeLists.txt for the darknet_ros package. Mind that I'm using openCV 3.2.0 without CUDA.

    .........
    if (CUDA_FOUND)
    
      link_directories(
        ${CUDA_TOOLKIT_ROOT_DIR}/lib
      )
    
      cuda_add_library(${PROJECT_NAME}_lib
        ${PROJECT_LIB_FILES} ${DARKNET_CORE_FILES}
        ${DARKNET_CUDA_FILES}
      )
    
      target_link_libraries(${PROJECT_NAME}_lib
        cuda
        cudart
        cublas
        curand
      )
    
      cuda_add_executable(${PROJECT_NAME}
        src/yolo_object_detector_node.cpp
      )
    
    else()
    
      add_library(${PROJECT_NAME}_lib
        ${PROJECT_LIB_FILES} ${DARKNET_CORE_FILES}
      )
      
     execute_process(COMMAND pkg-config --libs opencv
                    OUTPUT_VARIABLE OpenCV_LIBS
                    OUTPUT_STRIP_TRAILING_WHITESPACE)
      target_link_libraries(${PROJECT_NAME}_lib ${OpenCV_LIBRARIES} ${Boost_LIBRARIES} ${X11_LIBRARIES})
    
      add_executable(${PROJECT_NAME} 
        src/yolo_object_detector_node.cpp
      )
    
    endif()
    ..........