示例#1
0
 def __init__(self, opt):
     super(DddLoss, self).__init__()
     self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()
     self.crit_reg = L1Loss()
     self.crit_kp = RegWeightedL1Loss()
     self.crit_rot = BinRotLoss()
     self.opt = opt
示例#2
0
 def __init__(self, opt):
     super(DddLoss, self).__init__()
     self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()
     self.crit_reg = L1Loss()
     self.crit_rot = BinRotLoss()
     self.opt = opt
     self.emb_scale = 1
示例#3
0
 def __init__(self, opt):
     super(DddLoss, self).__init__()
     self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()
     self.crit_reg = L1Loss()
     self.crit_rot = BinRotLoss()
     self.dept_reg = ConfidenceLoss()
     self.opt = opt
示例#4
0
 def __init__(self, opt):
     super(Det3dLoss, self).__init__()
     print("Using MSE loss for clasification = ", opt.mse_loss)
     self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()
     self.crit_view_side = CrossEntropyLossWMask()
     self.crit_view_front_rear = CrossEntropyLossWMask()
     self.crit_reg = L1Loss()
     self.opt = opt
示例#5
0
    def __init__(self, opt):
        super(DddLoss, self).__init__()
        self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()
        self.crit_reg = L1Loss()
        self.crit_rot = BinRotLoss()

        self.depth_reg = L2Loss()
        self.dim_reg = L2Loss()
        self.vec_reg = L1Loss_ver()
        self.opt = opt
示例#6
0
def build_loss_criterion(cfg):
    losses = cfg.TRAIN.losses
    weight_classes = cfg.DATASET.weight_classes
    img_loss = L1Loss(losses.il) if losses.il else None
    per_loss = PerceptualLoss(
        {'conv5_4': 1}, perceptual_weight=losses.per) if losses.per else None
    adv_loss = GANLoss('vanilla',
                       loss_weight=losses.adv) if losses.adv else None
    tv_loss = WeightedTVLoss(losses.tv) if losses.tv else None
    seg_loss = SegLoss(losses.seg, weight_classes) if losses.seg else None
    return (img_loss, per_loss, adv_loss, tv_loss, seg_loss)
示例#7
0
    def __init__(self, opt):
        super(DddLoss, self).__init__()
        # 定义损失函数
        self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()

        # L1损失函数
        self.crit_reg = L1Loss()

        # 混合连续-离散损失:multiBin损失
        self.crit_rot = BinRotLoss()
        self.opt = opt
 def __init__(self, opt):
     super(CarPose6DoFLoss, self).__init__()
     self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss()
     self.crit_reg = L1Loss()
     self.crit_xyz = DenseLocL1Loss()
     self.opt = opt
示例#9
0
 def __init__(self, opt):
     self.opt = opt
     self.crit = FocalLoss()
     self.crit_reg = L1Loss()
     self.crit_wh = self.crit_reg