deeplabcut.pose_estimation_pytorch.models.modules.csp
Implementation of modules needed for the CSPNeXt Backbone. Used in CSP-style models.
Based on the building blocks used for the mmdetection CSPNeXt implementation. For
more information, see https://github.com/open-mmlab/mmdetection.
Classes:
| Name | Description |
|---|---|
CSPConvModule |
Configurable convolution module used for CSPNeXT. |
CSPLayer |
Cross Stage Partial Layer. |
CSPNeXtBlock |
Basic bottleneck block used in CSPNeXt. |
ChannelAttention |
Channel attention Module. |
DepthwiseSeparableConv |
Depth-wise separable convolution module used for CSPNeXT. |
SPPBottleneck |
Spatial pyramid pooling layer used in YOLOv3-SPP and (among others) CSPNeXt. |
CSPConvModule
Bases: Module
Configurable convolution module used for CSPNeXT.
Applies sequentially - a convolution - (optional) a norm layer - (optional) an activation function
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Input channels of the convolution. |
required |
|
int
|
Output channels of the convolution. |
required |
|
int | tuple[int, int]
|
Convolution kernel size. |
required |
|
int | tuple[int, int]
|
Convolution stride. |
1
|
|
int | tuple[int, int]
|
Convolution padding. |
0
|
|
int | tuple[int, int]
|
Convolution dilation. |
1
|
|
int
|
Number of blocked connections from input to output channels. |
1
|
|
str | None
|
Norm layer to apply, if any. |
None
|
|
str | None
|
Activation function to apply, if any. |
'ReLU'
|
Source code in deeplabcut/pose_estimation_pytorch/models/modules/csp.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
CSPLayer
Bases: Module
Cross Stage Partial Layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
input channels for the layer |
required |
|
int
|
output channels for the block |
required |
|
float
|
expansion factor for the mid-channels |
0.5
|
|
int
|
the number of blocks to use |
1
|
|
bool
|
add a skip-connection to the blocks |
True
|
|
bool
|
whether to apply channel attention |
False
|
|
str | None
|
Norm layer to apply, if any. |
None
|
|
str | None
|
Activation function to apply, if any. |
'ReLU'
|
Methods:
| Name | Description |
|---|---|
forward |
Forward function. |
Source code in deeplabcut/pose_estimation_pytorch/models/modules/csp.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
forward
Forward function.
Source code in deeplabcut/pose_estimation_pytorch/models/modules/csp.py
CSPNeXtBlock
Bases: Module
Basic bottleneck block used in CSPNeXt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
input channels for the block |
required |
|
int
|
output channels for the block |
required |
|
float
|
expansion factor for the hidden channels |
0.5
|
|
bool
|
add a skip-connection to the block |
True
|
|
int
|
kernel size for the DepthwiseSeparableConv |
5
|
|
str | None
|
Norm layer to apply, if any. |
None
|
|
str | None
|
Activation function to apply, if any. |
'ReLU'
|
Methods:
| Name | Description |
|---|---|
forward |
Forward function. |
Source code in deeplabcut/pose_estimation_pytorch/models/modules/csp.py
forward
Forward function.
Source code in deeplabcut/pose_estimation_pytorch/models/modules/csp.py
ChannelAttention
Bases: Module
Channel attention Module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Number of input/output channels of the layer. |
required |
Source code in deeplabcut/pose_estimation_pytorch/models/modules/csp.py
DepthwiseSeparableConv
Bases: Module
Depth-wise separable convolution module used for CSPNeXT.
Applies sequentially - a depth-wise conv - a point-wise conv
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Input channels of the convolution. |
required |
|
int
|
Output channels of the convolution. |
required |
|
int | tuple[int, int]
|
Convolution kernel size. |
required |
|
int | tuple[int, int]
|
Convolution stride. |
1
|
|
int | tuple[int, int]
|
Convolution padding. |
0
|
|
int | tuple[int, int]
|
Convolution dilation. |
1
|
|
str | None
|
Norm layer to apply, if any. |
None
|
|
str | None
|
Activation function to apply, if any. |
'ReLU'
|
Source code in deeplabcut/pose_estimation_pytorch/models/modules/csp.py
SPPBottleneck
Bases: Module
Spatial pyramid pooling layer used in YOLOv3-SPP and (among others) CSPNeXt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
input channels to the bottleneck |
required |
|
int
|
output channels of the bottleneck |
required |
|
tuple[int, ...]
|
kernel sizes for the pooling layers |
(5, 9, 13)
|
|
str | None
|
norm layer for the bottleneck |
'SyncBN'
|
|
str | None
|
activation function for the bottleneck |
'SiLU'
|