piscis.networks.fpn#
Attributes#
Classes#
Convolutional block with batch norm, activation, and style transfer. |
|
Upsampling convolutional block. |
|
Style transfer module. |
|
Decoder module. |
|
Feature pyramid network. |
Module Contents#
- piscis.networks.fpn.ModuleDef#
- piscis.networks.fpn.BatchActConv#
- piscis.networks.fpn.BatchConv#
- class piscis.networks.fpn.BatchConvStyle(in_channels: int, out_channels: int, style_channels: int, kernel_size: int | Sequence[int], conv: ModuleDef, dense: ModuleDef, bn: ModuleDef, act: ModuleDef)#
Bases:
torch.nn.ModuleConvolutional block with batch norm, activation, and style transfer.
- Parameters:
- in_channelsint
Number of input channels.
- out_channelsint
Number of output channels.
- style_channelsint
Number of style channels.
- kernel_sizeUnion[int, Sequence[int]]
Size of the convolutional kernel.
- convModuleDef
Convolution module.
- denseModuleDef
Dense module.
- bnModuleDef
Batch norm module.
- actModuleDef
Activation function.
- conv#
- dense#
- forward(style: torch.Tensor | None, x: torch.Tensor, y: torch.Tensor | None = None) torch.Tensor#
- class piscis.networks.fpn.UpConv(in_channels: int, out_channels: int, style_channels: int, kernel_size: int | Sequence[int], conv: ModuleDef, dense: ModuleDef, bn: ModuleDef, act: ModuleDef)#
Bases:
torch.nn.ModuleUpsampling convolutional block.
- Parameters:
- in_channelsint
Number of input channels.
- out_channelsint
Number of output channels.
- style_channelsint
Number of style channels.
- kernel_sizeUnion[int, Sequence[int]]
Size of the convolutional kernel.
- convModuleDef
Convolution module.
- denseModuleDef
Dense module.
- bnModuleDef
Batch norm module.
- actModuleDef
Activation function.
- proj#
- conv#
- convs_0#
- convs_1#
- convs_2#
- forward(x: torch.Tensor, y: torch.Tensor | None, style: torch.Tensor | None) torch.Tensor#
- class piscis.networks.fpn.MakeStyle(*args, **kwargs)#
Bases:
torch.nn.ModuleStyle transfer module.
- forward(x: torch.Tensor) torch.Tensor#
- class piscis.networks.fpn.Decoder(stage_sizes: Sequence[int], kernel_size: int | Sequence[int], conv: ModuleDef, dense: ModuleDef, bn: ModuleDef, act: ModuleDef)#
Bases:
torch.nn.ModuleDecoder module.
- Parameters:
- stage_sizesSequence[int]
Number of channels at each stage.
- kernel_sizeUnion[int, Sequence[int]]
Size of the convolutional kernel.
- convModuleDef
Convolution module.
- denseModuleDef
Dense module.
- bnModuleDef
Batch norm module.
- actModuleDef
Activation function.
- stage_sizes#
- upsample#
- up_blocks#
- resize_up_blocks#
- out_channels#
- forward(style: torch.Tensor, xd: Sequence[torch.Tensor]) torch.Tensor#
- class piscis.networks.fpn.FPN(encoder: ModuleDef, encoder_levels: Sequence[int], in_channels: int, out_channels: int, kernel_size: int | Sequence[int] = 3, style: bool = True, bn_momentum: float = 0.1, bn_epsilon: float = 1e-05, conv: ModuleDef = nn.Conv2d, dense: ModuleDef = nn.Linear, bn: ModuleDef = nn.BatchNorm2d, act: ModuleDef = nn.SiLU)#
Bases:
torch.nn.ModuleFeature pyramid network.
- Parameters:
- encoderModuleDef
Encoder module.
- encoder_levelsSequence[int]
Encoder levels to use for the feature pyramid.
- in_channelsint
Number of input channels.
- out_channelsint
Number of output channels.
- kernel_sizeUnion[int, Sequence[int]], optional
Size of the convolutional kernel. Default is s3.
- stylebool, optional
Whether to use style transfer. Default is True.
- bn_momentumfloat, optional
Momentum parameter for batch norm layers. Default is 0.1.
- bn_epsilonfloat, optional
Epsilon parameter for batch norm layers. Default is 1e-5.
- convModuleDef, optional
Convolution module. Default is nn.Conv2d.
- denseModuleDef, optional
Dense module. Default is nn.Linear.
- bnModuleDef, optional
Batch norm module. Default is nn.BatchNorm2d.
- actModuleDef, optional
Activation function. Default is nn.SiLU.
- encoder#
- encoder_levels#
- style = True#
- decoder#
- output#
- forward(x: torch.Tensor) Tuple[torch.Tensor, torch.Tensor | None]#