在GoogLeNet中修改Deploy.prototxt [英] Modifying Deploy.prototxt in GoogLeNet

查看:377
本文介绍了在GoogLeNet中修改Deploy.prototxt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了经过预训练的GoogLeNet,然后在我的数据集中对其进行了微调,以解决二进制分类问题.验证数据集似乎给出了"loss3/top1" 98.5%.但是,当我在评估数据集上评估性能时,它可以为我提供50%的准确性.无论我进行了什么更改train_val.prototxt,我都对deploy.prototxt进行了相同的更改,但是我不确定在这些行中应该进行哪些更改.

I used pre-trained GoogLeNet and then fine tuned it on my dataset for binary classification problem. Validation dataset seems to give the "loss3/top1" 98.5%. But when I evaluating the performance on my evaluation dataset it gives me 50% accuracy. Whatever changes I did it train_val.prototxt, I did the same changes in deploy.prototxt and I am not sure what changes should I do in these lines.

name: "GoogleNet"
layer {
  name: "data"
  type: "input"
  top: "data"
  input_param { shape: { dim:10 dim:3 dim:224 dim:224 } }
}

任何建议???

推荐答案

您无需在deploy.prototxt *中进一步更改任何内容,而只需将数据馈送到网络即可.您必须以与转换训练/验证图像相同的方式来转换评估图像.
例如,请参见 classifier.py 通过正确初始化的caffe.io.Transformer类放置输入图像.

You do not need to change anything further in your deploy.prototxt*, but in the way you feed the data to the net. You must transform your evaluation images in the same way you transformed your training/validation images.
See, for example, how classifier.py puts the input images through a properly initialized caffe.io.Transformer class.

prototxt中的"Input"层只是一个声明,用于caffe根据形状为10-by-3-by-224-by-224的输入blob分配内存.

The "Input" layer you have in the prototxt is merely a declaration for caffe to allocate memory according to an input blob of shape 10-by-3-by-224-by-224.

*当然,您必须验证train_val.prototxtdeploy.prototxt是否完全相同(除了输入层和损耗层):包括确保层名称相同,因为caffe使用层名称将'caffemodel'文件中的权重分配给它加载的实际参数.名称不匹配会导致Caffe对某些图层使用随机权重.

* of course, you must verify that train_val.prototxt and deploy.prototxt are exactly the same (apart from the input layer(s) and loss layer(s)): that includes making sure layer names are identical as caffe uses layer names to assign weights from 'caffemodel' file to the actual parameters it loads. Mismatching names will cause caffe to use random weights for some of the layers.

这篇关于在GoogLeNet中修改Deploy.prototxt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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