| 97 | |
| 98 | |
| 99 | class ProgressMeter(object): |
| 100 | def __init__(self, num_batches, meters, prefix=""): |
| 101 | self.batch_fmtstr = self._get_batch_fmtstr(num_batches) |
| 102 | self.meters = meters |
| 103 | self.prefix = prefix |
| 104 | |
| 105 | def display(self, batch): |
| 106 | entries = [self.prefix + self.batch_fmtstr.format(batch)] |
| 107 | entries += [str(meter) for meter in self.meters] |
| 108 | logger.info(" ".join(entries)) |
| 109 | |
| 110 | def _get_batch_fmtstr(self, num_batches): |
| 111 | num_digits = len(str(num_batches // 1)) |
| 112 | fmt = "{:" + str(num_digits) + "d}" |
| 113 | return "[" + fmt + "/" + fmt.format(num_batches) + "]" |
| 114 | |
| 115 | |
| 116 | def trainMetricGPU(output, target, threshold=0.35, pr_iou=0.5): |