def cal_loss(self):
    one_hot_labels = tf.one_hot(self.labels, depth=self.conf.class_num, axis=self.channel_axis, name='labels/one_hot')
    losses = tf.losses.softmax_cross_entropy(one_hot_labels, self.predictions, scope='loss/losses')
    self.loss_op = tf.reduce_mean(losses, name='loss/loss_op')
    self.decoded_preds = tf.argmax(self.predictions, self.channel_axis, name='accuracy/decode_pred')
    correct_prediction = tf.equal(self.labels, self.decoded_preds, name='accuracy/correct_pred')
    self.accuracy_op = tf.reduce_mean(tf.cast(correct_prediction, tf.float32, name='accuracy/cast'), name='accuracy/accuracy_op')
    weights = tf.cast(tf.less(self.labels, self.conf.channel, name='m_iou/greater'), tf.int64, name='m_iou/weights')
    labels = tf.multiply(self.labels, weights, name='m_iou/mul')
    (self.m_iou, self.miou_op) = tf.metrics.mean_iou(self.labels, self.decoded_preds, self.conf.class_num, weights, name='m_iou/m_ious')
def cal_loss(self):
    one_hot_labels = tf.one_hot(self.labels, depth=self.conf.class_num, axis=self.channel_axis, name='labels/one_hot')
    losses = tf.losses.softmax_cross_entropy(one_hot_labels, self.predictions, scope='loss/losses')
    self.loss_op = tf.reduce_mean(losses, name='loss/loss_op')
    self.decoded_preds = tf.argmax(self.predictions, self.channel_axis, name='accuracy/decode_pred')
    correct_prediction = tf.equal(self.labels, self.decoded_preds, name='accuracy/correct_pred')
    self.accuracy_op = tf.reduce_mean(tf.cast(correct_prediction, tf.float32, name='accuracy/cast'), name='accuracy/accuracy_op')
    weights = tf.cast(tf.less(self.labels, self.conf.channel, name='m_iou/greater'), tf.int64, name='m_iou/weights')
    labels = tf.multiply(self.labels, weights, name='m_iou/mul')
    (self.m_iou, self.miou_op) = tf.metrics.mean_iou(self.labels, self.decoded_preds, self.conf.class_num, weights, name='m_iou/m_ious')