moutend / TrainingMLImageClassifier

The sample app for training and inference of an image classification model on iPhone using MLImageClassifier.
MIT License
0 stars 0 forks source link

Unexpected error occurs: MLImageClassifier.FeatureExtractorType.scenePrint(revision: nil) #1

Closed moutend closed 3 months ago

moutend commented 3 months ago

Summary

I don't know why, but specifying scenePrint(revision: nil) in iOS 17 results in the following error and the model training fails.

MLModelAsset: load failed with error Error Domain=com.apple.CoreML Code=0 "Must allow 2048-element vector as output" UserInfo={NSLocalizedDescription=Must allow 2048-element vector as output}

According to the Apple Developer Documentation, if nil is specified as the revision number, it should be treated as the latest revision number.

The sceneprint version. The supported versions include 1 and 2. If nil defaults to the latest version.

Source: https://developer.apple.com/documentation/createml/mlimageclassifier/featureextractortype/sceneprint(revision:)

Verification Results

iOSバージョン revision: 1 revision: 2 revision: nil
iOS 15 Works Not supported Works
iOS 17 Works Works Unexpected error occurs

The revision number 2 is available from iOS 17. So that specifying 2 on iOS 15 results in an error, which is the expected behavior and not a problem.

It is likely that there is a bug in the internal implementation of Create ML framework.

TODO

It seems better to avoid specifying nil. I will later modify the implementation of Logic/ImageTrainer.swift.

moutend commented 3 months ago

Closing because fixed by PR #2.