---
title: "init(validation:batchSize:maxIterations:gridSize:algorithm:)"
framework: createml
role: symbol
role_heading: Initializer
path: "createml/mlobjectdetector/modelparameters-swift.struct/init(validation:batchsize:maxiterations:gridsize:algorithm:)"
---

# init(validation:batchSize:maxIterations:gridSize:algorithm:)

Creates a model parameters instance for an object-detector training session.

## Declaration

```swift
init(validation: MLObjectDetector.ModelParameters.ValidationData = .split(strategy: .automatic), batchSize: Int? = nil, maxIterations: Int? = nil, gridSize: CGSize = CGSize(width: 13, height: 13), algorithm: MLObjectDetector.ModelParameters.ModelAlgorithmType = .darknetYolo)
```

## Parameters

- `validation`: An doc://com.apple.createml/documentation/CreateML/MLObjectDetector/ModelParameters-swift.struct/ValidationData instance that contains your validation dataset.
- `batchSize`: The number of images the object detector uses for each training iteration. If you don’t have a preference, set this parameter to nil to tell Create ML to use an appropriate value when it trains the model.
- `maxIterations`: The largest number of training iterations the object detector can use. If you don’t have a preference, set this parameter to nil to tell Create ML to use an appropriate value when it trains the model.
- `gridSize`: The number of rectangles, vertically and horizontally, the training algorithm uses to analyze each input image.
- `algorithm`: The algorithm the training session uses to train the object detector.

## See Also

### Creating object detector parameters

- [init(validation:batchSize:maxIterations:)](createml/mlobjectdetector/modelparameters-swift.struct/init(validation:batchsize:maxiterations:).md)
- [init(validationData:batchSize:maxIterations:)](createml/mlobjectdetector/modelparameters-swift.struct/init(validationdata:batchsize:maxiterations:).md)
