nn/nn_utils.py
def image_summary(image, truth, prediction, img_mean=np.array((0, 0, 0), dtype=np.float32), label_num=2):
    """
    Make a image summary where the format is image|truth|pred
    :param image: input rgb image
    :param truth: ground truth
    :param prediction: network prediction
    :param img_mean: image mean, need to add back here for visualization
    :param label_num: #distinct classes in ground truth
    :return:
    """
    truth_img = decode_labels(truth, label_num)

    prediction = pad_prediction(image, prediction)

    pred_labels = get_pred_labels(prediction)
    pred_img = decode_labels(pred_labels, label_num)

    _, h, w, _ = image.shape
    if w/h > 1.5:
        # concatenate image horizontally if it is too wide
        return np.concatenate([image+img_mean, truth_img, pred_img], axis=1)
    else:
        return np.concatenate([image + img_mean, truth_img, pred_img], axis=2)

    Make a image summary where the format is image|truth|pred
    :param image: input rgb image
    :param truth: ground truth
    :param prediction: network prediction
    :param img_mean: image mean, need to add back here for visualization
    :param label_num: #distinct classes in ground truth
    :return:
    
Make a image summary where the format is image|truth|pred
Make a image summary where the format is image|truth|pred
def image_summary(image, truth, prediction, img_mean=np.array((0, 0, 0), dtype=np.float32), label_num=2):
    truth_img = decode_labels(truth, label_num)
    prediction = pad_prediction(image, prediction)
    pred_labels = get_pred_labels(prediction)
    pred_img = decode_labels(pred_labels, label_num)
    _, h, w, _ = image.shape
    if w/h > 1.5:
        return np.concatenate([image+img_mean, truth_img, pred_img], axis=1)
    else:
        return np.concatenate([image + img_mean, truth_img, pred_img], axis=2)
def image_summary ( image , truth , prediction , img_mean = np . array ( ( 0 , 0 , 0 ) , dtype = np . float32 ) , label_num = 2 ) : truth_img = decode_labels ( truth , label_num ) prediction = pad_prediction ( image , prediction ) pred_labels = get_pred_labels ( prediction ) pred_img = decode_labels ( pred_labels , label_num ) _ , h , w , _ = image . shape if w / h > 1.5 : return np . concatenate ( [ image + img_mean , truth_img , pred_img ] , axis = 1 ) else : return np . concatenate ( [ image + img_mean , truth_img , pred_img ] , axis = 2 )
Make a image summary where the format is image|truth|pred
Make a image summary where the format is image|truth|pred
"""
    Make a image summary where the format is image|truth|pred
    :param image: input rgb image
    :param truth: ground truth
    :param prediction: network prediction
    :param img_mean: image mean, need to add back here for visualization
    :param label_num: #distinct classes in ground truth
    :return:
    """ # concatenate image horizontally if it is too wide
None
image
input rgb image
input rgb image
truth
None
prediction
None
img_mean
image mean, need to add back here for visualization
image mean need to add back here for visualization
label_num
distinct classes in ground truth
distinct classes in ground truth