I want to use CoreML for my Xamarin.iOS app but how can I use models? All samples in developer.xamarin is use .mlmodelc but I downloaded .mlmodel. How can I convert to .mlmodelc?
You can use Xcode to compile your model:
xcrun coremlcompiler compile MyModel.mlmodel MyModel.mlmodelc
This outputs an .mlmodelc that you can add to your project.
Or you can do it dynamically inside your app by using MLModel.compileModel(at:)
.
您也可以在Mac终端中使用此命令:
/Applications/Xcode.app/Contents/Developer/usr/bin/coremlc compile coreml.mlmodel
You can follow the below steps:
Step 1: Open Terminal and check the present directory using 'pwd' command.
Step 2: Go to your directory/folder from present directory where .mlmodel file is located using cd command, example: 'cd Desktop/mlfolder'.
Step 3: Enter below command
/Applications/Xcode.app/Contents/Developer/usr/bin/coremlc compile model_name.mlmodel model_name.mlmodelc
Note: here model_name.mlmodel is the name of the mlmodel(you can name your model name here) and model_name.mlmodelc is the converted modelc name(name need not be same).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.