Create ML

RSS for tag

Create machine learning models for use in your app using Create ML.

Create ML Documentation

Posts under Create ML tag

65 Posts
Sort by:
Post marked as solved
1 Replies
676 Views
I am trying to make an Image Classifier but I keep getting a warning 'init()' is deprecated: Use init(configuration:) instead and handle errors appropriately. I was wondering if it matters because the app gets made and the classifier works. Just wondering what the warning means. Thanks in advance!
Posted
by SkillzApp.
Last updated
.
Post not yet marked as solved
0 Replies
487 Views
Create a sample project in Creat ML and choose Activity Classifier. When lowering the sample rate, the preview timeline gets shorter instead of getting longer. Furthermore, it seems the entire preview timeline breaks (can't scroll) if the sample rate is anything other than 50. Try it out: Train a model with sample rate 50, then try training it with sample rate 10.
Posted
by jakemor.
Last updated
.
Post not yet marked as solved
1 Replies
551 Views
DataFrame(contentsOfJSONFile:url) (and it's MLDataTable equivalent) assumes that the rows to be imported are at the root level of the JSON structure. However, I'm downloading a fairly large dataset that has "header" information, such as date created and validity period, with the targeted array at a subsidiary level. The DataFrame initialiser has JSONReadingOptions, but these don't apply to this situation (i.e. there's nothing that helps). It seems that I'm faced with the options of 1) stripping the extraneous data from the JSON file, to leave just the array or 2) decoding the JSON file into a bespoke struct then converting its array into a DataFrame - which removes a lot of the benefits of using DataFrame in the first place. Any thoughts? Cheers, Michaela
Posted Last updated
.
Post not yet marked as solved
0 Replies
527 Views
Hi, I try the activity classifier and want to show the results with an app on a IPhone SE. I try the example analog https://apple.github.io/turicreate/docs/userguide/activity_classifier/export_coreml.html When calling the prediction function: ...    func performModelPrediction () -> String? { ... EXC_BAD_ACCESS (code=1, address=0x0) was thrown in line:         let modelPrediction = try! activityClassificationModel.prediction( ^^^^^^^^here was the Error shown   I can trak it down to the source of the mlmodel:     func prediction(input: MyActivityClassifier2Input, options: MLPredictionOptions) throws -> MyActivityClassifier2Output {         let outFeatures = try model.prediction(from: input, options:options)         return MyActivityClassifier2Output(features: outFeatures)     } I created the model with ml creator, working with Xcode 13 beta. What I am doing wrong ? Do you have any hints ? Is there a better example for activity classifier ? Don't hesitate to ask for further details. -Hans here my code: // //  ViewController.swift //  motionstor4yboard // //  Created by Hans Regler on 19.07.21. // import Foundation import UIKit import CoreML import CoreMotion class ViewController: UIViewController {     override func viewDidLoad() {         debugPrint("info: start viewDidLoad ... ")         super.viewDidLoad()         // Do any additional setup after loading the view, typically from a nib.                 // Connect data:         self.startDeviceMotion()     }      // Define some ML Model constants for the recurrent network   struct ModelConstants {     static let numOfFeatures = 6     // Must be the same value you used while training     static let predictionWindowSize = 100     static let sensorsUpdateInterval = 1.0 / 10.0     static let stateInLength = 400   }      // Initialize the model, layers, and sensor data arrays     let activityClassificationModel = MyActivityClassifier2()     var currentIndexInPredictionWindow = 0     let accelDataX = try! MLMultiArray(shape: [ModelConstants.predictionWindowSize] as [NSNumber], dataType: MLMultiArrayDataType.double)     let accelDataY = try! MLMultiArray(shape: [ModelConstants.predictionWindowSize] as [NSNumber], dataType: MLMultiArrayDataType.double)     let accelDataZ = try! MLMultiArray(shape: [ModelConstants.predictionWindowSize] as [NSNumber], dataType: MLMultiArrayDataType.double)     let gyroDataX = try! MLMultiArray(shape: [ModelConstants.predictionWindowSize] as [NSNumber], dataType: MLMultiArrayDataType.double)     let gyroDataY = try! MLMultiArray(shape: [ModelConstants.predictionWindowSize] as [NSNumber], dataType: MLMultiArrayDataType.double)     let gyroDataZ = try! MLMultiArray(shape: [ModelConstants.predictionWindowSize] as [NSNumber], dataType: MLMultiArrayDataType.double)     var stateOutput = try! MLMultiArray(shape:[ModelConstants.stateInLength as NSNumber], dataType: MLMultiArrayDataType.double)     // Initialize CoreMotion Manager   let motionManager = CMMotionManager()      func startDeviceMotion() { //         guard motionManager.isDeviceMotionAvailable else {     guard motionManager.isAccelerometerAvailable, motionManager.isGyroAvailable else {             debugPrint("Core Motion Data Unavailable!")             return         }          motionManager.accelerometerUpdateInterval = TimeInterval(ModelConstants.sensorsUpdateInterval)     motionManager.gyroUpdateInterval = TimeInterval(ModelConstants.sensorsUpdateInterval)     motionManager.startAccelerometerUpdates(to: .main) { accelerometerData, error in         guard let accelerometerData = accelerometerData else {             print("Error: accelerometerData = accelerometerData")             return }         // Add the current data sample to the data array         self.addAccelSampleToDataArray(accelSample: accelerometerData)     }             }      func addAccelSampleToDataArray (accelSample: CMAccelerometerData) {     // Add the current accelerometer reading to the data array     accelDataX[[currentIndexInPredictionWindow] as [NSNumber]] = accelSample.acceleration.x as NSNumber     accelDataY[[currentIndexInPredictionWindow] as [NSNumber]] = accelSample.acceleration.y as NSNumber     accelDataZ[[currentIndexInPredictionWindow] as [NSNumber]] = accelSample.acceleration.z as NSNumber     // Update the index in the prediction window data array     currentIndexInPredictionWindow += 1     // If the data array is full, call the prediction method to get a new model prediction.     // We assume here for simplicity that the Gyro data was added to the data arrays as well.     if (currentIndexInPredictionWindow == ModelConstants.predictionWindowSize) {         if let predictedActivity = performModelPrediction() {             // Use the predicted activity here             // ...             // Start a new prediction window             currentIndexInPredictionWindow = 0         }     } }          func performModelPrediction () -> String? {         // Perform model prediction         let modelPrediction = try! activityClassificationModel.prediction(             acceleration_x: accelDataX,             acceleration_y: accelDataY,             acceleration_z: accelDataZ,             rotation_x: gyroDataX,             rotation_y: gyroDataY,             rotation_z: gyroDataZ,             stateIn: stateOutput)         // Update the state vector         stateOutput = modelPrediction.stateOut         // Return the predicted activity - the activity with the highest probability         return modelPrediction.label     }
Posted
by Hans242.
Last updated
.
Post not yet marked as solved
5 Replies
919 Views
Hi Experts, I am new to CreateML. I am trying action classification library. When I start training on training dataset videos. It looks like it goes fine. Once it finishes the training. It blinks to show graphs and then throws Unexpected Error . I have no clue what to do as a next step. I have checked the videos for training, changed the dataset size to very small. But Honestly, I have no idea to fix it. Any help will be highly appreciated. Regards... MTA
Posted
by EArtist.
Last updated
.