def create_loss(self, gt, alpha): loss_coarse = chamfer(self.coarse, gt) add_train_summary('train/coarse_loss', loss_coarse) update_coarse = add_valid_summary('valid/coarse_loss', loss_coarse) loss_fine = chamfer(self.fine, gt) add_train_summary('train/fine_loss', loss_fine) update_fine = add_valid_summary('valid/fine_loss', loss_fine) loss = loss_coarse + alpha * loss_fine add_train_summary('train/loss', loss) update_loss = add_valid_summary('valid/loss', loss) return loss, [update_coarse, update_fine, update_loss]
def create_loss(self, coarse, fine, gt, alpha): gt_ds = gt[:, :coarse.shape[1], :] loss_coarse = earth_mover(coarse, gt_ds) add_train_summary('train/coarse_loss', loss_coarse) update_coarse = add_valid_summary('valid/coarse_loss', loss_coarse) loss_fine = chamfer(fine, gt) add_train_summary('train/fine_loss', loss_fine) update_fine = add_valid_summary('valid/fine_loss', loss_fine) loss = loss_coarse + alpha * loss_fine add_train_summary('train/loss', loss) update_loss = add_valid_summary('valid/loss', loss) return loss, [update_coarse, update_fine, update_loss]
def create_loss(self, gt, alpha): gt_ds = gt[:, :self.coarse.shape[1], :] loss_coarse = tf_util.earth_mover(self.coarse, gt_ds) tf_util.add_train_summary('train/coarse_loss', loss_coarse) update_coarse = tf_util.add_valid_summary('valid/coarse_loss', loss_coarse) loss_fine = tf_util.chamfer(self.fine, gt) tf_util.add_train_summary('train/fine_loss', loss_fine) update_fine = tf_util.add_valid_summary('valid/fine_loss', loss_fine) loss = loss_coarse + alpha * loss_fine tf_util.add_train_summary('train/loss', loss) update_loss = tf_util.add_valid_summary('valid/loss', loss) return loss, [update_coarse, update_fine, update_loss]
def create_loss(self, coarse, fine, gt, alpha): # print('coarse shape:', coarse.shape) # print('fine shape:', fine.shape) # print('gt shape:', gt.shape) loss_coarse = chamfer(coarse, gt) add_train_summary('train/coarse_loss', loss_coarse) update_coarse = add_valid_summary('valid/coarse_loss', loss_coarse) loss_fine = chamfer(fine, gt) add_train_summary('train/fine_loss', loss_fine) update_fine = add_valid_summary('valid/fine_loss', loss_fine) loss = loss_coarse + alpha * loss_fine add_train_summary('train/loss', loss) update_loss = add_valid_summary('valid/loss', loss) return loss, [update_coarse, update_fine, update_loss]