glenn-jocher commited on
Commit
22da63e
1 Parent(s): 006eb40

Fix zero-export handling with `if any(f):` (#6569)

Browse files

* Fix zero-export handling with `if any(f):`

Partial fix for https://github.com/ultralytics/yolov5/issues/6563

* Cleanup

Files changed (1) hide show
  1. export.py +7 -6
export.py CHANGED
@@ -476,12 +476,13 @@ def run(data=ROOT / 'data/coco128.yaml', # 'dataset.yaml path'
476
 
477
  # Finish
478
  f = [str(x) for x in f if x] # filter out '' and None
479
- LOGGER.info(f'\nExport complete ({time.time() - t:.2f}s)'
480
- f"\nResults saved to {colorstr('bold', file.parent.resolve())}"
481
- f"\nDetect: python detect.py --weights {f[-1]}"
482
- f"\nPyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'custom', '{f[-1]}')"
483
- f"\nValidate: python val.py --weights {f[-1]}"
484
- f"\nVisualize: https://netron.app")
 
485
  return f # return list of exported files/dirs
486
 
487
 
 
476
 
477
  # Finish
478
  f = [str(x) for x in f if x] # filter out '' and None
479
+ if any(f):
480
+ LOGGER.info(f'\nExport complete ({time.time() - t:.2f}s)'
481
+ f"\nResults saved to {colorstr('bold', file.parent.resolve())}"
482
+ f"\nDetect: python detect.py --weights {f[-1]}"
483
+ f"\nPyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'custom', '{f[-1]}')"
484
+ f"\nValidate: python val.py --weights {f[-1]}"
485
+ f"\nVisualize: https://netron.app")
486
  return f # return list of exported files/dirs
487
 
488