New Vison api - CoreML - "The VNDetectorProcessOption_ScenePrints required option was not found"

I'm trying to run a coreML model. This is an image classifier generated using:

        let parameters =  MLImageClassifier.ModelParameters(validation: .dataSource(validationDataSource),
                                                            maxIterations: 25,
            augmentation: [],
            algorithm: .transferLearning(
                featureExtractor: .scenePrint(revision: 2),
                classifier: .logisticRegressor
            ))

        let model = try MLImageClassifier(trainingData: .labeledDirectories(at: trainingDir.url), parameters: parameters)

I'm trying to run it with the new async Vision api

        let model = try  MLModel(contentsOf: modelUrl)
        
        guard let modelContainer = try? CoreMLModelContainer(model: model) else {
            fatalError("The model is missing")
        }
        
        let request = CoreMLRequest(model: modelContainer)
        
        let image = NSImage(named:"testImage")!
        let cgImage = image.toCGImage()!
        
        let handler = ImageRequestHandler(cgImage)
        
        do {
            let results = try await handler.perform(request)
            print(results)
        } catch  {
            print("Failed: \(error)")
        }

This gives me

Failed: internalError("Error Domain=com.apple.Vision Code=7 "The VNDetectorProcessOption_ScenePrints required option was not found" UserInfo={NSLocalizedDescription=The VNDetectorProcessOption_ScenePrints required option was not found}")

Please help! Am I missing something?

I’m encountering the same error with the code below. Interestingly, my previous version, which used VNCoreMLRequest, is working without issues.

func makePredictions(for photo: CGImage) async throws -> [ImagePrediction] {
    guard let imageClassifier = try? MyClassifier(),
          let imageModelContainer = try? CoreMLModelContainer(model: imageClassifier.model) else {
        return []
    }
    
    var request = CoreMLRequest(model: imageModelContainer)
    request.cropAndScaleAction = .centerCrop
    
    let results = try await request.perform(on: photo)
    
    guard let observations = results as? [ClassificationObservation] else {
        return []
    }
    
    let imagePredictions = observations.map { observation in
        ImagePrediction(
            classification: observation.identifier,
            confidence: observation.confidence
        )
    }
    
    return imagePredictions
}
New Vison api - CoreML - "The VNDetectorProcessOption_ScenePrints required option was not found"
 
 
Q