def compute_loss(self, true_hm, true_wh, true_reg, reg_mask, ind, true_cls): hm_loss = loss.focal_loss(self.pred_hm, true_hm) * cfgs.HM_LOSS_WEIGHT wh_loss = loss.reg_l1_loss(self.pred_wh, true_wh, ind, reg_mask) * cfgs.WH_LOSS_WEIGHT reg_loss = loss.reg_l1_loss(self.pred_reg, true_reg, ind, reg_mask) * cfgs.REG_LOSS_WEIGHT cls_loss = loss.cross_entropy_loss(self.pred_cls, true_cls, reg_mask) * cfgs.CLS_LOSS_WEIGHT return hm_loss, wh_loss, reg_loss, cls_loss
def compute_loss(self): self.cls_loss = loss.focal_loss(self.pred_cls, self.cls_gt) self.size_loss = loss.reg_l1_loss(self.pred_size, self.size_gt) self.total_loss = self.cls_loss + 0.1 * self.size_loss
def compute_loss(self, true_hm, true_wh, true_reg, reg_mask, ind): hm_loss = loss.focal_loss(self.pred_hm, true_hm) wg_loss = 0.05*loss.reg_l1_loss(self.pred_wh, true_wh, ind, reg_mask) reg_loss = loss.reg_l1_loss(self.pred_reg, true_reg, ind, reg_mask) return hm_loss, wg_loss, reg_loss
def compute_loss(self): self.cls_loss = loss.focal_loss(self.pred_center, self.center_gt) self.size_loss = loss.reg_l1_loss(self.pred_size, self.size_gt) self.offset_loss = loss.reg_l1_loss(self.pred_offset, self.offset_gt) # self.regular_loss=cfg.weight_decay * tf.add_n([tf.nn.l2_loss(var) for var in tf.trainable_variables()]) self.total_loss = self.cls_loss + 0.1 * self.size_loss + self.offset_loss #+self.regular_loss