babf7c9f50282143ab8efee96a587bf5cb74123f,chainercv/evaluations/eval_semantic_segmentation_iou.py,,calc_semantic_segmentation_confusion,#Any#Any#Any#,6
Before Change
gt_labels = iter(gt_labels)
confusion = np.zeros((n_class, n_class), dtype=np.int64)
while True:
try:
pred_label = next(pred_labels)
gt_label = next(gt_labels)
except StopIteration:
break
if pred_label.ndim != 2 or gt_label.ndim != 2:
raise ValueError("ndim of inputs should be two.")
if pred_label.shape != gt_label.shape:
raise ValueError("Shapes of inputs should be same.")
pred_label = pred_label.flatten()
gt_label = gt_label.flatten()
mask = (gt_label >= 0) & (gt_label < n_class)
confusion += np.bincount(
n_class * gt_label[mask].astype(int) +
pred_label[mask], minlength=n_class**2).reshape(n_class, n_class)
return confusion
def calc_semantic_segmentation_iou(confusion):
After Change
for iter_ in (pred_labels, gt_labels):
// This code assumes any iterator does not contain None as its items.
if next(iter_, None) is not None:
raise ValueError("Length of input iterables need to be same")
return confusion
def calc_semantic_segmentation_iou(confusion):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: chainer/chainercv
Commit Name: babf7c9f50282143ab8efee96a587bf5cb74123f
Time: 2017-06-01
Author: yuyuniitani@gmail.com
File Name: chainercv/evaluations/eval_semantic_segmentation_iou.py
Class Name:
Method Name: calc_semantic_segmentation_confusion
Project Name: erikbern/ann-benchmarks
Commit Name: 845a5692cd16a152572e8818dbdecfd5d7a7764a
Time: 2017-12-09
Author: mail@erikbern.com
File Name: ann_benchmarks/runner.py
Class Name:
Method Name: run_docker
Project Name: Bihaqo/t3f
Commit Name: 4257bd12136ce3a135a4fab4ad0667dfccf8368d
Time: 2017-02-03
Author: novikov@bayesgroup.ru
File Name: variables.py
Class Name:
Method Name: get_tt_variable