This is a ROS 2 wrapper around darknet, an open source neural network framework.
This node can run object detectors like YOLOv3 on images.
~/images
(typesensor_msgs/msg/Image
) - Input mages to feed to the detector
~/detections
(typevision_msgs/msg/Detection2DArray
) - Objects detected in an image (if any)
network.config
- a path to a file describing a darknet detector networknetwork.weights
- a path to a file with weights for the given networknetwork.class_names
- a path to a file with names of classes the network can detect (1 per line)detection.threshold
- Minimum probability of a detection to be publisheddetection.nms_threshold
- Non-maximal Suppression threshold - controls filtering of overlapping boxes
Download YOLOv3-tiny
.
wget https://raw.githubusercontent.com/pjreddie/darknet/f86901f6177dfc6116360a13cc06ab680e0c86b0/cfg/yolov3-tiny.cfg
wget https://pjreddie.com/media/files/yolov3-tiny.weights
wget https://raw.githubusercontent.com/pjreddie/darknet/c6afc7ff1499fbbe64069e1843d7929bd7ae2eaa/data/coco.names
Save the following as detector_node_params.yaml
/**:
ros__parameters:
network:
config: "./yolov3-tiny.cfg"
weights: "./yolov3-tiny.weights"
class_names: "./coco.names"
detection:
threshold: 0.25
nms_threshold: 0.45
Then run the node.
ros2 run openrobotics_darknet_ros detector_node __params:=detector_node_params.yaml
The node is now running.
Publish images on ~/images
to get the node to detect objects.