以YOLO为例进行微调和转移学习 [英] Fine-tuning and transfer learning by the example of YOLO

查看:1709
本文介绍了以YOLO为例进行微调和转移学习的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于微调和转移学习的一般性问题,当我试图弄清楚如何最好地让yolo来检测我的自定义对象(手)时出现了这个问题.

I have a general question regarding fine-tuning and transfer learning, which came up when I tried to figure out how to best get yolo to detect my custom object (being hands).

我很抱歉可能包含很多错误信息的长文本.如果有人有耐心地阅读它并帮助我消除混乱,我将感到非常高兴.

I apologize for the long text possibily containing lots of false information. I would be glad if someone had the patience to read it and help me clear my confusion.

经过大量的搜索之后,我了解到许多人认为微调是迁移学习的一个子类,而其他人则认为他们在采用不同的方法来训练模型.同时,人们在重新训练自定义数据集上的模型的最后一个分类器层与重新训练模型的其他层(以及可能添加一个全新的分类器而不是重新训练?)之间进行区分.两种方法都使用预先训练的模型.

After lots of googling, I learned that many people regard fine-tuning to be a sub-class of transfer learning while others believe that they are to different approaches to training a model. At the same time, people differentiate between re-training only the last classifier layer of a model on a custom dataset vs. also re-training other layers of the model (and possbibly adding an enirely new classifier instead of retraining?). Both approaches use pre-trained models.

我最后的困惑在于:我遵循了以下指示: https://github.com/thtrieu/darkflow 使用以下命令通过darkflow训练微小的yolo:

My final confusien lies here: I followed these instructions: https://github.com/thtrieu/darkflow to train tiny yolo via darkflow, using the command:

# Initialize yolo-new from yolo-tiny, then train the net on 100% GPU: flow --model cfg/yolo-new.cfg --load bin/tiny-yolo.weights --train --gpu 1.0 但是这里发生了什么?我想我只训练分类器,因为指令说要更改配置文件中最后一层的类数.但是,同样,还需要更改倒数第二层即卷积层中的滤波器数量.

# Initialize yolo-new from yolo-tiny, then train the net on 100% GPU: flow --model cfg/yolo-new.cfg --load bin/tiny-yolo.weights --train --gpu 1.0 But what happens here? I suppose I only retrain the classifier because the instructions say to change the number of classes in the last layer in the configuration file. But then again, it is also required to change the number of filters in the second last layer, a convolutional layer.

最后,这些说明提供了替代培训的示例: # Completely initialize yolo-new and train it with ADAM optimizer flow --model cfg/yolo-new.cfg --train --trainer adam,我根本不理解这与转学的不同方式之间的关系.

Lastly, the instructions provide an example of an alternative training: # Completely initialize yolo-new and train it with ADAM optimizer flow --model cfg/yolo-new.cfg --train --trainer adam and I don't understand at all how this relates to the different ways of transfer learning.

推荐答案

如果您使用的是AlexeyAB的darknet回购协议(不是darkflow),他建议通过在cfg文件中设置以下参数来进行精细调整,而不是转移学习:.

If you are using AlexeyAB's darknet repo (not darkflow), he suggests to do Fine-Tuning instead of Transfer Learning by setting this param in cfg file : stopbackward=1 .

然后输入./darknet partial yourConfigFile.cfg yourWeightsFile.weights outPutName.LastLayer# LastLayer#,例如:

./darknet partial cfg/yolov3.cfg yolov3.weights yolov3.conv.81 81

它将创建yolov3.conv.81并将冻结较低的图层,然后您可以使用权重文件yolov3.conv.81而不是原始的darknet53.conv.74进行训练.

It will create yolov3.conv.81 and will freeze the lower layer, then you can train by using weights file yolov3.conv.81 instead of original darknet53.conv.74.

参考文献: https://github.com/AlexeyAB/darknet #how-to-improve-object-detection https://groups.google.com/forum/#!topic/darknet/mKkQrjuLPDU

这篇关于以YOLO为例进行微调和转移学习的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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