Closed Bekci closed 4 years ago
you need to use right .cfg file to load the weights file
---Original--- From: "Burak Bekci"<notifications@github.com> Date: Sun, Sep 13, 2020 18:57 PM To: "yuto3o/yolox"<yolox@noreply.github.com>; Cc: "Subscribed"<subscribed@noreply.github.com>; Subject: [yuto3o/yolox] Weights file used in the implementation (#9)
Could you provide pretrained weights file you have used? When I tried to use the files in the provided link, the assertion fails and gives "Could not read all the data". I believe the weights file must be in the form of h5 yet the files in the provided link have the extension of .weights. How can I convert them to h5 and feed to your models?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I have used the weights file in the link below: https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo and still it gives the same error. Also, I tried to train a custom model whose number of class is not same as coco. Would it make a problem?
Yes. You can load .weight file with coco config file firstly, and save the weight as .h5 file. Then you can load the weights by this .h5 file successfully. Because the code to load .weight file can not deal with mismatch variables, but keras (we use keras api to read .h5 file) can.
------------------ 原始邮件 ------------------ 发件人: "Burak Bekci"<notifications@github.com>; 发送时间: 2020年9月16日(星期三) 晚上8:35 收件人: "yuto3o/yolox"<yolox@noreply.github.com>; 抄送: "虞扬"<yuyang.private@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [yuto3o/yolox] Weights file used in the implementation (#9)
I have used the weights file in the link below: https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo Also, I tried to train a custom model whose number of class is not same as coco. Would it make a problem?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Yes. You can load .weight file with coco config file firstly, and save the weight as .h5 file. Then you can load the weights by this .h5 file successfully. Because the code to load .weight file can not deal with mismatch variables, but keras (we use keras api to read .h5 file) can. … ------------------ 原始邮件 ------------------ 发件人: "Burak Bekci"<notifications@github.com>; 发送时间: 2020年9月16日(星期三) 晚上8:35 收件人: "yuto3o/yolox"<yolox@noreply.github.com>; 抄送: "虞扬"<yuyang.private@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [yuto3o/yolox] Weights file used in the implementation (#9) I have used the weights file in the link below: https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo Also, I tried to train a custom model whose number of class is not same as coco. Would it make a problem? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
That worked thanks!
Sorry, i was impatient to closed the issue quickly. When I trained the model with converted h5 file, it gets 0.0 mAP value for all the epochs. What I did was:
model.save_weights('yolov4_weights.h5')
Sorry, i was impatient to closed the issue quickly. When I trained the model with converted h5 file, it gets 0.0 mAP value for all the epochs. What I did was:
- Change config to coco file. The names file is the original file for the coco here.
- Give the weights in the link https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo
- Save the weights of the model with
model.save_weights('yolov4_weights.h5')
- I changed the config to my custom one. The number of classes is different in this one and names file is my custom name file.
- Start training with custom config.
I think it is a complicated problem. Maybe the custom config is not suitable for your model or dataset, or there are something wrong with your data. I only guarantee that the code is ok.
I gave init_weight_path as "" and keep other fields same to control my dataset and config file and after 2 epochs it reached to mAP score of 10. Maybe the weights file I have used is wrong.
Could you provide pretrained weights file you have used? When I tried to use the files in the provided link, the assertion fails and gives "AssertionError: failed to read all data". I believe the weights file must be in the form of h5 yet the files in the provided link have the extension of .weights. How can I convert them to h5 and feed to your models?