Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fine-tuning #8

Open
limin1130 opened this issue Jul 28, 2017 · 29 comments
Open

fine-tuning #8

limin1130 opened this issue Jul 28, 2017 · 29 comments

Comments

@limin1130
Copy link

Thanks for sharing!
I want to fine-tuning the model. Is there train-val.prototxt and solver.prototxt survive? Thank you.

@shicai
Copy link
Owner

shicai commented Jul 28, 2017

All these models are converted from https://github.com/liuzhuang13/DenseNet
So you can ask Zhuang Liu for more details.

@limin1130
Copy link
Author

我是想基于你发布的caffe模型进行微调,因为看到你发布的prototxt的layer名与Zhuang Liu发布的配置文件不同,所以想问问你进行训练时用的配置文件

@shicai
Copy link
Owner

shicai commented Jul 28, 2017

finetuning很简单,你在开头加data层,结尾加loss/acc层,改变fc6的名字和类别。
注意用param { lr_mult: 0 decay_mult: 0 }固定batchnorm层的参数

@gittigxuy
Copy link

那请问一下,data层的crop_size必须指定为ImageNet里面的224*224的吗?你这个应该是deploy.prototxt吧?100多MB的caffemodel是准确率最高的caffemodel吗?然后我能否利用你已经上传的DenseNet的caffemodel来进行图片的性别分类呢?还是需要重新利用你给的网络模型结构来进行训练呢?

@shicai
Copy link
Owner

shicai commented Aug 2, 2017

data层crop_size在训练的时候是224,你可以不指定到这个大小。
这是deploy文件,准确率已经写在表格里。
可以,你可以利用这个预训练模型,也可以自己从头训练,你自己看着办都行。

@limin1130
Copy link
Author

使用161 fine-tuning 的时候,使用的图片是224*224,
train batchsize=64,出现error == cudaSuccess (2 vs. 0) out of memory
改成batchsize=2,还是报错,检查显卡使用了11G多,显卡用的是K40
改batchsize=1,运行train成功,显卡使用2000M的样子,奇怪,怎么改成batchsize=1,会降低那么多,是哪里有问题吗?
另外,finetuning的时候发现loss震荡较大。

@OPPOA113
Copy link

OPPOA113 commented Aug 2, 2017

@shicai
你好 网络有实验过检测任务吗 效果会怎样?

@shicai
Copy link
Owner

shicai commented Aug 3, 2017

@limin1130 关于显存,作者最近提出了一个内存优化的方案,见论文《Memory-Efficient Implementation of DenseNets

@OPPOA113 我自己没用DenseNet做过检测,不过作者透露将很快发布一篇论文,使用DenseNet做检测也能获得state of the art的结果。所以,DenseNet做检测应该没什么问题。

@gittigxuy
Copy link

@OPPOA113
用DenseNet做检测任务已经做好了吗?

@OPPOA113
Copy link

@gittigxuy
NO 做过自己的数据的分类实验,参数没调试好,效果不理想。你那边可有检测?

@gittigxuy
Copy link

@OPPOA113 ,我还没做检测,我做图片2分类,但是效果不太理想,可能是初学的原因吧,再略加修改一下,你那的图片分类的项目代码可否给我看一下?如果可以的话,麻烦发邮件到1262485779@qq.com,谢谢了

@OPPOA113
Copy link

@gittigxuy
就是caffe的代码训练的cifar10 没有什么其他的代码

@limin1130
Copy link
Author

我训练的时候,accuracy一直为0,这个是怎么回事

@gittigxuy
Copy link

@shicai ,求大佬给个用到DenseNet的项目案例,我train - loss图波动很大,找不到原因

@yefanhust
Copy link

Hi, 我从零开始训练DenseNet121,将fc6换成InnerProduct layer,然后加上Accuracy和SoftmaxWithLoss,loss基本不变,accuracy一直为0。是什么原因呢?

@shicai
Copy link
Owner

shicai commented Sep 4, 2017

@yefanhust 只凭你的只言片语,我也不确定原因是什么。即使是随机的初始化,accuracy也会接近0.1%,不会是0的。

@yefanhust
Copy link

DenseNet121.txt
@shicai 这里附上我修改过的DenseNet121.prototxt neng 能麻烦帮我看下吗?训练中loss和accuracy一直停留在最初的水平。

@yefanhust
Copy link

@shicai 再附上solver的config,完全是按照原始paper中的数据设置的。
solver.txt

@shicai
Copy link
Owner

shicai commented Sep 4, 2017

@yefanhust (1) 确定你的batch size是256,我看文件中是8;(2) 如果从头训练,需要给Convolution和Scale层加上param参数,控制lr和wd,有几个参数就加几个param,比如conv不带bias就加一个,scale层带bias就加两个:param { lr_mult: 1 decay_mult: 0 }

@yefanhust
Copy link

yefanhust commented Sep 4, 2017

@shicai (1) 在服务器上训练时是256,8是在单机上测试用的 (2) 好的,我会根据你的建议加上相应的参数
谢谢

@nerddd
Copy link

nerddd commented Nov 25, 2017

@yefanhust 请问你训练的时候256,为什么我训练的时候batch_size为10,都out of memory,我的显卡是GeForce GTX TITAN X

@yefanhust
Copy link

@nerddd 我是在DGX-1上训练的,用的8块P100

@xiaocmxiao
Copy link

@shicai
你好。我用你提供的deploy改写的train_val进行训练,loss一直是2.5左右,不下降。我改train_val只改了开头的数据层和在结尾加了accuracy和softmaxwithloss,请问还有哪里需要修改?

@jackchowtop1
Copy link

@yefanhust 想问一下你问题解决了吗?解决了的话,可不可以给看一下修改后的prototxt文件?

@yefanhust
Copy link

我是用python重写了一遍网络结构再生成的prototxt 没用这里的

@RuWang15
Copy link

I modified the prototxt according to the comments under this issue. The only difference is that my batchsize is 10, and the loss does not converge and it explodes. I wonder must the batchsize be 256? And is there a correct version of train_val.prototxt for densenet?

@JaosonMa
Copy link

JaosonMa commented May 9, 2018

@yefanhust 你可以把你的生成densenet的python脚本分享一下吗?或者将densenet-caffe的train_test.prototxt和solver.prototxt分享一下,我的邮箱 809631003@qq.com
谢谢

@Joeyeee
Copy link

Joeyeee commented Jul 15, 2018

@yefanhust 四块P100表示hold不住batchsize256 多显卡跑caffe 你的cudnn禁用了么

@XUYUNYUN666
Copy link

@shicai
你好。我用你提供的deploy改写的train_val进行训练,loss一直是2.5左右,不下降。我改train_val只改了开头的数据层和在结尾加了accuracy和softmaxwithloss,请问还有哪里需要修改?

请问能加个联系方式吗?我也准备finetuning ,也只是改了开头和加了结尾,我的QQ1443563995

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests