crlong33 发表于 2024-1-16 17:55

yolo如何导出.weights和.cfg

各位老师好,最近新接触一个opencv库中的函数cv::dnn::readnet()函数;
      参数1是yolo训练好的模型.weights后缀文件,
      参数2是超参数.cfg后缀的文件。
如何才能得到这2个后缀的文件呢(*.weigthts和*.cfg),或者其他的也行,因为yolov8训练好的都是*.pt和*.yaml配套。网上还可以发现能导出*.onnx,但是第二个参数怎么整呀?
如何导出一套来呢?只要能用上readnet函数就可以。


官网解释:

Net cv::dnn::readNet(const String & model,
const String & config = "",
const String & framework = ""
)

Python:
cv.dnn.readNet(model[, config[, framework]]) ->retval
cv.dnn.readNet(framework, bufferModel[, bufferConfig]) ->retval
Parameters
modelBinary file contains trained weights. The following file extensions are expected for models from different frameworks:
[*]*.caffemodel (Caffe, http://caffe.berkeleyvision.org/)
[*]*.pb (TensorFlow, https://www.tensorflow.org/)
[*]*.t7 | *.net (Torch, http://torch.ch/)
[*]*.weights (Darknet, https://pjreddie.com/darknet/)
[*]*.bin (DLDT, https://software.intel.com/openvino-toolkit)
[*]*.onnx (ONNX, https://onnx.ai/)

configText file contains network configuration. It could be a file with the following extensions:
[*]*.prototxt (Caffe, http://caffe.berkeleyvision.org/)
[*]*.pbtxt (TensorFlow, https://www.tensorflow.org/)
[*]*.cfg (Darknet, https://pjreddie.com/darknet/)
[*]*.xml (DLDT, https://software.intel.com/openvino-toolkit)

frameworkExplicit framework name tag to determine a format.

cattie 发表于 2024-1-16 18:09

opencv不支持yolov8,要用v8的话直接用pytorch/tensorflow/openvino框架加载pt文件就行

https://docs.ultralytics.com/quickstart/#use-ultralytics-with-cli

crlong33 发表于 2024-1-16 19:27

cattie 发表于 2024-1-16 18:09
opencv不支持yolov8,要用v8的话直接用pytorch/tensorflow/openvino框架加载pt文件就行

https://docs.ul ...

老师,我恰恰反过来了,我想用opencv,哈哈哈,有办法吗

cattie 发表于 2024-1-16 19:30

crlong33 发表于 2024-1-16 19:27
老师,我恰恰反过来了,我想用opencv,哈哈哈,有办法吗

opencv也是集成了yolo这个模型,cv图形处理用opencv居多,目标检测还真没必要非得用这个。

Eaglecad 发表于 2024-1-16 19:44

opencv好像有个 这个openvino玩意,是个扩展模块好像,你百度搞下。
页: [1]
查看完整版本: yolo如何导出.weights和.cfg