コード例 #1
0
ファイル: trainer.py プロジェクト: zju-wangchuankun/DEFT
 def __init__(self, opt):
     super(GenericLoss, self).__init__()
     self.crit = FastFocalLoss(opt=opt)
     self.crit_reg = RegWeightedL1Loss()
     if "rot" in opt.heads:
         self.crit_rot = BinRotLoss()
     if "nuscenes_att" in opt.heads:
         self.crit_nuscenes_att = WeightedBCELoss()
     self.opt = opt
コード例 #2
0
 def __init__(self, opt):
     super(MultiPoseLoss, self).__init__()
     self.crit = FocalLoss()
     self.crit_hm_hp = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()
     self.crit_kp = RegWeightedL1Loss() if not opt.dense_hp else \
                    torch.nn.L1Loss(reduction='sum')
     self.crit_reg = RegL1Loss() if opt.reg_loss == 'l1' else \
                     RegLoss() if opt.reg_loss == 'sl1' else None
     self.opt = opt
コード例 #3
0
 def __init__(self, opt):
     super(GenericLoss, self).__init__()
     self.crit = FastFocalLoss(opt=opt)
     self.crit_reg = RegWeightedL1Loss()
     if "rot" in opt.heads:
         self.crit_rot = BinRotLoss()
     if "nuscenes_att" in opt.heads:
         self.crit_nuscenes_att = WeightedBCELoss()
     self.opt = opt
     self.s_det = nn.Parameter(torch.ones(1))
     self.s_id = nn.Parameter(torch.ones(1))
コード例 #4
0
 def __init__(self, opt):
     super(GenericLoss, self).__init__()
     self.crit = FastFocalLoss(opt=opt)
     self.crit_reg = RegWeightedL1Loss()
     if 'rot' in opt.heads:
         self.crit_rot = BinRotLoss()
     if 'nuscenes_att' in opt.heads:
         self.crit_nuscenes_att = WeightedBCELoss()
     self.opt = opt
     ##### track seg
     self.crit_seg = SegLoss2()
コード例 #5
0
 def __init__(self, opt):
   super(GenericLoss, self).__init__()
   self.crit = FastFocalLoss(opt=opt)
   self.crit_reg = RegWeightedL1Loss()
   if 'rot' in opt.heads:
     self.crit_rot = BinRotLoss()
   if 'nuscenes_att' in opt.heads:
     self.crit_nuscenes_att = WeightedBCELoss()
   self.opt = opt
   if opt.trades:
     self.crit_cost_volume_1d = CostVolumeLoss1D()
コード例 #6
0
 def __init__(self, opt):
     super(GenericLoss, self).__init__()
     self.crit = FastFocalLoss(opt=opt)
     self.crit_reg = RegWeightedL1Loss()
     if 'rot' in opt.heads:
         self.crit_rot = BinRotLoss()
     if 'nuscenes_att' in opt.heads:
         self.crit_nuscenes_att = WeightedBCELoss()
     if 'traffic_light' in opt.heads:
         self.light_loss = nn.CrossEntropyLoss()
     self.opt = opt