objectDetector_Yolo for YOLO9000

Hello everyone,

I want to adapt the code from objectDetector_Yolo to be able to use YOLO9000 [1].
I know it is based on YOLOv2 the only difference being the last layer.
YOLOv2 does a softmax where YOLO9000 does a tree like softmax (WordTree).

What do I have to modify in objectDetector_Yolo in order to be able to use YOLO9000?

Thank you in advance for your help and guidance.

[1] https://pjreddie.com/media/files/papers/YOLO9000.pdf

update:

Children from each node are packed together in the tree structure [2] and
thus we can precompute the number of children in each pack [3].
Is it possible to replace the SoftMax layer from YOLOv2 by a RaggedSoftMax layer instead?
It seems to be the layer that best fit YOLO9000 requirements.

[2] https://github.com/pjreddie/darknet/blob/master/data/9k.tree
[3] https://drive.google.com/file/d/1wiEmMmfvC19dFIFg0nWY2i4nBdbNb0hE/view?usp=sharing

Hi,

TensorRT already provides an optimized plugin layer for yolo9000’s last layer. Can you take a look at NvInferPlugin.h file in Tensorrt ?

Hi NvCJR,

From NvInferPlugin.h I found the function createRegionPlugin(…) used by both YOLOv2 and YOLO9000.
DeepStream already uses that function for YOLOv2.
One of the parameters is a pointer to the softmaxTree structure.
DeepStream (objectDetector_Yolo) sets that pointer to nullptr and
I need to build that structure.

Could you please describe a bit each part of that structure?

I found a source code that reads the tree from a file:
https://github.com/pjreddie/darknet/blob/master/src/tree.c#L83-L139

It is based on the same structure used by TensorRT:
https://github.com/pjreddie/darknet/blob/master/include/darknet.h#L34-L45

I just have to read the code to understand how it works.