def forward(self): self.rgb_outputs = self.networks['RGB'](to_cuda(self.batch['input'])) self.depth_outputs = self.networks['DEPTH'](to_cuda( self.batch['input'])) self.loss = self.criterion() self.rgb_outputs = to_cpu(self.rgb_outputs) self.depth_outputs = to_cpu(self.depth_outputs)
def forward(self): assert len(self.networks) == 1, 'undefined forward method' name = self.networks.keys()[0] self.outputs = self.networks[name](to_cuda(self.batch['input'])) self.loss = self.criterion() self.outputs = to_cpu(self.outputs)
def forward(self): assert len(self.networks) == 1, 'undefined forward method' # xx = to_cuda(self.batch['input']) # print("cuda", xx['img'].cuda().is_cuda) name = self.networks.keys()[0] self.outputs = self.networks[name](to_cuda(self.batch['input'])) self.loss = self.criterion() self.outputs = to_cpu(self.outputs)
def forward(self): self.outputs = self.networks['Regression'](to_cuda(self.batch['input'])) root_depth = self.batch['root_depth'] index_bone_length = self.batch['index_bone_length'] depthmap_max = self.batch['depthmap_max'] depthmap_range = self.batch['depthmap_range'] reg_input = torch.zeros(self.batch['coor3d'].shape).cuda() reg_input[:, :, :2] = self.batch['coor2d'][:, :, :2].cuda().clone() reg_input[:, :, 2] = self.outputs['depth'] * index_bone_length.unsqueeze(1).cuda() + root_depth.unsqueeze(1).cuda() reg_input[:, :, 2] = (depthmap_max.unsqueeze(1).cuda() - reg_input[:, :, 2]) / depthmap_range.unsqueeze(1).cuda() reg_input = reg_input.view(reg_input.size(0), -1, 1, 1) self.outputs = self.networks['DepthRegularizer'](reg_input).squeeze() self.loss = self.criterion()
def forward(self): # print (self.real_A) self.fake_B = self.netG(self.real_A) task_input = {'img':self.real_A, 'depthmap': self.fake_B} self.task_outputs = self.networks['Regression'](to_cuda(task_input)) root_depth = self.batch['root_depth'] index_bone_length = self.batch['index_bone_length'] depthmap_max = self.batch['depthmap_max'] depthmap_range = self.batch['depthmap_range'] reg_input = torch.zeros(self.batch['coor3d'].shape).cuda() reg_input[:, :, :2] = self.batch['coor2d'][:, :, :2].cuda().clone() reg_input[:, :, 2] = self.task_outputs['depth'] * index_bone_length.unsqueeze(1).cuda() + root_depth.unsqueeze(1).cuda() reg_input[:, :, 2] = (depthmap_max.unsqueeze(1).cuda() - reg_input[:, :, 2]) / depthmap_range.unsqueeze(1).cuda() reg_input = reg_input.view(reg_input.size(0), -1, 1, 1) self.task_outputs['depthmap'] = self.networks['DepthRegularizer'](reg_input).squeeze() self.task_loss = self.TaskLoss() self.task_outputs = to_cpu(self.task_outputs)