Vision framework not working on Apple Vision Pro

com.apple.Vision Code=9 "Could not build inference plan - ANECF error: failed to load ANE model file:///System/Library/Frameworks/ Vision.framework/anodv4_drop6_fp16.H14G.espresso.hwx

Code rise this error:

func imageToHeadBox(image: CVPixelBuffer) async throws -> [CGRect] {

    let request:DetectFaceRectanglesRequest = DetectFaceRectanglesRequest()
    let faceResult:[FaceObservation] = try await request.perform(on: image)
    let faceBoxs:[CGRect] = faceResult.map { face in
        let faceBoundingBox:CGRect = face.boundingBox.cgRect
        return faceBoundingBox
    }
    return faceBoxs
}

Answered by DTS Engineer in 802387022

Hello @Shengjiang,

Vision framework makes use of the Apple Neural Engine when it can, however, on visionOS your app must have the com.apple.developer.coreml.neural-engine-access entitlement to be able to use the Apple Neural Engine.

If you do not have that entitlement, or are unable to get it, you can restrict the compute devices that your DetectFaceRectanglesRequest uses with the setComputeDevice(_:for:) method.

Best regards,

Greg

Hello @Shengjiang,

Vision framework makes use of the Apple Neural Engine when it can, however, on visionOS your app must have the com.apple.developer.coreml.neural-engine-access entitlement to be able to use the Apple Neural Engine.

If you do not have that entitlement, or are unable to get it, you can restrict the compute devices that your DetectFaceRectanglesRequest uses with the setComputeDevice(_:for:) method.

Best regards,

Greg

Vision framework not working on Apple Vision Pro
 
 
Q