def get_quality_values(predict, gt, dense_gt, minMemb, minSeg, sigMin, sigWeights, sigSmooth,edgeLengths,nodeFeatures, nodeSizes, nodeLabels, nodeNumStop, beta, metric, wardness,out): """ """ adjusted_predict = adjust_predict(predict) # save_h5(adjusted_predict, "/home/stamylew/delme/prob.h5", "data") relevant_predict, relevant_gt = exclude_ignore_label(adjusted_predict, gt) acc, pre, rec = accuracy_precision_recall(relevant_predict, relevant_gt) auc_score = calculate_roc_auc_score(relevant_predict, relevant_gt) no_of_true_pos, no_of_false_pos = true_and_false_pos(relevant_predict, relevant_gt) no_of_true_neg, no_of_false_neg = true_and_false_neg(relevant_predict, relevant_gt) print "#nodes in dense gt", len(np.unique(dense_gt)) pmin= 0.5 segmentation, super_pixels, wsDt_data, agglCl_data = get_segmentation(adjusted_predict,pmin, minMemb, minSeg, sigMin, sigWeights, sigSmooth, True,False, edgeLengths, nodeFeatures, nodeSizes, nodeLabels, nodeNumStop, beta, metric, wardness, out) ri_data = skl.randIndex(segmentation.flatten().astype(np.uint32), dense_gt.flatten().astype(np.uint32), True) voi_data = skl.variationOfInformation(segmentation.flatten().astype(np.uint32), dense_gt.flatten().astype(np.uint32), True) sp_ri = skl.randIndex(super_pixels.flatten().astype(np.uint32), dense_gt.flatten().astype(np.uint32), True) sp_voi = skl.variationOfInformation(super_pixels.flatten().astype(np.uint32), dense_gt.flatten().astype(np.uint32), True) print print "super pixels values", (sp_ri, sp_voi) print print "segmentation values", (ri_data, voi_data) return acc, pre, rec, auc_score, ri_data, voi_data, no_of_true_pos, no_of_false_pos, no_of_true_neg, no_of_false_neg, \ wsDt_data, agglCl_data
def rand_index_variation_of_information(segmentation, dense_gt): ri = skl.randIndex(segmentation.flatten().astype(np.uint32), dense_gt.flatten().astype(np.uint32),True) voi = skl.variationOfInformation(segmentation.flatten().astype(np.uint32), dense_gt.flatten().astype(np.uint32), True) return ri, voi