YoloV3 inference using pb weights ( OpenCV 4.5.3 )

Finally, it’s possible to perform YoloV3 inference using pb weights: great!
it works, but some behaviours are obscure.

using getUnconnectedOutLayersNames() or getLayerNames() or dumpToFile, the output layers seems to be:
conv2d_59/convolution, conv2d_67/convolution, conv2d_75/convolution

It seems that OpenCV doesn’t parse the bias operation, that should be performed by last layers of the network:
conv2d_59/BiasAdd, conv2d_67/BiasAdd, conv2d_75/BiasAdd

The problem is that OpenCV::dnn module performs correctly the bias operation even if the BiasAdd layers seems disappeared.
This is verified by comparing with the inference performed using tensorflow on the same pb weights and the same image. The results are the same.

In conclusion: OpenCV 4.5.3 doesn’t list the Bias layers but applies the biases correctly.
Why ?

info: YoloV3 trained on COCO dataset, “yolo.pb” weights, OpenCV 4.5.3 compiled with CUDA 10.0, C++, Windows 10.

where from ? do you have a link ?

if this is part of a convolution, the tf_importer indeed replaces it

1 Like

I took the COCO-trained YoloV3 weights (yolov3.weights, yolov3.cfg )from Yolo website
then followed “Convert the Darknet YOLO model to a Keras model” from:

then, using keras + tensorflow (1.14) i converted the .h5 weights to .pb