Shortcuts

encoding.utils

Useful util functions.

Encoding Util Tools

LR_Scheduler

class encoding.utils.LR_Scheduler(mode, base_lr, num_epochs, iters_per_epoch=0, lr_step=0, warmup_epochs=0, quiet=False)[source]

Learning Rate Scheduler

Step mode: lr = baselr * 0.1 ^ {floor(epoch-1 / lr_step)}

Cosine mode: lr = baselr * 0.5 * (1 + cos(iter/maxiter))

Poly mode: lr = baselr * (1 - iter/maxiter) ^ 0.9

Parameters
  • argsargs.lr_scheduler lr scheduler mode (cos, poly), args.lr base learning rate, args.epochs number of epochs, args.lr_step

  • iters_per_epoch – number of iterations per epoch

save_checkpoint

encoding.utils.save_checkpoint(state, args, is_best, filename='checkpoint.pth.tar')[source]

Saves checkpoint to disk

SegmentationMetric

class encoding.utils.SegmentationMetric(nclass)[source]

Computes pixAcc and mIoU metric scroes

batch_pix_accuracy

encoding.utils.batch_pix_accuracy(output, target)[source]

Batch Pixel Accuracy :param predict: input 4D tensor :param target: label 3D tensor

batch_intersection_union

encoding.utils.batch_intersection_union(output, target, nclass)[source]

Batch Intersection of Union :param predict: input 4D tensor :param target: label 3D tensor :param nclass: number of categories (int)