biapy.engine

BiaPy engine package.

This package contains core workflow classes, training and evaluation engines, metrics, and learning rate schedulers for deep learning pipelines in BiaPy.

biapy.engine.prepare_optimizer(cfg: CfgNode, model_without_ddp: Module | DistributedDataParallel, steps_per_epoch: int) Tuple[Optimizer, ReduceLROnPlateau | WarmUpCosineDecayScheduler | OneCycleLR | None][source]

Create and configure the optimizer and learning rate scheduler for the given model.

This function selects and initializes the optimizer (e.g., Adam, AdamW) and, if specified, the learning rate scheduler (ReduceLROnPlateau, WarmUpCosineDecayScheduler, or OneCycleLR) based on the configuration.

Parameters:
  • cfg (YACS CN object) – Configuration object with optimizer and scheduler settings.

  • model_without_ddp (nn.Module or nn.parallel.DistributedDataParallel) – The model to optimize.

  • steps_per_epoch (int) – Number of steps (batches) per training epoch.

Returns:

  • optimizer (Optimizer) – Configured optimizer for the model.

  • lr_scheduler (Scheduler or None) – Configured learning rate scheduler, or None if not specified.

biapy.engine.build_callbacks(cfg: CfgNode) EarlyStopping | None[source]

Create training and validation generators.

Parameters:

cfg (YACS CN object) – Configuration.

Returns:

callbacks – All callbacks to be applied to a model.

Return type:

List of callbacks

Submodules

Module

Description

biapy.engine.base_workflow

Base workflow class that provides the main structure and utility methods for building training and inference workflows in BiaPy.

biapy.engine.check_configuration

Configuration checking utilities for BiaPy.

biapy.engine.classification

Engine for image classification workflows.

biapy.engine.denoising

Engine for image denoising workflows.

biapy.engine.detection

Engine for object detection workflows.

biapy.engine.instance_seg

Engine for instance segmentation workflows.

biapy.engine.metrics

Metrics and evaluation utilities for model training and validation.

biapy.engine.schedulers

Learning rate schedulers and related utilities.

biapy.engine.schedulers.warmup_cosine_decay

Warmup cosine decay learning rate scheduler.

biapy.engine.self_supervised

Engines for self-supervised learning workflows (pre-training).

biapy.engine.semantic_seg

Engine for semantic segmentation workflows.

biapy.engine.super_resolution

Engine for single image super-resolution workflows.

biapy.engine.train_engine

Training and evaluation engine for BiaPy.