peal.architectures.basic_modules.ImgSelfAttentionLayer¶
- class peal.architectures.basic_modules.ImgSelfAttentionLayer[source]¶
Bases:
ModuleSelf-attention over the spatial positions of an image feature map.
Two extra channels holding normalised row / column coordinates are concatenated to the input as positional encoding, the map is flattened to a
(B, H*W, C+2)sequence, attended, and reshaped back to(B, C, H, W).- Parameters:
Methods
Attend over spatial positions of
xof shape(B, C, H, W).