deeplabcut.pose_estimation_pytorch.models.detectors.base
Classes:
| Name | Description |
|---|---|
BaseDetector |
Definition of the class BaseDetector object. |
BaseDetector
Definition of the class BaseDetector object.
This is an abstract class defining the common structure and inference for detectors.
Methods:
| Name | Description |
|---|---|
forward |
Forward pass of the detector. |
freeze_batch_norm_layers |
Freezes batch norm layers. |
get_target |
Get the target for training the detector. |
train |
Sets the module in training or evaluation mode. |
Source code in deeplabcut/pose_estimation_pytorch/models/detectors/base.py
forward
abstractmethod
forward(
x: Tensor, targets: list[dict[str, Tensor]] | None = None
) -> tuple[dict[str, torch.Tensor], list[dict[str, torch.Tensor]]]
Forward pass of the detector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tensor
|
images to be processed |
required |
|
list[dict[str, Tensor]] | None
|
ground-truth boxes present in each images |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
losses |
tuple[dict[str, Tensor], list[dict[str, Tensor]]]
|
{'loss_name': loss_value} detections: for each of the b images, {"boxes": bounding_boxes} |
Source code in deeplabcut/pose_estimation_pytorch/models/detectors/base.py
freeze_batch_norm_layers
Freezes batch norm layers.
Running mean + var are always given to F.batch_norm, except when the layer is
in train mode and track_running_stats is False, see
https://pytorch.org/docs/stable/_modules/torch/nn/modules/batchnorm.html
So to 'freeze' the running stats, the only way is to set the layer to "eval"
mode.
Source code in deeplabcut/pose_estimation_pytorch/models/detectors/base.py
get_target
abstractmethod
Get the target for training the detector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
annotations containing keypoints, bounding boxes, etc. |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
list of dictionaries, each representing target information for a single annotation. |
Source code in deeplabcut/pose_estimation_pytorch/models/detectors/base.py
train
Sets the module in training or evaluation mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
whether to set training mode (True) or evaluation mode (False) |
True
|