Add `export.py` ONNX inference suggestion (#4146)

This commit is contained in:
Glenn Jocher 2021-07-25 13:46:16 +02:00 committed by GitHub
parent d17b45eaad
commit 6e4358f3f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -76,6 +76,7 @@ def export_onnx(model, img, file, opset, train, dynamic, simplify):
except Exception as e: except Exception as e:
print(f'{prefix} simplifier failure: {e}') print(f'{prefix} simplifier failure: {e}')
print(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)') print(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)')
print(f"{prefix} run --dynamic ONNX model inference with detect.py: 'python detect.py --weights {f}'")
except Exception as e: except Exception as e:
print(f'{prefix} export failure: {e}') print(f'{prefix} export failure: {e}')
@ -94,7 +95,7 @@ def export_coreml(model, img, file):
model.save(f) model.save(f)
print(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)') print(f'{prefix} export success, saved as {f} ({file_size(f):.1f} MB)')
except Exception as e: except Exception as e:
print(f'{prefix} export failure: {e}') print(f'\n{prefix} export failure: {e}')
def run(weights='./yolov5s.pt', # weights path def run(weights='./yolov5s.pt', # weights path