bob.ip.binseg.models.make_layers¶
Functions
|
|
|
|
|
|
|
|
Classes
|
|
|
|
|
Combines Conv2d, ConvTransposed2d and Cropping. |
- bob.ip.binseg.models.make_layers.conv_with_kaiming_uniform(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1)[source]¶
- bob.ip.binseg.models.make_layers.convtrans_with_kaiming_uniform(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1)[source]¶
- class bob.ip.binseg.models.make_layers.UpsampleCropBlock(in_channels, out_channels, up_kernel_size, up_stride, up_padding, pixelshuffle=False)[source]¶
Bases:
torch.nn.modules.module.Module
Combines Conv2d, ConvTransposed2d and Cropping. Simulates the caffe2 crop layer in the forward function.
Used for DRIU and HED.
- Parameters
- bob.ip.binseg.models.make_layers.icnr(x, scale=2, init=<function kaiming_normal_>)[source]¶
https://docs.fast.ai/layers.html#PixelShuffle_ICNR
ICNR init of
x
, withscale
andinit
function.
- class bob.ip.binseg.models.make_layers.PixelShuffle_ICNR(ni: int, nf: Optional[int] = None, scale: int = 2)[source]¶
Bases:
torch.nn.modules.module.Module
https://docs.fast.ai/layers.html#PixelShuffle_ICNR
Upsample by
scale
fromni
filters tonf
(defaultni
), usingtorch.nn.PixelShuffle
,icnr
init, andweight_norm
.- forward(x)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class bob.ip.binseg.models.make_layers.UnetBlock(up_in_c, x_in_c, pixel_shuffle=False, middle_block=False)[source]¶
Bases:
torch.nn.modules.module.Module
- forward(up_in, x_in)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.