# base_engine

Python API: `luxonis_ml.data.augmentations.base_engine`

## Classes

### AugmentationEngine

#### Methods

##### init

```python
def __init__(height: int, width: int, targets: Mapping[str, str], n_classes: Mapping[str, int], source_names: list[str], config: Iterable[Params], keep_aspect_ratio: bool, is_validation_pipeline: bool | None = None, pipeline_stage: Literal['train', 'val', 'test'] | None = None, min_bbox_visibility: float = 0.0, seed: int | None = None, bbox_area_threshold: float = 0.0004):
```

Initialize augmentation pipeline from configuration.

Parameters

 * `height` (`int`): Target image height.
 * `width` (`int`): Target image width.
 * `targets` (`Mapping[str, str]`): Task names mapped to task types, such as `{"detection/boundingbox": "bbox"}`.
 * `n_classes` (`Mapping[str, int]`): Number of associated classes for each task, such as `{"cars/boundingbox": 2}`.
 * `source_names` (`list[str]`): Source names expected in loader images.
 * `config` (`Iterable[Params]`): Augmentation configuration. Each item describes one augmentation; interpretation is
   engine-specific.
 * `keep_aspect_ratio` (`bool`): Whether to preserve image aspect ratio while resizing.
 * `is_validation_pipeline` (`bool | None`): Optional backward-compatible train-versus-eval hint.> **Deprecated**
   > Deprecated since version 0.5.0:use `pipeline_stage` instead.
 * `pipeline_stage` (`Literal['train', 'val', 'test'] | None`): Optional explicit pipeline stage. When provided, it takes
   precedence over `is_validation_pipeline`.
 * `min_bbox_visibility` (`float`): Minimum fraction of the original bounding box that must remain visible after augmentation.
 * `seed` (`int | None`): Optional random seed for reproducible augmentation.
 * `bbox_area_threshold` (`float`): Minimum normalized area for bounding boxes to remain valid. The default removes very small
   boxes and their associated keypoints.

##### apply

```python
def apply(input_batch: list[LoaderMultiOutput]) -> LoaderMultiOutput:
```

Apply the augmentation pipeline to the data.

Parameters

 * `input_batch` (`list[LoaderMultiOutput]`): Loader outputs to augment. The number of items must match the engine's batch size.

Returns

 * `LoaderMultiOutput`: Augmented loader output.

#### Attributes

##### batch_size

The batch size required by the augmentation pipeline.

The batch size is the number of images requested by the augmentation pipeline in case of batch-based augmentations.

For example, if the augmentation pipeline contains the MixUp augmentation, the batch size should be 2.

If the pipeline requires MixUp and also Mosaic4 augmentations, the batch size should be 8 = (2⋅4).

## Attributes

### AUGMENTATION_ENGINES

Registry for augmentation engines.
