Get the accuracy and IoU for each class in the table format
(self, classes: list)
| 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 |
no test coverage detected