PANHead¶
- class mmocr.models.textdet.PANHead(in_channels, hidden_dim, out_channel, module_loss={'type': 'PANModuleLoss'}, postprocessor={'text_repr_type': 'poly', 'type': 'PANPostprocessor'}, init_cfg=[{'type': 'Normal', 'mean': 0, 'std': 0.01, 'layer': 'Conv2d'}, {'type': 'Constant', 'val': 1, 'bias': 0, 'layer': 'BN'}])[源代码]¶
The class for PANet head.
- 参数
in_channels (list[int]) – A list of 4 numbers of input channels.
hidden_dim (int) – The hidden dimension of the first convolutional layer.
out_channel (int) – Number of output channels.
module_loss (dict) – Configuration dictionary for loss type. Defaults to dict(type=’PANModuleLoss’)
postprocessor (dict) – Config of postprocessor for PANet. Defaults to dict(type=’PANPostprocessor’, text_repr_type=’poly’).
Initialization configs. Defaults to [dict(type=’Normal’, mean=0, std=0.01, layer=’Conv2d’),
dict(type=’Constant’, val=1, bias=0, layer=’BN’)]
- 返回类型
- forward(inputs, data_samples=None)[源代码]¶
PAN head forward. :param inputs: Each tensor has the shape of
\((N, C_i, W, H)\), where \(\sum_iC_i=C_{in}\) and \(C_{in}\) is
input_channels
.- 参数
data_samples (list[TextDetDataSample], optional) – A list of data samples. Defaults to None.
inputs (list[Tensor] | Tensor) –
- 返回
A tensor of shape \((N, C_{out}, W, H)\) where \(C_{out}\) is
output_channels
.- 返回类型
Tensor