jinyu121 / DW2TF

Darknet Weights to TensorFlow
GNU General Public License v3.0
219 stars 73 forks source link

Wrong input and output shape? #56

Closed michalek-marcin closed 3 years ago

michalek-marcin commented 3 years ago

Hi,

I'm trying to convert darknet yolov2-tiny model to onnx. I'm using DW2TF to convert weights and cfg files to tensorflow (pb). I checked tensorflow pb file in Netron, and I see that input and output shape of my yolov2-tiny VOC is different that I expected:

Actual shape: Input: float32[unk77,416,416,3] Output: float32[unk78,13,13,40]

Expected shape format: Input: float32[unk77,3,416,416] Output: float32[unk78,40,13,13]

Link to darknet VOC model: https://pjreddie.com/darknet/yolov2/

Please check this onnx model example: https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/tiny-yolov2

Is it possible to change model input and output shape? I need it to use trained model in Unity with Barracuda.

michalek-marcin commented 3 years ago

I finally found reason why my model doesn't work: https://github.com/allanzelener/YAD2K/issues/65. I had to correct one script which convert my darknet model to keras. Input and output shape can be in that order.