Module DocumentationThis module runs an object detection deep neural network using the OpenCV DNN library. Detection networks analyze a whole scene and produce a number of bounding boxes around detected objects, together with identity labels and confidence scores for each detected box.
This module runs the selected deep neural network and shows all detections obtained.
Note that by default this module runs the OpenCV Face Detector DNN which can detect human faces.
Included with the standard JeVois distribution are the following networks:
- OpenCV Face Detector, Caffe model
- MobileNet + SSD trained on Pascal VOC (20 object classes), Caffe model
- MobileNet + SSD trained on Coco (80 object classes), TensorFlow model
- MobileNet v2 + SSD trained on Coco (80 object classes), TensorFlow model
- Darknet Tiny YOLO v3 trained on Coco (80 object classes), Darknet model
- Darknet Tiny YOLO v2 trained on Pascal VOC (20 object classes), Darknet model
See the module's params.cfg file to switch network. Object categories are as follows:
- The 80 COCO object categories are: person, bicycle, car, motorbike, aeroplane, bus, train, truck, boat, traffic, fire, stop, parking, bench, bird, cat, dog, horse, sheep, cow, elephant, bear, zebra, giraffe, backpack, umbrella, handbag, tie, suitcase, frisbee, skis, snowboard, sports, kite, baseball, baseball, skateboard, surfboard, tennis, bottle, wine, cup, fork, knife, spoon, bowl, banana, apple, sandwich, orange, broccoli, carrot, hot, pizza, donut, cake, chair, sofa, pottedplant, bed, diningtable, toilet, tvmonitor, laptop, mouse, remote, keyboard, cell, microwave, oven, toaster, sink, refrigerator, book, clock, vase, scissors, teddy, hair, toothbrush.
- The 20 Pascal-VOC object categories are: aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa, train, tvmonitor.
Sometimes it will make mistakes! The performance of yolov3-tiny is about 33.1% correct (mean average precision) on the COCO test set. The OpenCV Face Detector is quite fast and robust!
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 with the default networks listed above). 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 for the OpenCV Face Detector:
- when netin = [320 240], processes 320x240 inputs, about 650ms/image (1.5 frames/s)
- when netin = [160 120], processes 160x120 inputs, about 190ms/image (5.0 frames/s)
Serial messages
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 of the recognized object, followed by ':' and the confidence score in percent
x , y , or vertices: standardized 2D coordinates of object center or corners
w , h : standardized object size
extra : any number of additional category:score pairs which had an above-threshold score for that box
See Standardized serial messages formatting for more on standardized serial messages, and Helper functions to convert coordinates from camera resolution to standardized for more info on standardized coordinates.
This code is heavily inspired from: https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.cpp
|