Esempio n. 1
0
 def _get_edge_guidances(self, tensors):
     from utils.edge import get_edge
     guidances = []
     for batch_idx in range(tensors.size(0)):
         batch_edges = []
         for frame_idx in range(tensors.size(1)):
             edge = get_edge(tensors[batch_idx, frame_idx:frame_idx + 1])
             batch_edges.append(edge)
         guidances.append(torch.cat(batch_edges, dim=0))
     guidances = torch.stack(guidances)
     return guidances
 def edge_loss(self, output, target):
     from utils.edge import get_edge
     output_edge = get_edge(output)
     gt_edge = get_edge(target)
     loss = self.l1_loss(output_edge, gt_edge)
     return loss, output_edge, gt_edge