Open lunalulu opened 5 years ago
目前不支持双输入。------------------ 原始邮件 ------------------ 发件人: "lunalulu"notifications@github.com 发送时间: 2019年4月15日(星期一) 下午4:39 收件人: "xxradon/PytorchToCaffe"PytorchToCaffe@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: [xxradon/PytorchToCaffe] 可以转换两个输入的网络吗? (#12)
你好,请问本工程是否可以转换类似双流处理的网络,他的forward函数如下:
def forward(self, x,target=None): N, C, T, V, M = x.size() # N0, C1, T2, V3, M4 motion = x[:,:,1::,:,:]-x[:,:,0:-1,:,:] motion = motion.permute(0,1,4,2,3).contiguous().view(N,C*M,T-1,V) motion = F.upsample(motion, size=(T,V), mode='bilinear',align_corners=False).contiguous().view(N,C,M,T,V).permute(0,1,3,4,2) logits = [] for i in range(self.num_person): # position # N0,C1,T2,V3 point-level out = self.conv1(x[:,:,:,:,i]) out = self.conv2(out) # N0,V1,T2,C3, global level out = out.permute(0,3,2,1).contiguous() out = self.conv3(out) out_p = self.conv4(out) # motion # N0,T1,V2,C3 point-level out = self.conv1m(motion[:,:,:,:,i]) out = self.conv2m(out) # N0,V1,T2,C3, global level out = out.permute(0, 3, 2, 1).contiguous() out = self.conv3m(out) out_m = self.conv4m(out) # concat out = torch.cat((out_p,out_m),dim=1) out = self.conv5(out) out = self.conv6(out) logits.append(out) # max out logits out = torch.max(logits[0], logits[1]) out = out.view(out.size(0), -1) out = self.fc7(out) out = self.fc8(out) t = out print(t) assert not ((t != t).any())# find out nan in tensor assert not (t.abs().sum() == 0) # find out 0 tensor return out 第二个输入是根据第一个输入计算得到的,函数总的motion,我在转换的时候错误提示为: Traceback (most recent call last): File "hcn/convert.py", line 297, in pytorch_to_caffe.trans_net(model,x,name) File "./pytorch_to_caffe.py", line 625, in trans_net out = net.forward(input_var) File "hcn/convert.py", line 159, in forward motion = x[:,:,1::,:,:]-x[:,:,0:-1,:,:] File "./pytorch_to_caffe.py", line 476, in _sub b1 = log.blobs(input) File "./pytorch_to_caffe.py", line 91, in blobs print(self._blobs[var]) File "./pytorch_to_caffe.py", line 32, in getitem return self.data[key] KeyError: 140445193528256
请帮忙看下,是否支持此类模型的转换~非常感谢
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
OK,谢谢~
你好,两个输出的网络呢?
@mittlin 双输出肯定支持的呢,事实上支持多输出。
@xxradon 你好,能帮忙看下这个问题吗? 在转BFE模型时报错, 定义在https://github.com/daizuozhuo/batch-feature-erasing-network/blob/master/models/networks.py
File "./pytorch_to_caffe.py", line 612, in trans_net out = net.forward(input_var) File "./bfe/networks.py", line 223, in forward global_triplet_feature = self.global_reduction(glob).squeeze() File "/opt/anaconda3/envs/pytorch04/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, kwargs) File "/opt/anaconda3/envs/pytorch04/lib/python3.6/site-packages/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/opt/anaconda3/envs/pytorch04/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, *kwargs) File "/opt/anaconda3/envs/pytorch04/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 301, in forward self.padding, self.dilation, self.groups) File "./pytorch_to_caffe.py", line 534, in call out=self.obj(self.raw,args,kwargs) File "./pytorch_to_caffe.py", line 103, in _conv2d bottom=[log.blobs(input)], top=[log.blobs(x)]) File "./pytorch_to_caffe.py", line 88, in blobs print("{}:{} getting".format(var, self._blobs[var])) File "./pytorch_to_caffe.py", line 31, in getitem return self.data[key] KeyError: 140637903940200
@xxradon 你好,请问如何修改代码转双输入网络,例如siamrpn,谢谢
将双入转成单输入
你好,请问本工程是否可以转换类似双流处理的网络,他的forward函数如下: ` def forward(self, x,target=None): N, C, T, V, M = x.size() # N0, C1, T2, V3, M4 motion = x[:,:,1::,:,:]-x[:,:,0:-1,:,:] motion = motion.permute(0,1,4,2,3).contiguous().view(N,C*M,T-1,V) motion = F.upsample(motion, size=(T,V), mode='bilinear',align_corners=False).contiguous().view(N,C,M,T,V).permute(0,1,3,4,2)
第二个输入是根据第一个输入计算得到的,函数总的motion,我在转换的时候错误提示为:
Traceback (most recent call last): File "hcn/convert.py", line 297, in