From 7c8d0c9f4213f2f8acd7cd5960b2f5f6b2b6e18c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 8 Feb 2022 12:20:39 +0100 Subject: [PATCH] Fix zero-export handling with `if any(f):` (#6569) * Fix zero-export handling with `if any(f):` Partial fix for https://github.com/ultralytics/yolov5/issues/6563 * Cleanup --- export.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/export.py b/export.py index 4e56d092480c..444ab57f5c96 100644 --- a/export.py +++ b/export.py @@ -476,12 +476,13 @@ def run(data=ROOT / 'data/coco128.yaml', # 'dataset.yaml path' # Finish f = [str(x) for x in f if x] # filter out '' and None - LOGGER.info(f'\nExport complete ({time.time() - t:.2f}s)' - f"\nResults saved to {colorstr('bold', file.parent.resolve())}" - f"\nDetect: python detect.py --weights {f[-1]}" - f"\nPyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'custom', '{f[-1]}')" - f"\nValidate: python val.py --weights {f[-1]}" - f"\nVisualize: https://netron.app") + if any(f): + LOGGER.info(f'\nExport complete ({time.time() - t:.2f}s)' + f"\nResults saved to {colorstr('bold', file.parent.resolve())}" + f"\nDetect: python detect.py --weights {f[-1]}" + f"\nPyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'custom', '{f[-1]}')" + f"\nValidate: python val.py --weights {f[-1]}" + f"\nVisualize: https://netron.app") return f # return list of exported files/dirs