Skip to main content

yolo26_dual

Function yolo26_dual 

Source
pub fn yolo26_dual<D: Float + Send + Sync + 'static>(
    nc: usize,
    variant: &Yolo26Variant,
) -> impl Fn(SymTensor) -> DualDetectOutput
Expand description

YOLO26 dual-head forward closure for training with consistent dual assignment.

Traces both the one2many head (cv2/cv3, TAL top_k=10) and the one2one head (one2one_cv2/cv3, TAL top_k=1) in a single graph, sharing the backbone and FPN neck. The returned DualDetectOutput exposes both sets of predictions so the caller can compute weighted losses for each.

Loss weighting schedule (ultralytics-style): early in training weight the one2many head more heavily (it provides dense, stable gradients); gradually shift weight toward the one2one head so it matches inference behaviour by the end of training. Use Yolo26Loss::compute_grads_dual (in models::yolo::loss::yolo26, behind the cuda feature) to apply this.