pub fn detect<D: Float + 'static>(
nc: usize,
ch: &[usize],
head: DetectHead,
) -> impl Fn(Vec<SymTensor>) -> DetectOutput + use<D>Expand description
YOLO26 Detect head: 3 FPN feature maps → raw boxes + class logits.
Parameters:
nc— number of classes (e.g. 80 for COCO)ch— channel counts for each FPN input, e.g.[256, 512, 512]head— which weight namespace to use (OneToManyfor training,OneToOnefor inference — the latter loadsone2one_cv2/cv3weights and matches ultralytics eval-mode mAP)
Derived widths (matching ultralytics defaults, reg_max = 1):
c2 = max(16, ch[0]/4, reg_max*4)— box branch hidden width (16 for n-size)c3 = max(ch[0], min(nc, 100))— cls branch hidden width (80 for n-size)