DPU Compiled Yolov3 Model output channel 255

I am currently trying to call my for the DPU compiled Yolov3 Model but have problems with it.
I’ve managed to successfully use the darknet2caffe workflow to compile the Yolov3 Model for the DPU.
However the compiled model differs that from Xilinx provided model (it is a TensorFlow Model with a different output channel size):
In the repo DPU-PYNQ they have 3 output nodes:
conv2d_59_convolution(0) : 13x13x75
conv2d_67_convolution(0) : 26x26x75
conv2d_75_convolution(0) : 52x52x75

But my output channel sizes are:
layer81_conv(0) : 13x13x255
layer93_conv(0) : 26x26x255
layer105_conv(0) : 52x52x255

I am not sure why Xilinx Model has the the 75 instead of the 255, because the 255 matches the orignal Model. The problem that the difference output channel size is rising an error in the tf_yolov3_voc.py and I’ve lack the knowledge what to change in the tf_yolov3_voc.py to get the correct bounding boxes.
Did somebody also face the problem?

1 Like

Never mind I’ve figured out haha

ey man!

I wanna try implementing yolo model into my PYNQ-Z1 aswell, but I see in the Viti AI library user guide that PYNQ-Z1 is not supported, just Xilinx ZCU102, Xilinx ZCU104 and Xilinx Alveo U50.

How did you do it?

thanks!

Hey @maik123456789 as far as I know the PYNQ-Z1 is currently not officially supported (feel free to correct me if I am wring). Maybe somebody else did figure out how to implement the DPU on the PYNQ-Z1, but I’ve used the Ultra96-V2.
Probably you create another post and ask how the things currently are for the PYNQ-Z1.

btw: Even if you are able to get the DPU running on the PYNQ-Z1, it might be probably be only a small DPU Architecture (they have different sizes). That could lead for Yolo not running on the DPU architecture.

I guess you should use the the FINN Framework to infer a neural network on the PYNQ-Z1, however I’ve lack the knowledge how to do that. Additionally, feel free to correct me if I am wrong there is no real good tutorial and documentation how to properly use the FINN Framework.

Edit 1:
I’ve used different resources to compile the Yolov3 Model for my DPU Arch:

Could you please share about how to fix this question?
I have the same issue here, thank you!

1 Like

Hey @Johnny_Tsou the example YOLO Model provided by Xilinx was trained with TensorFlow. The 75 has something to do with the detection kernel and depends with how many classes you have trained your model.

It is calculated like this: Bx(5+C) = 3x(5+20) => 75 .

B represents the number of bounding boxes (in our case “3”). C represents the amount of classes (in our case 20 look here). I am not a data scientist by myself, I cant really go any deeper. For further explanation please read on the internet how the YOLO algorithm work or follow this:What’s new in YOLO v3?. A review of the YOLO v3 object… | by Ayoosh Kathuria | Towards Data Science

In my case I’ve worked with the original DarkNet Implementation which is using 80 classes: 3x(5+80) = 255

So you have to change in conv_out … = np.reshape(…) the 75 to 255.


Picture was taken from here: dpu_yolo_v3.ipynb

So for me my problem was to interpret the data coming from the yolo_outputs. I’ve just worked with this notebook. I am not sure anymore whether Ive changed something else except the 75 → 255.

Unfortunately I’ve also stopped working on this matter and cant really provide you any further instruction cause I am not sure how the evaluate() and draw_boxes() in the dpu_yolo_v3.ipynb notebook work ( but I think there is plenty of ressoucres on the internet that are diving deeper and explain how to interpret the YOLO output data), so I hope somebody else can provide your further instructions if you have more questions.

I wish you good luck though.

1 Like