models.generator.Head#
- class Head(cfg: str | ListGen, num_classes: int, in_shape: List[int], init_weights: bool = True)[source]#
Bases:
Module
Head model holder
Applies a head model to multiple maps and merges them. For each input map, its own
HeadGen
model is generated. Predictions obtained for different feature maps are combined.- Parameters:
Methods
Direct network pass
Attributes
training
- forward(X: List[Tensor]) tuple[Tensor, Tensor, Tensor] [source]#
Direct network pass
- Parameters:
X (List[torch.Tensor]) – Feature map list. One map shape [ts, batch, channel, h, w].
- Returns:
Predictions made by a neural network. Contains three tensors:
anchors: Shape [anchor, 4]
cls_preds: Shape [ts, batch, anchor, num_classes + 1]
bbox_preds: Shape [ts, batch, anchor, 4]
- Return type: