deeplabcut.pose_estimation_tensorflow.nnets.conv_blocks
Convolution blocks for mobilenet.
Functions:
| Name | Description |
|---|---|
expanded_conv |
Depthwise Convolution Block with expansion. |
split_conv |
Creates a split convolution. |
split_separable_conv2d |
Separable mobilenet V1 style convolution. |
expanded_conv
expanded_conv(
input_tensor,
num_outputs,
expansion_size=None,
stride=1,
rate=1,
kernel_size=(3, 3),
residual=True,
normalizer_fn=None,
project_activation_fn=tf.identity,
split_projection=1,
split_expansion=1,
split_divisible_by=8,
expansion_transform=None,
depthwise_location="expansion",
depthwise_channel_multiplier=1,
endpoints=None,
use_explicit_padding=False,
padding="SAME",
scope=None,
)
Depthwise Convolution Block with expansion.
Builds a composite convolution that has the following structure expansion (1x1) -> depthwise (kernel_size) -> projection (1x1)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
input |
required | |
|
number of outputs in the final layer. |
required | |
|
the size of expansion, could be a constant or a callable. If latter it will be provided 'num_inputs' as an input. For forward compatibility it should accept arbitrary keyword arguments. Default will expand the input by factor of 6. |
None
|
|
|
depthwise stride |
1
|
|
|
depthwise rate |
1
|
|
|
depthwise kernel |
(3, 3)
|
|
|
whether to include residual connection between input and output. |
True
|
|
|
batchnorm or otherwise |
None
|
|
|
activation function for the project layer |
identity
|
|
|
how many ways to split projection operator (that is conv expansion->bottleneck) |
1
|
|
|
how many ways to split expansion op (that is conv bottleneck->expansion) ops will keep depth divisible by this value. |
1
|
|
|
make sure every split group is divisible by this number. |
8
|
|
|
Optional function that takes expansion as a single input and returns output. |
None
|
|
|
where to put depthwise covnvolutions supported values None, 'input', 'output', 'expansion' |
'expansion'
|
|
|
depthwise channel multiplier: |
1
|
|
|
An optional dictionary into which intermediate endpoints are placed. The keys "expansion_output", "depthwise_output", "projection_output" and "expansion_transform" are always populated, even if the corresponding functions are not invoked. |
None
|
|
|
Use 'VALID' padding for convolutions, but prepad inputs so that the output dimensions are the same as if 'SAME' padding were used. |
False
|
|
|
Padding type to use if |
'SAME'
|
|
|
optional scope. |
None
|
Returns:
| Type | Description |
|---|---|
|
Tensor of depth num_outputs |
Raises:
| Type | Description |
|---|---|
TypeError
|
on inval |
Source code in deeplabcut/pose_estimation_tensorflow/nnets/conv_blocks.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 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 | |
split_conv
Creates a split convolution.
Split convolution splits the input and output into 'num_blocks' blocks of approximately the same size each, and only connects i-th input to i output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
input tensor |
required | |
|
number of output filters |
required | |
|
num blocks to split by. |
required | |
|
scope for all the operators. |
required | |
|
make sure that every part is divisiable by this. |
8
|
|
|
will be passed directly into conv2d operator |
{}
|
Returns: tensor
Source code in deeplabcut/pose_estimation_tensorflow/nnets/conv_blocks.py
split_separable_conv2d
split_separable_conv2d(
input_tensor,
num_outputs,
scope=None,
normalizer_fn=None,
stride=1,
rate=1,
endpoints=None,
use_explicit_padding=False,
)
Separable mobilenet V1 style convolution.
Depthwise convolution, with default non-linearity, followed by 1x1 depthwise convolution. This is similar to slim.separable_conv2d, but differs in that it applies batch normalization and non-linearity to depthwise. This matches the basic building of Mobilenet Paper (https://arxiv.org/abs/1704.04861)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
input |
required | |
|
number of outputs |
required | |
|
optional name of the scope. Note if provided it will use |
None
|
|
|
which normalizer function to use for depthwise/pointwise |
None
|
|
|
stride |
1
|
|
|
output rate (also known as dilation rate) |
1
|
|
|
optional, if provided, will export additional tensors to it. |
None
|
|
|
Use 'VALID' padding for convolutions, but prepad inputs so that the output dimensions are the same as if 'SAME' padding were used. |
False
|
Returns:
| Type | Description |
|---|---|
|
output tesnor |