---
title: "init(trainingData:parameters:annotationType:)"
framework: createml
role: symbol
role_heading: Initializer
path: "createml/mlobjectdetector/init(trainingdata:parameters:annotationtype:)"
---

# init(trainingData:parameters:annotationType:)

Creates an object detector with a data source.

## Declaration

```swift
init(trainingData: MLObjectDetector.DataSource, parameters: MLObjectDetector.ModelParameters = .init(), annotationType: MLObjectDetector.AnnotationType) throws
```

## Parameters

- `trainingData`: A data source that contains the annotated images the task uses to train the object detector.
- `parameters`: An doc://com.apple.createml/documentation/CreateML/MLObjectDetector/ModelParameters-swift.struct instance you use to set the model configuration settings for the training session.
- `annotationType`: The format your data source uses for its image annotations.

## Discussion

Discussion Use this initializer to create an object detector with an MLObjectDetector.DataSource.

## See Also

### Training an object detector synchronously

- [init(trainingData:imageColumn:annotationColumn:annotationType:parameters:)](createml/mlobjectdetector/init(trainingdata:imagecolumn:annotationcolumn:annotationtype:parameters:).md)
