---
title: "prediction(from:)"
framework: createml
role: symbol
role_heading: Instance Method
path: "createml/mlobjectdetector/prediction(from:)"
---

# prediction(from:)

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

## Declaration

```swift
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

Return Value An MLObjectDetector.DetectedObjects instance — which is an MLObjectDetector.ObjectAnnotation array — where each annotation represents an item the object detector found in the image.

## See Also

### Testing an object detector

- [predictions(from:)](createml/mlobjectdetector/predictions(from:).md)
- [MLObjectDetector.DetectedObjects](createml/mlobjectdetector/detectedobjects.md)
- [MLObjectDetector.ObjectAnnotation](createml/mlobjectdetector/objectannotation.md)
