YAD2K icon indicating copy to clipboard operation
YAD2K copied to clipboard

Keras predictions not matching Darknet's

Open symepge opened this issue 6 years ago • 2 comments

I am converting a tiny YOLO-v2 model from Darknet to Keras using the yad2k. However, the predictions from the converted model are significantly worse than those of Darknet. So, I was wondering:

  • Is this an exact copy of Darknet implementation or we should expect differences?
  • In any case, do you have any ideas about how to improve my Keras predictions? Or where I may have gone wrong?

symepge avatar Apr 11 '18 21:04 symepge

@symepge run to the same problem :( did you solve this problem ?

MassyMeniche avatar Aug 20 '18 11:08 MassyMeniche

Yes, I did! The problem for me was the following: YOLO in Darknet resizes images to the desired input size (e.g. 416x416) by zero-padding and scaling, hence, keeping the original aspect ratio. The Keras implementation, however, scales the images without zero-padding and hence, changes the aspect ratio of the images. That throws off the model and negatively impacts the quality of the predictions. You can resolve the issue by proper scaling of the images. I hope it helps!

symepge avatar Aug 20 '18 23:08 symepge