Open mate-cape opened 6 years ago
Are there differences in how v2 and v3 model parameters are saved to .weight files? Like in the ordering of some parameters?
No, there is no differences in formats of weights-file.
Does Keras support Yolo v3 correctly?
I've just checked, and the original YOLOv3 gives NaNs, just like TinyYOLOv3. Before I tried a re-trained YOLOv3 with different categories, that gave valid numbers as outputs, but it was slightly different from Darknet outputs (detected boxes were close, confidences were significantly different).
Thanks for the info on the .weight file! I was suspecting that to be the problem, since the YAD2K conversion scrip did not use all weights from the file.
To summarize my findings so far:
Read 62001757 of 62001758.0 from Darknet weights. Warning: 1.0 unused weights
Read 8563822 of 8858735.0 from Darknet weights. Warning: 294913.0 unused weights
Of course this is an issue of the conversion script and not YOLO, but I suspected some differences in the weight files. Anyway, let me know if you have any idea.
I was trying to find the differences between the architectures.
Here I uploaded the plotted architecture of the converted network, I think the graph has been built correctly.
What implementation of Keras Yolo v3 do you use, can you give a link?
Did you successfully convert using YAD2K it is this weights-file downloaded from this site? https://pjreddie.com/media/files/yolov2.weights not from other places? with this cfg-file: https://github.com/pjreddie/darknet/blob/master/cfg/yolov2.cfg
Try to change these 3 lines:
https://github.com/AlexeyAB/darknet/blob/cda8171feb76bcb405350fd8341d42a0300e2f4b/src/parser.c#L957
to this: fwrite(net.seen, sizeof(uint64_t), 1, fp);
https://github.com/AlexeyAB/darknet/blob/cda8171feb76bcb405350fd8341d42a0300e2f4b/src/network.h#L24
to this uint64_t *seen;
https://github.com/AlexeyAB/darknet/blob/cda8171feb76bcb405350fd8341d42a0300e2f4b/src/network.c#L174
to this net.seen = calloc(1, sizeof(uint64_t));
And train 100 iterations, for saving weights-file, and try to convert it using YAD2K.
It can be related to this issue if you used ADAM optimizer: https://github.com/AlexeyAB/darknet/issues/2485#issuecomment-475656779
I'm trying to convert YOLO models to Keras with YAD2K (and finally to CoreML). With YOLOv2 I was able to parse the configs and load the weights. With v3 the config parsing is still working, however I ran into problems with loading the weights.
For YOLOv3 all weights are loaded, but the converted Keras model gives significantly different outputs. The recently released yolov3-tiny model on the other hand converts the model without using all the weights, and the outputs are all NaNs...
Are there differences in how v2 and v3 model parameters are saved to .weight files? Like in the ordering of some parameters?