Use:
var mlImgClass = try? MLImageClassifier(trainingData: datasource, parameters: parameters)
Instead of:
var trainJob = try MLImageClassifier.train(
trainingData: datasource,
parameters: parameters,
sessionParameters:sessionParameters
)
(... handle the job progress ...)
I'm sorry to say that I don't understand why creating a job creates so many complications, but using the MLImageClassifier directly is even more rapid and efficient.
Is possible that the train function has a similar behavior of makeTrainingSession where you can handle a session with the MLTrainingSession. In this case you have an array of checkpoints (MLCheckpoint). Every checkpoint has an url: you should load the model from this location to make a prediction. The original documentation is not enough intuitive.
Topic:
Machine Learning & AI
SubTopic:
General
Tags: