TwoStageDetectionLossOptions

Options & Configuration · AiDotNet.ComputerVision.Detection.Losses

Sampling and weighting for training two-stage (R-CNN family) detectors.

For Beginners

a two-stage detector first proposes regions that might hold objects, then classifies and refines them. These settings decide which proposals count as objects or background while training, how many of each are used, and how strongly box positions are corrected.

How It Works

Defaults follow the published recipes. Region proposal network (Ren et al. 2015, Sec. 3.1.2-3.1.3): an anchor is positive when its IoU with an object exceeds 0.7 or it is an object’s best anchor, negative below 0.3; 256 anchors per image are sampled with up to half positive; the classification term is averaged over the sample and the regression term is weighted by lambda = 10 and normalized by the number of anchor locations. Region-of-interest head (Girshick 2015, Sec. 2.3): 64 RoIs per image, 25% from proposals with IoU of at least 0.5, the rest from IoU in [0.1, 0.5), with smooth-L1 box regression weighted 1. Cascade R-CNN (Cai and Vasconcelos 2018, Sec. 5.1) trains three stages at IoU thresholds 0.5, 0.6 and 0.7, each with that loss.

Constructors

Constructor Summary
TwoStageDetectionLossOptions()

Properties

Property Summary
double RoiBackgroundIoULow { get; set; } Lower bound of the background IoU interval [low, foreground threshold).
double RoiForegroundFraction { get; set; } Largest fraction of the RoI sample drawn from foreground proposals.
double RoiRegressionWeight { get; set; } Weight of the detection-head box-regression term.
double RpnNegativeIoU { get; set; } IoU below which an anchor is a negative (background) proposal example.
double RpnPositiveFraction { get; set; } Largest fraction of the anchor sample that may be positive.
double RpnPositiveIoU { get; set; } IoU above which an anchor is a positive proposal example.
double RpnRegressionWeight { get; set; } Weight lambda of the proposal box-regression term.
double[] StageForegroundIoU { get; set; } Foreground IoU threshold of each detection stage; Faster R-CNN uses the first.
double[] StageLossWeights { get; set; } Weight of each detection stage’s loss in the total objective.
double[][] StageBoxRegressionWeights { get; set; } Per-stage weights (wx, wy, ww, wh) the box-regression targets are multiplied by, and the predicted deltas divided by when decoded.
int RoiBatchSizePerImage { get; set; } Regions of interest sampled per image for the detection-head loss.
int RpnBatchSizePerImage { get; set; } Anchors sampled per image for the proposal loss.