3
votes
$\begingroup$

I would like to use the pre-trained weights of YOLO (tiny version, v1) in Keras, which are given in a file with extension .weights (here is an example). How can I read such a file in Keras?

For the past two days, I've been relentlessly digging through Github, and the likes, in order to help me in this task, with more or less success. I found some scripts on the internet in order to convert .txt or .h5 files (.h5 only for YOLO v2, and not v1), but none of these seemed to be working properly.

So, I guess my question is: how to read a .weights file? How are the data stored and structured in these files?

$\endgroup$
3
votes
$\begingroup$

The .weights seems to be the extension for a framework called "darknet". You can read .h5 files with Keras.

However, if you really want to build an object detection framework, there is no necessity to stick to the darknet's .weights files. There are many pretrained models on the web. Or else you could fine-tune a pre-trained ImageNet model in Keras, which I think is the best option, although there is not much you can do, if you got the exact weights of the YOLO model. Instead, it is better to train one from scratch or at least by fine-tuning an ImageNet model. By doing so, you will learn a lot.

$\endgroup$
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.