You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
b485090534 | 3 years ago | |
---|---|---|
model | 3 years ago | |
README.md | 3 years ago | |
export_coreml.py | 3 years ago | |
requirements.txt | 3 years ago |
README.md
Export CoreML
Overview
This branch contains our code to export to CoreML models. The /model
folder is the same as the master
branch. The main exporting logics are in export_coreml.py
.
At the time of this writing, CoreML's ResizeBilinear
and Upsample
ops don't not support dynamic scale parameters, so the downsample_ratio
hyperparameter must be hardcoded.
Our export script is written to have input size fixed. The output coreml models require iOS14+, MacOS11+. If you have other requirements, feel free to modify the export script. Contributions are welcomed.
Export Yourself
The following procedures were used to generate our CoreML models.
- Install dependencies
pip install -r requirements.txt
- Use the export script. You can change the
resolution
anddownsample-ratio
to fit your need. You can change quantization to one of[8, 16, 32]
, denotingint8
,fp16
, andfp32
.
python export_coreml.py \
--model-variant mobilenetv3 \
--checkpoint rvm_mobilenetv3.pth \
--resolution 1920 1080 \
--downsample-ratio 0.25 \
--quantize-nbits 16 \
--output model.mlmodel