This example demonstrates how to export the EfficientSAM model to Core ML and XNNPACK using ExecuTorch.
Follow the tutorial to set up ExecuTorch.
Make sure to install the required dependencies for Core ML export.
To export the model to Core ML, run the following command:
cd executorch
python -m examples.apple.coreml.scripts.export -m efficient_samTo export the model to XNNPACK, run the following command:
cd executorch
python -m examples.xnnpack.aot_compiler -m efficient_samTests were conducted on an Apple M1 Pro chip using the instructions for building and running Executorch with Core ML and XNNPACK backends.
| Backend Configuration | Average Inference Time (seconds) |
|---|---|
| Core ML (CPU, GPU, NE) | 34.8 |
| Core ML (CPU, GPU) | 34.7 |
| Core ML (CPU, NE) | 26.4 |
| Core ML (CPU) | 22.8 |
| XNNPACK | 4.1 |
All models were tested with float32 precision.
The code in the efficient_sam_core directory is licensed under the Apache License 2.0.