<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLObjectDetector/prediction(from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML16MLObjectDetectorV10prediction4fromSayAC16ObjectAnnotationVG10Foundation3URLV_tKF"
  },
  "title" : "prediction(from:)"
}
-->

# prediction(from:)

Locates objects in an image and generates an annotation for each object it detects.

```
func prediction(from image: URL) throws -> MLObjectDetector.DetectedObjects
```

## Parameters

`image`

The URL for the image file where you want the object detector to look for objects.

## Return Value

An [`MLObjectDetector.DetectedObjects`](/documentation/CreateML/MLObjectDetector/DetectedObjects) instance — which is an [`MLObjectDetector.ObjectAnnotation`](/documentation/CreateML/MLObjectDetector/ObjectAnnotation)
array — where each annotation represents an item the object detector found in the image.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)