Beispiel #1
0
    def losses(self, outputs):
        logits, feats, targets = outputs
        loss_dict = {}
        loss_dict.update(
            reid_losses(self._cfg, logits[0], feats[0], targets, 'b1_'))
        loss_dict.update(
            reid_losses(self._cfg, logits[1], feats[1], targets, 'b2_'))
        loss_dict.update(
            reid_losses(self._cfg, logits[2], feats[2], targets, 'b3_'))
        loss_dict.update(
            reid_losses(self._cfg, logits[3], feats[3], targets, 'b21_'))
        loss_dict.update(
            reid_losses(self._cfg, logits[5], feats[4], targets, 'b31_'))

        part_ce_loss = [(CrossEntropyLoss(self._cfg)(logits[4], None,
                                                     targets), 'b22_'),
                        (CrossEntropyLoss(self._cfg)(logits[6], None,
                                                     targets), 'b32_'),
                        (CrossEntropyLoss(self._cfg)(logits[7], None,
                                                     targets), 'b33_')]
        named_ce_loss = {}
        for item in part_ce_loss:
            named_ce_loss[item[1] + [*item[0]][0]] = [*item[0].values()][0]
        loss_dict.update(named_ce_loss)
        return loss_dict
Beispiel #2
0
 def losses(self, outputs):
     pred_logits, global_feat, fore_pred_logits, fore_feat, targets = outputs
     loss_dict = {}
     loss_dict.update(
         reid_losses(self._cfg, pred_logits, global_feat, targets,
                     'avg_branch_'))
     loss_dict.update(
         reid_losses(self._cfg, fore_pred_logits, fore_feat, targets,
                     'fore_branch_'))
     return loss_dict
Beispiel #3
0
 def losses(self, outputs):
     logits, feat, targets = outputs
     return reid_losses(self._cfg, logits, feat, targets)