def eval_landmarks(ref_landmark_path, output_path, cnt): ref_lm = landmarks.read_csv( ref_landmark_path + "ref_landmarks.csv", False) #csv_2_np.read_csv(out1_path + "ref_landmarks.csv", False) out_succ_freq = [] out_succ_means = [] out_means = [] out_stddevs = [] out_dists = [] out_dist_summary = [] for j in xrange(len(param_comb)): dists = np.zeros(cnt) for i in xrange(cnt): tra_lm = landmarks.read_csv(output_path + "registered_landmarks_%d_%d.csv" % (j + 1, i + 1)) dists[i] = landmarks.mean_euclidean(ref_lm, tra_lm) succ_freq = np.count_nonzero( np.where(dists <= 1.0)) / np.float(cnt) succ_means = np.mean(dists[np.where(dists <= 1.0)]) out_succ_freq.append(succ_freq) out_succ_means.append(succ_means) out_means.append(np.mean(dists)) out_stddevs.append(np.std(dists)) out_dists.append(dists) out_dist_summary.append(dt.make_distribution(dists)) #np.sort(dists) return (out_succ_freq, out_succ_means, out_means, out_stddevs, out_dists, out_dist_summary)
def eval_landmarks(ref_landmark_path, output_path, cnt): ref_lm = landmarks.read_csv( ref_landmark_path + "ref_landmarks.csv", False) #csv_2_np.read_csv(out1_path + "ref_landmarks.csv", False) dists = np.zeros(cnt) for i in xrange(cnt): tra_lm = landmarks.read_csv(output_path + "registered_landmarks_%d.csv" % (i + 1)) dists[i] = landmarks.mean_euclidean(ref_lm, tra_lm) #np.sort(dists) return (np.mean(dists), np.std(dists), dists, dt.make_distribution(dists))