<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLObjectDetector/init(trainingData:parameters:annotationType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML16MLObjectDetectorV12trainingData10parameters14annotationTypeA2C0F6SourceO_AC15ModelParametersVAC010AnnotationI0OtKcfc"
  },
  "title" : "init(trainingData:parameters:annotationType:)"
}
-->

# init(trainingData:parameters:annotationType:)

Creates an object detector with a data source.

```
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 [`MLObjectDetector.ModelParameters`](/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

Use this initializer to create an object detector with an [`MLObjectDetector.DataSource`](/documentation/CreateML/MLObjectDetector/DataSource).

---

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)