|
|
|
@ -1,3 +1,4 @@ |
|
|
|
|
from __future__ import print_function |
|
|
|
|
from abc import ABCMeta, abstractmethod |
|
|
|
|
import numpy as np |
|
|
|
|
import sys |
|
|
|
@ -145,7 +146,7 @@ class PASCALDataFetch(DatasetImageFetch): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SemSegmEvaluation: |
|
|
|
|
log = file |
|
|
|
|
log = sys.stdout |
|
|
|
|
|
|
|
|
|
def __init__(self, log_path,): |
|
|
|
|
self.log = open(log_path, 'w') |
|
|
|
@ -174,28 +175,28 @@ class SemSegmEvaluation: |
|
|
|
|
pix_acc, mean_acc, miou = get_metrics(conf_mats[i]) |
|
|
|
|
|
|
|
|
|
name = frameworks[i].get_name() |
|
|
|
|
print >> self.log, samples_handled, 'Pixel accuracy, %s:' % name, 100 * pix_acc |
|
|
|
|
print >> self.log, samples_handled, 'Mean accuracy, %s:' % name, 100 * mean_acc |
|
|
|
|
print >> self.log, samples_handled, 'Mean IOU, %s:' % name, 100 * miou |
|
|
|
|
print >> self.log, "Inference time, ms ", \ |
|
|
|
|
frameworks[i].get_name(), inference_time[i] / samples_handled * 1000 |
|
|
|
|
print(samples_handled, 'Pixel accuracy, %s:' % name, 100 * pix_acc, file=self.log) |
|
|
|
|
print(samples_handled, 'Mean accuracy, %s:' % name, 100 * mean_acc, file=self.log) |
|
|
|
|
print(samples_handled, 'Mean IOU, %s:' % name, 100 * miou, file=self.log) |
|
|
|
|
print("Inference time, ms ", \ |
|
|
|
|
frameworks[i].get_name(), inference_time[i] / samples_handled * 1000, file=self.log) |
|
|
|
|
|
|
|
|
|
for i in range(1, len(frameworks)): |
|
|
|
|
log_str = frameworks[0].get_name() + " vs " + frameworks[i].get_name() + ':' |
|
|
|
|
diff = np.abs(frameworks_out[0] - frameworks_out[i]) |
|
|
|
|
l1_diff = np.sum(diff) / diff.size |
|
|
|
|
print >> self.log, samples_handled, "L1 difference", log_str, l1_diff |
|
|
|
|
print(samples_handled, "L1 difference", log_str, l1_diff, file=self.log) |
|
|
|
|
blobs_l1_diff[i] += l1_diff |
|
|
|
|
blobs_l1_diff_count[i] += 1 |
|
|
|
|
if np.max(diff) > blobs_l_inf_diff[i]: |
|
|
|
|
blobs_l_inf_diff[i] = np.max(diff) |
|
|
|
|
print >> self.log, samples_handled, "L_INF difference", log_str, blobs_l_inf_diff[i] |
|
|
|
|
print(samples_handled, "L_INF difference", log_str, blobs_l_inf_diff[i], file=self.log) |
|
|
|
|
|
|
|
|
|
self.log.flush() |
|
|
|
|
|
|
|
|
|
for i in range(1, len(blobs_l1_diff)): |
|
|
|
|
log_str = frameworks[0].get_name() + " vs " + frameworks[i].get_name() + ':' |
|
|
|
|
print >> self.log, 'Final l1 diff', log_str, blobs_l1_diff[i] / blobs_l1_diff_count[i] |
|
|
|
|
print('Final l1 diff', log_str, blobs_l1_diff[i] / blobs_l1_diff_count[i], file=self.log) |
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
parser = argparse.ArgumentParser() |
|
|
|
|