MCPcopy
hub / github.com/thuml/Transfer-Learning-Library / format

Method format

tllib/utils/metric/__init__.py:99–108  ·  view source on GitHub ↗

Get the accuracy and IoU for each class in the table format

(self, classes: list)

Source from the content-addressed store, hash-verified

97 iu.mean().item() * 100)
98
99 def format(self, classes: list):
100 """Get the accuracy and IoU for each class in the table format"""
101 acc_global, acc, iu = self.compute()
102
103 table = prettytable.PrettyTable(["class", "acc", "iou"])
104 for i, class_name, per_acc, per_iu in zip(range(len(classes)), classes, (acc * 100).tolist(), (iu * 100).tolist()):
105 table.add_row([class_name, per_acc, per_iu])
106
107 return 'global correct: {:.1f}\nmean correct:{:.1f}\nmean IoU: {:.1f}\n{}'.format(
108 acc_global.item() * 100, acc.mean().item() * 100, iu.mean().item() * 100, table.get_string())
109

Callers 15

validateMethod · 0.95
validateFunction · 0.95
validateFunction · 0.95
validateFunction · 0.95
validateFunction · 0.95
validateFunction · 0.95
validateFunction · 0.95
__str__Method · 0.80
__str__Method · 0.80
displayMethod · 0.80
_get_batch_fmtstrMethod · 0.80
__init__Method · 0.80

Calls 1

computeMethod · 0.95

Tested by

no test coverage detected