Shortcuts

mmagic.models.editors.inst_colorization.weight_layer

Module Contents

Classes

WeightLayer

Weight layer of the fusion_net. A small neural network with three

Functions

get_norm_layer([norm_type])

Gets the normalization layer.

mmagic.models.editors.inst_colorization.weight_layer.get_norm_layer(norm_type='instance')[源代码]

Gets the normalization layer.

参数

norm_type (str) – Type of the normalization layer.

返回

normalization layer. Default: instance

返回类型

norm_layer (BatchNorm2d or InstanceNorm2d or None)

class mmagic.models.editors.inst_colorization.weight_layer.WeightLayer(input_ch, inner_ch=16)[源代码]

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.

参数
  • 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)[源代码]

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.

参数
  • feauture_maps (tensor) – Feature map

  • info_array (tensor) – The bounding box

返回

Feature maps after resize and padding

返回类型

feauture_maps (tensor)

forward(instance_feature, bg_feature, box_info)[源代码]

Forward function.

参数
  • 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

返回

Fused feature

返回类型

out (tensor)

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.