spatial_softmax
spatial_softmax
¶
SpatialSoftmax
¶
Bases: Module
Spatial softmax layer for extracting keypoints from feature maps, based on https://rll.berkeley.edu/dsae/dsae.pdf
Initializes the SpatialSoftmax module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height
|
int
|
Height of the input feature map |
required |
width
|
int
|
Width of the input feature map |
required |
channel
|
int
|
Number of channels in the input feature map |
required |
temperature
|
float
|
Temperature parameter for softmax |
1.0
|
learnable_temperature
|
bool
|
If True, temperature is a learnable parameter |
False
|
Source code in src/versatil/models/layers/pooling/spatial_softmax.py
forward
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Tensor
|
(B, C, H, W) feature map |
required |
Returns: keypoints: (B, C * 2)