Print main metrics in a format similar to Detectron, so that they are easy to copypaste into a spreadsheet. Args: results (OrderedDict[dict]): task_name -> {metric -> score} unordered dict can also be printed, but in arbitrary order
(results, logger)
| 1453 | |
| 1454 | |
| 1455 | def print_csv_format(results, logger): |
| 1456 | """ |
| 1457 | Print main metrics in a format similar to Detectron, |
| 1458 | so that they are easy to copypaste into a spreadsheet. |
| 1459 | |
| 1460 | Args: |
| 1461 | results (OrderedDict[dict]): task_name -> {metric -> score} |
| 1462 | unordered dict can also be printed, but in arbitrary order |
| 1463 | """ |
| 1464 | assert isinstance(results, Mapping) or not len(results), results |
| 1465 | for task, res in results.items(): |
| 1466 | if isinstance(res, Mapping): |
| 1467 | # Don't print "AP-category" metrics since they are usually not tracked. |
| 1468 | important_res = [(k, v) for k, v in res.items() if "-" not in k] |
| 1469 | logger.info("copypaste: Task: {}".format(task)) |
| 1470 | logger.info("copypaste: " + ",".join([k[0] for k in important_res])) |
| 1471 | logger.info("copypaste: " + ",".join(["{0:.4f}".format(k[1]) for k in important_res])) |
| 1472 | else: |
| 1473 | logger.info(f"copypaste: {task}={res}") |