bob.ip.binseg.models.lwnet¶
Little W-Net
Code was originally developed by Adrian Galdran (https://github.com/agaldran/lwnet), loosely inspired on https://github.com/jvanvugt/pytorch-unet
It is based on two simple U-Nets with 3 layers concatenated to each other. The first U-Net produces a segmentation map that is used by the second to better guide segmentation.
Reference: [GALDRAN-2020]
Functions
|
Builds Little U-Net segmentation network (uninitialized) |
|
Builds Little W-Net segmentation network (uninitialized) |
Classes
|
|
|
|
|
Little U-Net model |
|
Little W-Net model, concatenating two Little U-Net models |
|
|
|
-
class
bob.ip.binseg.models.lwnet.
ConvBlock
(in_c, out_c, k_sz=3, shortcut=False, pool=True)[source]¶ Bases:
torch.nn.modules.module.Module
-
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.lwnet.
UpsampleBlock
(in_c, out_c, up_mode='transp_conv')[source]¶ Bases:
torch.nn.modules.module.Module
-
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.lwnet.
ConvBridgeBlock
(channels, k_sz=3)[source]¶ Bases:
torch.nn.modules.module.Module
-
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.lwnet.
UpConvBlock
(in_c, out_c, k_sz=3, up_mode='up_conv', conv_bridge=False, shortcut=False)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, skip)[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.lwnet.
LittleUNet
(in_c, n_classes, layers, k_sz=3, up_mode='transp_conv', conv_bridge=True, shortcut=True)[source]¶ Bases:
torch.nn.modules.module.Module
Little U-Net model
-
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.lwnet.
LittleWNet
(n_classes=1, in_c=3, layers=8, 16, 32, conv_bridge=True, shortcut=True, mode='train')[source]¶ Bases:
torch.nn.modules.module.Module
Little W-Net model, concatenating two Little U-Net models
-
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.
-
-
bob.ip.binseg.models.lwnet.
lunet
(in_c=3, n_classes=1)[source]¶ Builds Little U-Net segmentation network (uninitialized)
- Parameters
- Returns
module – Network model for Little U-Net
- Return type