soeaver / caffe-model

Caffe models (including classification, detection and segmentation) and deploy files for famouse networks
MIT License
1.28k stars 624 forks source link

where download model #11

Closed yja1 closed 7 years ago

yja1 commented 7 years ago

could you give the url download premodel of 224*224 size thx!

soeaver commented 7 years ago

All the pre-train models fit 224x224 input, you just need to modify the deploy file's input layer to 224x224.

yja1 commented 7 years ago

I download this https://pan.baidu.com/s/1c6D150 inception_v4 caffemodel. my datasets is face,so my data size is 11296 and 160132(trained use small centerloss model). i try 224224 size, the result not well. until now the best result is 160132 size. today i want try inception_v4 model to train my face data (size 160*132). when i train, has error "Check failed: top_shape[j] == bottom[i]->shape(j)". i try many size, the most small size is 239x239 can run. if i train from premodel the size must 299x299 can run.

Thank you very much for your reply!

soeaver commented 7 years ago

This error is caused by the different feature maps rounding methods of the convolution layer and the pooling layer in caffe. I think https://github.com/BVLC/caffe/pull/3057/files may be useful for you

shicai commented 7 years ago

路过,其实LZ可以用中文问,应该没问题的。。。 (@yja1 you can ask your questions in Chinese...)

引起这个问题的根本原因在于Inception的精细设计,和原始Caffe之间的一小点不兼容。 Caffe的Conv在计算Feature Map的时候使用floor函数取整,而Pooling是使用ceil函数取整。 Inception虽然是全卷积的网络,但是其精细的设计(Conv和Pooling并行降采样Concat),要求在输入的时候要求Input size尽量是32x+43这样的一个数值(对应299的输入,x=8)。在Caffe中,当输入不是这样数值的时候,Conv和Pooling并行降采样时候,输入大小相同,但是取整函数不同导致输出大小不相同,所以报shape的错。

所以,PR3057在考虑对以往Caffe兼容性的前提下,给Pooling层引入一个新的参数ceil_mode(默认true兼容以前的模型),来判断Pooling的时候到底是采用floor还是ceil取整。这样可以更好地处理TensorFlow和Torch训练转换过来的模型(因为它们的Pooling默认是用floor取整的)。

soeaver commented 7 years ago

@shicai 哈哈,确实中文问就好了 caffe这点确实很烦人,感谢你的补充

yja1 commented 7 years ago

可以跑了。谢谢啦~ (我问的时候还寻思呢,是用中文呢,让大神去翻译再回答,还是用自己的农村英语呢)

shz0519 commented 7 years ago

@soeaver @yja1 您好!我在训练inception-v4时并没有报这个错误,但是在测试阶段却报: Check failed: top_shape[j] == bottom[i]->shape(j) (25 vs. 26) All inputs must have the same shape, except at concat_axis. 按照https://github.com/BVLC/caffe/pull/3057/files的方法修改并重新编译caffe后还是报同样的错误,我的input size为224*224,这是为什么呢

shz0519 commented 7 years ago

是否要将设置ceil_mode改为false呢?在哪修改呢?