network as cifar10_cnn.py • Available in Keras example networks • cifar10 (dataset): 80 million images, 10 classes • create_data_csv.py, train.py • (Skipped data augmentation) 26
! OR • Download your model and compile it on device ! • MLModel#compileModel(at:) • Ref: Downloading and Compiling a Model on the User's Device | Apple Developer Documentation 32
// Assume in `do` block let url = URL(string: "https://your_model_url.mlmodel")! let data = try Data(contentsOf: url) try data.write(to: filePathUrl) let compiledUrl = try MLModel.compileModel(at: filePathUrl) let model = try MLModel(contentsOf: compiledUrl) // And use model // ... 33
! • And if Core ML satisfies your business requirements • if you're an individual developer? • Easy to copy-and-paste, but how to improve? • Understainding of statistics, learning algorithms, evaluation, ... • life is limited (it's great if you want to learn ML of course) 35
to make use of these models. You continue to focus on the use case you're trying to enable and let Core ML handle those low-level details." https://developer.apple.com/videos/play/wwdc2017/703/ 36
test_data = data.random_split(0.8) # Automatically picks the right model based on your data. # Based on Transfer Learning model = tc.image_classifier.create(train_data, target='label') predictions = model.predict(test_data) metrics = model.evaluate(test_data) model.save('mymodel.model') model.export_coreml('MyCustomImageClassifier.mlmodel') 39
ResNet50...102.6MB, VGG16...553.5 MB ! • Integrating / replacing is not realistic • No model compression technique in Core ML (currently) • Depends on your task / application • Reducing the Size of Your Core ML App | Apple Developer Documentation 40
convert your model if it include components Core ML doesn't support • Model data protection • Parameters are not encrypted / can be seen • etc. • Why Core ML will not work for your app (most likely) 41
• Vision Framework: Building on Core ML • iOS 11: Machine Learning for everyone • Why Core ML will not work for your app (most likely) • CoreMLͰΞΠυϧإೝࣝΞϓϦΛ࡞Ζ͏ 43