[Decoder] Add bounding box plugin
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 15 Nov 2018 08:27:40 +0000 (17:27 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 22 Nov 2018 15:32:31 +0000 (00:32 +0900)
commiteb95dd951cebc05e59f622872fe12ae3824f5ccc
tree6832fc30677486f176782d83202c06d2aa2643aa
parent4ace9e923b873e90b1a097dff3a480f17c0d1d80
[Decoder] Add bounding box plugin

1. The basic mechanism is imported from nnstreamer_example/example_object_detection.
2. The mechanism is updated to support
    - Different tensor types (it supports integers and double as well if the two tensors have the same type)
    - Input tensors may have smaller number of detections (less than DETECTION_MAX)
    - A few performance updates to execute less loops
3. No more dependencies on graphics library for drawing boxes or rendering text
4. Imported "font.c" of Silicon Graphics Inc 1992 to render text. The license is open for any purpose as long as the license statement is in tact.
5. Tested with a basic case
```
gst-launch-1.0 --gst-debug=2  \
        v4l2src name=cam_src ! videoscale ! videoconvert ! video/x-raw,width=640,height=480,format=RGB,framerate=30/1 ! tee name=t \
        t. ! queue leaky=2 max-size-buffers=2 ! videoscale ! video/x-raw,width=300,height=300,format=RGB ! tensor_converter ! \
                tensor_transform mode=arithmetic option=typecast:float32,add:-127,mul:0.007843 ! \
                tensor_filter framework=tensorflow-lite model=ssd_mobilenet_v2_coco.tflite ! \
                tensor_decoder mode=bounding_boxes option1=ssd option2=coco_labels_list.txt option3=box_priors.txt option4=640:480 option5=300:300 ! \
                compositor name=mix sink_0::zorder=2 sink_1::zorder=1 ! videoconvert ! ximagesink \
        t. ! queue leaky=2 max-size-buffers=10 ! mix.
```

In later PRs, we need
- Test cases (and probably some fixes)
- Hardcode the pre-processing results of font.h, then remove the "rasters" from font.h

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gst/tensor_decoder/CMakeLists.txt
gst/tensor_decoder/font.h [new file with mode: 0644]
gst/tensor_decoder/tensordec-boundingbox.c [new file with mode: 0644]