otx.algo.callbacks.unlabeled_loss_warmup#

Module for defining hook for semi-supervised learning for classification task.

Classes

UnlabeledLossWarmUpCallback([warmup_steps_ratio])

Hook for SemiSL for classification.

class otx.algo.callbacks.unlabeled_loss_warmup.UnlabeledLossWarmUpCallback(warmup_steps_ratio: float = 0.2)[source]#

Bases: Callback

Hook for SemiSL for classification.

This hook includes unlabeled warm-up loss coefficient (default: True):

unlabeled_coef = (0.5 - cos(min(pi, 2 * pi * k) / K)) / 2 k: current step, K: total steps

Parameters:

warmup_steps_ratio (float) – Ratio of warm-up steps to total steps (default: 0.2).

on_train_batch_start(trainer: Trainer, pl_module: LightningModule, batch: Any, batch_idx: int) None[source]#

Calculate the unlabeled warm-up loss coefficient before training iteration.