mmagic.models.editors.inst_colorization.weight_layer
¶
Module Contents¶
Classes¶
Weight layer of the fusion_net. A small neural network with three |
Functions¶
|
Gets the normalization layer. |
- mmagic.models.editors.inst_colorization.weight_layer.get_norm_layer(norm_type='instance')[source]¶
Gets the normalization layer.
- Parameters
norm_type (str) – Type of the normalization layer.
- Returns
normalization layer. Default: instance
- Return type
norm_layer (BatchNorm2d or InstanceNorm2d or None)
- class mmagic.models.editors.inst_colorization.weight_layer.WeightLayer(input_ch, inner_ch=16)[source]¶
Bases:
mmengine.model.BaseModule
Weight layer of the fusion_net. A small neural network with three convolutional layers to predict full-image weight map and perinstance weight map.
- Parameters
input_ch (int) – Number of channels in the input image.
inner_ch (int) – Number of channels produced by the convolution. Default: True
- resize_and_pad(feauture_maps, info_array)[source]¶
Resize the instance feature as well as the weight map to match the size of full-image and do zero padding on both of them.
- Parameters
feauture_maps (tensor) – Feature map
info_array (tensor) – The bounding box
- Returns
Feature maps after resize and padding
- Return type
feauture_maps (tensor)
- forward(instance_feature, bg_feature, box_info)[source]¶
Forward function.
- Parameters
instance_feature (tensor) – Instance feature obtained from the colorization_net
bg_feature (tensor) – full-image feature
box_info (tensor) – The bounding box corresponding to the instance
- Returns
Fused feature
- Return type
out (tensor)