forward method

Map<String, ValueVector> forward(
  1. ValueVector backboneFeature
)

Forward pass for the object detection head.

Takes a single ValueVector representing the aggregated image feature (e.g., the CLS token output from the ViT backbone).

Returns a Map containing:

  • 'boxes': ValueVector of 4 bounding box coordinates
  • 'logits': ValueVector of class logits (including background)

Implementation

Map<String, ValueVector> forward(ValueVector backboneFeature) {
  // Predict bounding box coordinates
  final ValueVector rawBbox = bboxRegressionHead.forward(backboneFeature);

  // Predict class logits
  final ValueVector classLogits = classPredictionHead.forward(backboneFeature);

  return {
    'boxes': rawBbox,
    'logits': classLogits,
  };
}