From 4b5af6f24b9f670cc6d25fb234336bf4fdb28322 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 27 Jun 2022 17:14:41 +0200 Subject: [PATCH 1/3] Add filesize to benchmarks.py --- utils/benchmarks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/benchmarks.py b/utils/benchmarks.py index d0f2a2529c5d..7f277757b23e 100644 --- a/utils/benchmarks.py +++ b/utils/benchmarks.py @@ -41,7 +41,7 @@ import export import val from utils import notebook_init -from utils.general import LOGGER, check_yaml, print_args +from utils.general import LOGGER, check_yaml, print_args, file_size from utils.torch_utils import select_device @@ -75,10 +75,10 @@ def run( result = val.run(data, w, batch_size, imgsz, plots=False, device=device, task='benchmark', half=half) metrics = result[0] # metrics (mp, mr, map50, map, *losses(box, obj, cls)) speeds = result[2] # times (preprocess, inference, postprocess) - y.append([name, round(metrics[3], 4), round(speeds[1], 2)]) # mAP, t_inference + y.append([name, file_size(w), round(metrics[3], 4), round(speeds[1], 2)]) # mAP, t_inference except Exception as e: LOGGER.warning(f'WARNING: Benchmark failure for {name}: {e}') - y.append([name, None, None]) # mAP, t_inference + y.append([name, None, None, None]) # mAP, t_inference if pt_only and i == 0: break # break after PyTorch @@ -86,7 +86,8 @@ def run( LOGGER.info('\n') parse_opt() notebook_init() # print system info - py = pd.DataFrame(y, columns=['Format', 'mAP@0.5:0.95', 'Inference time (ms)'] if map else ['Format', 'Export', '']) + c = ['Format', 'Size (MB)', 'mAP@0.5:0.95', 'Inference time (ms)'] if map else ['Format', 'Export', '', ''] + py = pd.DataFrame(y, columns=c) LOGGER.info(f'\nBenchmarks complete ({time.time() - t:.2f}s)') LOGGER.info(str(py if map else py.iloc[:, :2])) return py From c6660fa37a2df3806c4bec36f1ce7cd7bf8a9c41 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 27 Jun 2022 17:27:57 +0200 Subject: [PATCH 2/3] Add filesize to benchmarks.py --- utils/benchmarks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/benchmarks.py b/utils/benchmarks.py index 7f277757b23e..8f95d8f29934 100644 --- a/utils/benchmarks.py +++ b/utils/benchmarks.py @@ -75,7 +75,7 @@ def run( result = val.run(data, w, batch_size, imgsz, plots=False, device=device, task='benchmark', half=half) metrics = result[0] # metrics (mp, mr, map50, map, *losses(box, obj, cls)) speeds = result[2] # times (preprocess, inference, postprocess) - y.append([name, file_size(w), round(metrics[3], 4), round(speeds[1], 2)]) # mAP, t_inference + y.append([name, round(file_size(w), 1), round(metrics[3], 4), round(speeds[1], 2)]) # MB, mAP, t_inference except Exception as e: LOGGER.warning(f'WARNING: Benchmark failure for {name}: {e}') y.append([name, None, None, None]) # mAP, t_inference From 580d5c7f063cb1dfcb9da4be2d2812f1f1f351fe Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jun 2022 15:32:43 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- utils/benchmarks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/benchmarks.py b/utils/benchmarks.py index 8f95d8f29934..69d653a20916 100644 --- a/utils/benchmarks.py +++ b/utils/benchmarks.py @@ -41,7 +41,7 @@ import export import val from utils import notebook_init -from utils.general import LOGGER, check_yaml, print_args, file_size +from utils.general import LOGGER, check_yaml, file_size, print_args from utils.torch_utils import select_device