Why is my ml model returning VNCoreMLFeatureValueObservation instead VNRecognizedObjectObservation?

I'm training a machine learning model in PyTorch using YOLOv5 from Ultralytics.

CoreMLTools from Apple is used to convert the PyTorch (.pt) model into a CoreML model (.mlmodel).

This works fine, and I can use it in my iOS App, but I have to access the prediction output of the Model "manually". The output shape of the model is MultiArray : Float32 1 × 25500 × 46 array.

From the VNCoreMLRequest I receive only VNCoreMLFeatureValueObservation from this I can get the MultiArray and iterate through it, to find the data I need.

But I see that Apple offers for Object Detection models VNRecognizedObjectObservation type, which is not returned for my model.

What is the reason why my model is not supported to return the VNRecognizedObjectObservation type? Can I use CoreMLTools to enable it?

Post not yet marked as solved Up vote post of Waterfront Down vote post of Waterfront
1.4k views

Replies

Hi Waterfront. Experiencing the same issue. Did you find a solution? :)

found a solution

https://betterprogramming.pub/how-to-build-a-yolov5-object-detection-app-on-ios-39c8c77dfe58

git clone https://github.com/hietalajulius/yolov5
python export-nms.py --include coreml --weights yolov5n.pt