CoreML Adobe Air Native Extension for OSX 10.13+, iOS 11.0+ and tvOS 11.0+ This ANE provides access to Apple's CoreML framework for building Machine Learning apps
Much time, skill and effort has gone into this. Help support the project
From the command line cd into /example-desktop and run:
bash get_dependencies.sh
N.B. You must use a Mac to build an iOS app using this ANE. Windows is NOT supported.
From the command line cd into /example-mobile and run:
bash get_ios_dependencies.sh
This folder, ios_dependencies/device/Frameworks, must be packaged as part of your app when creating the ipa. How this is done will depend on the IDE you are using. After the ipa is created unzip it and confirm there is a "Frameworks" folder in the root of the .app package.
N.B. You must use a Mac to build an tvOS app using this ANE. Windows is NOT supported.
From the command line cd into /example-tvos and run:
bash get_tvos_dependencies.sh
This folder, tvos_dependencies/device/Frameworks, must be packaged as part of your app when creating the ipa. How this is done will depend on the IDE you are using. After the ipa is created unzip it and confirm there is a "Frameworks" folder in the root of the .app package.
Firstly, familiarise yourself with the concepts of Apple's CoreML.
coreml = MLANE.coreml;
if (coreml.isSupported) {
} else {
}
var mobileNetUrl:String = "https://docs-assets.developer.apple.com/coreml/models/MobileNet.mlmodel"
var model:Model = Model.fromUrl(mobileNetUrl, onDownloadProgress, onDownloadComplete, onModelCompiled);
private function onDownloadProgress(event:ProgressEvent):void {
//
}
private function onDownloadComplete(event:Event):void {
//
}
private function onModelCompiled(event:ModelEvent):void {
model.load();
}
var model:Model = Model.fromPath(File.applicationStorageDirectory.resolvePath("MobileNet.mlmodel").nativePath, onCompiled);
private function onModelCompiled(event:ModelEvent):void {
model.load();
}
var testImage:Bitmap = new TestImage() as Bitmap;
var mobileNet:MobileNet = new MobileNet(testImage.bitmapData);
model.prediction(mobileNet, onMobileNetResult);
}
You will need:
- a Mac. Windows is not supported
- IntelliJ IDEA
- AIR 33.0.2.338+
- Xcode 11.3
- wget on macOS via
brew install wget
- Sample input Models (MobileNet, SqueezeNet, Apple Mars, Hot Dog Not Hot Dog)
- Inputs
- Image
- Int64
- Double
- String
- Dictionary
- MultiArray
- Camera (iOS)
- Camera Roll (iOS)
- Outputs
- Image
- Double
- String
- MultiArray
- Dictionary