如何加载参考.caffemodel进行训练 [英] how to load reference .caffemodel for training

查看:252
本文介绍了如何加载参考.caffemodel进行训练的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用alexnet训练自己的数据集. caffe中的示例代码随

I'm using alexnet to train my own dataset. The example code in caffe comes with

bvlc_reference_caffenet.caffemodel
solver.prototxt
train_val.prototxt
deploy.prototxt

当我使用以下命令进行训练时:

When I train with the following command:

./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver.prototxt

我想从bvlc_reference.caffenet.caffemodel中给出的权重开始.

I'd like to start with weights given in bvlc_reference.caffenet.caffemodel.

我的问题是

  1. 我该怎么做?

  1. How do I do that?

从这些权重开始是个好主意吗?这会收敛得更快吗?如果我的数据与Imagenet数据集有很大不同,这会不好吗?

Is it a good idea to start from the those weights? Would this converge faster? Would this be bad if my data are vastly different from the Imagenet dataset?

推荐答案

1.
为了使用现有的.caffemodel权重进行微调,您需要使用--weights命令行参数:

1.
In order to use existing .caffemodel weights for fine-tuning, you need to use --weights command line argument:

./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver.prototxt --weights=models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel 

2.
在大多数情况下,即使输入的图像与"imagenet"照片完全不同,还是建议您对网络进行微调.
但是,您应注意,在训练您将要使用的原始重量时,会做出一些(非常合理的)假设.您应该确定这些假设是否仍然适用于您的任务.
例如,大多数网络都使用图像及其水平翻转进行简单的数据增强训练.但是,如果您的任务是区分被翻转的图像,您将发现很难进行微调.

2.
In most cases fine-tuning a net is quite a recommended practice, even when the input images are quite different than "imagenet" photos.
However, you should note that when training for the original weights you are about to use, some (very reasonable) assumptions were made. You should decide whether these assumptions are still true for your task.
For instance, most nets were trained with simple data augmentation using an image and its horizontal flip. However, if your task is to distinguish between images that are flipped you will find it very difficult to fine tune.

这篇关于如何加载参考.caffemodel进行训练的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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