Commit 6e6da4e2 authored by Julian Treiber's avatar Julian Treiber

adjusted accumulation of predictions for eval metric to work with semantic segmentation task

parent d6eb626f
......@@ -393,11 +393,7 @@ class ${tc.fileNameWithoutEnding}:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -512,11 +512,7 @@ class CNNSupervisedTrainer_Alexnet:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -512,11 +512,7 @@ class CNNSupervisedTrainer_CifarClassifierNetwork:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -497,11 +497,7 @@ class CNNSupervisedTrainer_Invariant:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -485,11 +485,7 @@ class CNNSupervisedTrainer_MultipleStreams:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -599,11 +599,7 @@ class CNNSupervisedTrainer_RNNencdec:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -596,11 +596,7 @@ class CNNSupervisedTrainer_RNNsearch:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -565,11 +565,7 @@ class CNNSupervisedTrainer_RNNtest:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -470,11 +470,7 @@ class CNNSupervisedTrainer_ResNeXt50:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -587,11 +587,7 @@ class CNNSupervisedTrainer_Show_attend_tell:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -476,11 +476,7 @@ class CNNSupervisedTrainer_ThreeInputCNN_M14:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
......@@ -512,11 +512,7 @@ class CNNSupervisedTrainer_VGG16:
predictions = []
for output_name in outputs:
if mx.nd.shape_array(mx.nd.squeeze(output_name)).size > 1:
predictions.append(mx.nd.argmax(output_name, axis=1))
#ArgMax already applied
else:
predictions.append(output_name)
predictions.append(output_name)
metric.update(preds=predictions, labels=labels)
test_metric_score = metric.get()[1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment