MCPcopy Create free account
hub / github.com/VisionLearningGroup/OVANet / h_score_compute

Function h_score_compute

eval.py:222–235  ·  view source on GitHub ↗
(label_all, pred_class, class_list)

Source from the content-addressed store, hash-verified

220
221
222def h_score_compute(label_all, pred_class, class_list):
223 per_class_num = np.zeros((len(class_list)))
224 per_class_correct = np.zeros((len(class_list))).astype(np.float32)
225 for i, t in enumerate(class_list):
226 t_ind = np.where(label_all == t)
227 correct_ind = np.where(pred_class[t_ind[0]] == t)
228 per_class_correct[i] += float(len(correct_ind[0]))
229 per_class_num[i] += float(len(t_ind[0]))
230 open_class = len(class_list)
231 per_class_acc = per_class_correct / per_class_num
232 known_acc = per_class_acc[:open_class - 1].mean()
233 unknown = per_class_acc[-1]
234 h_score = 2 * known_acc * unknown / (known_acc + unknown)
235 return h_score, known_acc, unknown

Callers 1

select_thresholdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected