Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onnx script fix and added as main package #73

Merged
merged 3 commits into from
Jun 26, 2023

Conversation

onuralpszr
Copy link
Collaborator

Expected results for make sure scripts works also checked for import fixes

 python export_onnx_model.py -h
usage: export_onnx_model.py [-h] --checkpoint CHECKPOINT --output OUTPUT [--model-type MODEL_TYPE] [--return-single-mask] [--opset OPSET]
                            [--quantize-out QUANTIZE_OUT] [--gelu-approximate] [--use-stability-score] [--return-extra-metrics]

Export the SAM prompt encoder and mask decoder to an ONNX model.

options:
  -h, --help            show this help message and exit
  --checkpoint CHECKPOINT
                        The path to the SAM model checkpoint.
  --output OUTPUT       The filename to save the ONNX model to.
  --model-type MODEL_TYPE
                        In ['default', 'vit_b', 'vit_l']. Which type of SAM model to export.
  --return-single-mask  If true, the exported ONNX model will only return the best mask, instead of returning multiple masks. For high resolution
                        images this can improve runtime when upscaling masks is expensive.
  --opset OPSET         The ONNX opset version to use. Must be >=11
  --quantize-out QUANTIZE_OUT
                        If set, will quantize the model and save it with this name. Quantization is performed with quantize_dynamic from
                        onnxruntime.quantization.quantize.
  --gelu-approximate    Replace GELU operations with approximations using tanh. Useful for some runtimes that have slow or unimplemented erf ops,
                        used in GELU.
  --use-stability-score
                        Replaces the model's predicted mask quality score with the stability score calculated on the low resolution masks using
                        an offset of 1.0.
  --return-extra-metrics
                        The model will return five results: (masks, scores, stability_scores, areas, low_res_logits) instead of the usual three.
                        This can be significantly slower for high resolution outputs.

Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
…nx export script

Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
@onuralpszr onuralpszr added bug Something isn't working enhancement New feature or request labels Jun 26, 2023
@onuralpszr onuralpszr requested a review from kadirnar June 26, 2023 20:07
@onuralpszr onuralpszr self-assigned this Jun 26, 2023
@kadirnar
Copy link
Owner

Thank you so much🎉

@onuralpszr onuralpszr requested a review from kadirnar June 26, 2023 20:41
@onuralpszr onuralpszr merged commit 6d86650 into main Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants