nerddd / SSRNet-caffe

SSRNet from keras to caffe
7 stars 3 forks source link

请问ssrnet转caffe,有没遇到dense层shape对不上的问题? #2

Closed lwplw closed 5 years ago

lwplw commented 6 years ago

layer: dense_1 Traceback (most recent call last): File "convert_ssrnet.py", line 29, in keras2caffe.convert(model, 'ssrnet.prototxt', 'ssrnet.caffemodel') File "/home/lwp/beednprojects/keras2caffe/keras2caffe-3/keras2caffe.py", line 403, in convert caffe_model.params[layer][n].data[...] = net_params[layer][n] ValueError: could not broadcast input array from shape (3,160) into shape (3,250)

nerddd commented 6 years ago

有,是因为tf和caffe 对于padding采用的是不同方式,tf里面的pad分为valid和same两种模式,默认为valid(原ssrnet),但是caffe 采用的是same方式,所以需要重新指定训练,可以采用我提供的SSR-Net目录下的脚本自己重新训练一下,再转化

lwplw commented 6 years ago

非常感谢回复,以为是dense层的问题,想起来tf和caffe的处理机制不同,caffe中的pooling层有个向上取整的操作,刚好feature map大小两边对应不上,最后我改了caffe的源码,就当是ssrnet的定制版了,目前转换已完成。https://blog.csdn.net/lwplwf/article/details/82418110

indolant commented 6 years ago

I1112 03:44:32.535120 6105 solver.cpp:414] Test net output #0: accuracy = 0.0179104 I1112 03:44:32.535167 6105 solver.cpp:414] Test net output #1: loss = 38.5024 I1112 03:44:34.301174 6105 solver.cpp:239] Iteration 2100 (49.6661 iter/s, 7.04706s/350 iters), loss = 5.30641 I1112 03:44:34.301216 6105 solver.cpp:258] Train net output #0: accuracy_train = 0.6 I1112 03:44:34.301228 6105 solver.cpp:258] Train net output #1: loss = 5.30641 (* 1 = 5.30641 loss) 大佬请问我的trainloss可以下降,为什么test的loss一直很高反而增加

nerddd commented 6 years ago

可能是过拟合了吧

ReedZyd commented 5 years ago

非常感谢回复,以为是dense层的问题,想起来tf和caffe的处理机制不同,caffe中的pooling层有个向上取整的操作,刚好feature map大小两边对应不上,最后我改了caffe的源码,就当是ssrnet的定制版了,目前转换已完成。https://blog.csdn.net/lwplwf/article/details/82418110

May I ask you for your caffe model?Thanks very much.

liangheng commented 5 years ago

非常感谢回复,以为是dense层的问题,想起来tf和caffe的处理机制不同,caffe中的pooling层有个向上取整的操作,刚好feature map大小两边对应不上,最后我改了caffe的源码,就当是ssrnet的定制版了,目前转换已完成。https://blog.csdn.net/lwplwf/article/details/82418110 @lwplw 你好 怎么修改caffe源码 pooling的w、h不要向上取整?可以提供下你修改的截图吗 多谢了