2017-06-09 1 views

Antwort

0

1. Um die mittlere IoU für alle Klassen zu berechnen, verwenden Sie die Funktion tf.metrics.mean_iou von Tensorflow.

https://www.tensorflow.org/api_docs/python/tf/metrics/mean_iou

2.Bei die IOU für einzelne Klassen zu berechnen, eine Konfusionsmatrix konstruieren und die Matrix verwenden, um die Berechnung pro Klasse IOU zu tun.

def confusion_matrix(eval_segm, gt_segm, **kwargs): 
    merged_maps = np.bitwise_or(np.left_shift(gt_segm.astype('uint16'), 8), eval_segm.astype('uint16')) 
    hist = np.bincount(np.ravel(merged_maps)) 
    nonzero = np.nonzero(hist)[0] 
    pred, label = np.bitwise_and(255, nonzero), np.right_shift(nonzero, 8) 
    class_count = np.array([pred, label]).max() + 1 
    conf_matrix = np.zeros([class_count, class_count], dtype='uint64') 
    conf_matrix.put(pred * class_count + label, hist[nonzero]) 
    return conf_matrix 

check this one out,its quite vague without comments but should solve your issue

Verwandte Themen