confidence_maps
sleap_nn.data.confidence_maps
¶
Generate confidence maps.
Functions:
Name | Description |
---|---|
generate_confmaps |
Generate Confidence maps. |
generate_multiconfmaps |
Generate multi-instance confidence maps. |
make_confmaps |
Make confidence maps from a batch of points for multiple instances. |
make_multi_confmaps |
Make confidence maps for multiple instances through reduction. |
generate_confmaps(instance, img_hw, sigma=1.5, output_stride=2)
¶
Generate Confidence maps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance
|
Tensor
|
Input keypoints. (n_samples, n_instances, n_nodes, 2) or (n_samples, n_nodes, 2). |
required |
img_hw
|
Tuple[int]
|
Image size as tuple (height, width). |
required |
sigma
|
float
|
The standard deviation of the Gaussian distribution that is used to generate confidence maps. Default: 1.5. |
1.5
|
output_stride
|
int
|
The relative stride to use when generating confidence maps. A larger stride will generate smaller confidence maps. Default: 2. |
2
|
Returns:
Type | Description |
---|---|
Tensor
|
Confidence maps for the input keypoints. |
Source code in sleap_nn/data/confidence_maps.py
generate_multiconfmaps(instances, img_hw, num_instances, sigma=1.5, output_stride=2, is_centroids=False)
¶
Generate multi-instance confidence maps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instances
|
Tensor
|
Input keypoints. (n_samples, n_instances, n_nodes, 2) or for centroids - (n_samples, n_instances, 2) |
required |
img_hw
|
Tuple[int]
|
Image size as tuple (height, width). |
required |
num_instances
|
int
|
Original number of instances in the frame. |
required |
sigma
|
float
|
The standard deviation of the Gaussian distribution that is used to generate confidence maps. Default: 1.5. |
1.5
|
output_stride
|
int
|
The relative stride to use when generating confidence maps. A larger stride will generate smaller confidence maps. Default: 2. |
2
|
is_centroids
|
bool
|
True if confidence maps should be generates for centroids else False. Default: False. |
False
|
Returns:
Type | Description |
---|---|
Tensor
|
Confidence maps for the input keypoints. |
Source code in sleap_nn/data/confidence_maps.py
make_confmaps(points_batch, xv, yv, sigma)
¶
Make confidence maps from a batch of points for multiple instances.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points_batch
|
Tensor
|
A tensor of points of shape |
required |
xv
|
Tensor
|
Sampling grid vector for x-coordinates of shape |
required |
yv
|
Tensor
|
Sampling grid vector for y-coordinates of shape |
required |
sigma
|
float
|
Standard deviation of the 2D Gaussian distribution sampled to generate confidence maps. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
Confidence maps as a tensor of shape |
Source code in sleap_nn/data/confidence_maps.py
make_multi_confmaps(points_batch, xv, yv, sigma)
¶
Make confidence maps for multiple instances through reduction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points_batch
|
Tensor
|
A tensor of shape |
required |
xv
|
Tensor
|
Sampling grid vector for x-coordinates of shape |
required |
yv
|
Tensor
|
Sampling grid vector for y-coordinates of shape |
required |
sigma
|
float
|
Standard deviation of the 2D Gaussian distribution sampled to generate confidence maps. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
Confidence maps as a tensor of shape Each channel will contain the elementwise maximum of the confidence maps generated from all individual points for the associated node. |