<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLObjectDetector/train(trainingData:annotationType:parameters:sessionParameters:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML16MLObjectDetectorV5train12trainingData14annotationType10parameters17sessionParametersAA5MLJobCyACGAC0G6SourceO_AC010AnnotationI0OAC05ModelL0VAA017MLTrainingSessionL0VtKFZ"
  },
  "title" : "train(trainingData:annotationType:parameters:sessionParameters:)"
}
-->

# train(trainingData:annotationType:parameters:sessionParameters:)

Begins an asynchronous object-detector training session.

```
static func train(trainingData: MLObjectDetector.DataSource, annotationType: MLObjectDetector.AnnotationType, parameters: MLObjectDetector.ModelParameters = ModelParameters(), sessionParameters: MLTrainingSessionParameters = __Defaults.sessionParameters) throws -> MLJob<MLObjectDetector>
```

## Parameters

`trainingData`

The annotated images the task uses to train the object detector.

`annotationType`

The format your data source uses for its image annotations.

`parameters`

An [`MLObjectDetector.ModelParameters`](/documentation/CreateML/MLObjectDetector/ModelParameters-swift.struct) instance you use to set the model
configuration settings for the training session.

`sessionParameters`

An [`MLTrainingSessionParameters`](/documentation/CreateML/MLTrainingSessionParameters) instance you use to configure the training session.

## Return Value

An [`MLJob`](/documentation/CreateML/MLJob) that represents the object-detector training session.

---

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)