如何从.cfg文件中加载Darknet YOLOv3模型并从.weights文件中加载权重,并将带有权重的模型保存到.h5文件中? [英] How to load darknet YOLOv3 model from .cfg file and weights from .weights file, and save the model with the weights to a .h5 file?

查看:118
本文介绍了如何从.cfg文件中加载Darknet YOLOv3模型并从.weights文件中加载权重,并将带有权重的模型保存到.h5文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从darknet下载了YOLOv3的.weights和.cfg文件(链接: https://pjreddie.com/darknet/yolo/),我想创建一个模型并从这些文件中分配权重,我想将分配了权重的模型保存到.h5文件中,以便我可以加载.h5通过使用keras.models.load_model()将模型建模为Keras.

I have downloaded the .weights and .cfg file for YOLOv3 from darknet (link: https://pjreddie.com/darknet/yolo/) I want to create a model and assign the weights from these files, and I want to save the model with the assigned weights to a .h5 file so that I can load the .h5 model into Keras by using keras.models.load_model().

请帮助.

推荐答案

您应查看中给出的说明.此存储库.这基本上是YOLOv3(Tensorflow后端)的keras实现.

You should check the instructions given in this repository. This is basically the keras implementation of YOLOv3 (Tensorflow backend).

  • 从YOLO网站下载YOLOv3权重.
  • 将Darknet YOLO模型转换为Keras模型.

  • Download YOLOv3 weights from YOLO website.
  • Convert the Darknet YOLO model to a Keras model.

python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5

由于您已经下载了砝码和配置文件,因此可以跳过第一步.从存储库下载 convert.py 脚本,只需运行上述命令即可.

As you have already downloaded the weights and configuration file, you can skip the first step. Download the convert.py script from repository and simply run the above command.

注意:以上命令假定 yolov3.cfg yolov3.weights model_data (文件夹)为与 convert.py 位于同一路径.

Note: Above command assumes that yolov3.cfg, yolov3.weights and model_data(folder) are present at the same path as convert.py.

这篇关于如何从.cfg文件中加载Darknet YOLOv3模型并从.weights文件中加载权重,并将带有权重的模型保存到.h5文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆