Darknet is a popular neural network framework, and YOLO is a very interesting network that detects all objects in a scene in one pass. This module detects all instances of any of the objects it knows about (determined by the network structure, labels, dataset used for training, and weights obtained) in the image that is given to it.
This module runs a YOLO network and shows all detections obtained. The YOLO network is currently quite slow, hence it is only run once in a while. Point your camera towards some interesting scene, keep it stable, and wait for YOLO to tell you what it found. The framerate figures shown at the bottom left of the display reflect the speed at which each new video frame from the camera is processed, but in this module this just amounts to converting the image to RGB, sending it to the neural network for processing in a separate thread, and creating the demo display. Actual network inference speed (time taken to compute the predictions on one image) is shown at the bottom right. See below for how to trade-off speed and accuracy.
Note that by default this module runs the Pascal-VOC version of tiny-YOLO, with these object categories:
Sometimes it will make mistakes! The performance of tiny-yolo-voc is about 57.1% correct (mean average precision) on the test set.
Speed and network size
The parameter netin allows you to rescale the neural network to the specified size. Beware that this will only work if the network used is fully convolutional (as is the case of the default tiny-yolo network). This not only allows you to adjust processing speed (and, conversely, accuracy), but also to better match the network to the input images (e.g., the default size for tiny-yolo is 416x416, and, thus, passing it a input image of size 640x480 will result in first scaling that input to 416x312, then letterboxing it by adding gray borders on top and bottom so that the final input to the network is 416x416). This letterboxing can be completely avoided by just resizing the network to 320x240.
Here are expected processing speeds:
when netin = [0 0], processes letterboxed 416x416 inputs, about 2450ms/image
when netin = [320 240], processes 320x240 inputs, about 1350ms/image
when netin = [160 120], processes 160x120 inputs, about 695ms/image
On every frame where detection results were obtained, this module sends a message
where framenum is the frame number (starts at 0).
In addition, when detections are found which are above threshold, one message will be sent for each detected object (i.e., for each box that gets drawn when USB outputs are used), using a standardized 2D message:
Serial message type: 2D
id: the category name of the recognized object
x, y, or vertices: standardized 2D coordinates of object center or corners