deeplabcut.pose_estimation_pytorch.models.target_generators.base
Classes:
| Name | Description |
|---|---|
BaseGenerator |
Generates target maps from ground truth annotations to train models. |
BaseGenerator
Generates target maps from ground truth annotations to train models.
The outputs of the target generator are used to compute losses for model heads. If the head outputs "heatmap" and "offset" tensors, then the corresponding generator must output target "heatmap" and "offset" tensors. The targets themselves are dictionaries, and passed as keyword-arguments to the criterions. This allows to pass masks to the criterions.
Generally, this means that for each head output (such as "heatmap"), a dict will be generated with a "target" key (for the target heatmap) and optionally a "weights" key (see the WeightedCriterion classes).
Methods:
| Name | Description |
|---|---|
forward |
Generates targets. |
Source code in deeplabcut/pose_estimation_pytorch/models/target_generators/base.py
forward
abstractmethod
forward(stride: float, outputs: dict[str, Tensor], labels: dict) -> dict[str, dict[str, torch.Tensor]]
Generates targets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
the stride of the model |
required |
|
dict[str, Tensor]
|
output of a model head |
required |
|
dict
|
the labels for the inputs (each tensor should have shape (b, ...)) |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Tensor]]
|
a dictionary mapping the heads to the inputs of the criterion { "heatmap": { "target": heatmaps, "weights": heatmap_weights, }, "locref": { "target": locref_map, "weights": locref_weights, } } |