xxradon / PytorchToCaffe

Pytorch model to caffe model, supported pytorch 0.3, 0.3.1, 0.4, 0.4.1 ,1.0 , 1.0.1 , 1.2 ,1.3 .notice that only pytorch 1.1 have some bugs
MIT License
782 stars 224 forks source link

在遇到池化层的时候报错 #86

Open ZZHHogan opened 4 years ago

ZZHHogan commented 4 years ago

cnn.conv3 conv: batch_norm_blob2 conv6 was added to layers 144541320:conv_blob6 was added to blobs cnn.relu3 relu4 was added to layers 144541720:relu_blob4 was added to blobs cnn.convproject3 conv: relu_blob4 conv7 was added to layers 144541560:conv_blob7 was added to blobs cnn.pooling2 max_pool2 was added to layers 144541480:max_pool_blob2 was added to blobs Traceback (most recent call last): File "E:/pro/PytorchToCaffe-master/example/testConvert.py", line 229, in pytorch_to_caffe.trans_net(net,input,name) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 789, in trans_net out = net.forward(input_var) File "E:/pro/PytorchToCaffe-master/example/testConvert.py", line 116, in forward conv = self.cnn(input) File "E:\anaconda\lib\site-packages\torch\nn\modules\module.py", line 493, in call result = self.forward(*input, kwargs) File "E:\anaconda\lib\site-packages\torch\nn\modules\container.py", line 92, in forward input = module(input) File "E:\anaconda\lib\site-packages\torch\nn\modules\module.py", line 493, in call result = self.forward(*input, *kwargs) File "E:\anaconda\lib\site-packages\torch\nn\modules\pooling.py", line 146, in forward self.return_indices) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 693, in call out=self.obj(self.raw,args,kwargs) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 186, in _max_pool2d _pool('max',raw,input, x, kernel_size, stride, padding,ceil_mode) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 170, in _pool pad=padding, type=type.upper() , ceil_mode = ceil_mode) File "E:\pro\PytorchToCaffe-master\Caffe\layer_param.py", line 117, in pool_param pool_param.stride=pair_process(stride) File "E:\pro\PytorchToCaffe-master\Caffe\layer_param.py", line 10, in pair_process raise ValueError("number in item {} must be the same".format(item)) ValueError: number in item (2, 1) must be the same

yanty123 commented 4 years ago

请问兄弟拟解决这个问题了吗,好像是这个avg要求输入图像的长宽一致

yanzhou-li commented 3 years ago

cnn.conv3 conv: batch_norm_blob2 conv6 was added to layers 144541320:conv_blob6 was added to blobs cnn.relu3 relu4 was added to layers 144541720:relu_blob4 was added to blobs cnn.convproject3 conv: relu_blob4 conv7 was added to layers 144541560:conv_blob7 was added to blobs cnn.pooling2 max_pool2 was added to layers 144541480:max_pool_blob2 was added to blobs Traceback (most recent call last): File "E:/pro/PytorchToCaffe-master/example/testConvert.py", line 229, in pytorch_to_caffe.trans_net(net,input,name) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 789, in trans_net out = net.forward(input_var) File "E:/pro/PytorchToCaffe-master/example/testConvert.py", line 116, in forward conv = self.cnn(input) File "E:\anaconda\lib\site-packages\torch\nn\modules\module.py", line 493, in call result = self.forward(*input, kwargs) File "E:\anaconda\lib\site-packages\torch\nn\modules\container.py", line 92, in forward input = module(input) File "E:\anaconda\lib\site-packages\torch\nn\modules\module.py", line 493, in call result = self.forward(*input, kwargs) File "E:\anaconda\lib\site-packages\torch\nn\modules\pooling.py", line 146, in forward self.return_indices) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 693, in call* out=self.obj(self.raw,args,kwargs) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 186, in _max_pool2d _pool('max',raw,input, x, kernel_size, stride, padding,ceil_mode) File "E:\pro\PytorchToCaffe-master\pytorch_to_caffe.py", line 170, in _pool pad=padding, type=type.upper() , ceil_mode = ceil_mode) File "E:\pro\PytorchToCaffe-master\Caffe\layer_param.py", line 117, in pool_param pool_param.stride=pair_process(stride) File "E:\pro\PytorchToCaffe-master\Caffe\layer_param.py", line 10, in pair_process raise ValueError("number in item {} must be the same".format(item)) ValueError: number in item (2, 1) must be the same

@hhhhhhogan @yanty123 ,Hi ,I also have met this problem.Have you solved the problem?Can you give me some advise. thank you