basecls.models.hrnet#

HRNet Series

HRNet: “Deep High-Resolution Representation Learning for Visual Recognition”

引用

HRNet/HRNet-Image-Classification

class basecls.models.hrnet.UpsampleNearest(scale_factor)[源代码]#

基类:Module

Nearest upsample block

参数

scale_factor (int) – Upsample scale factor.

forward(x)[源代码]#
class basecls.models.hrnet.HRFusion(channels, multi_scale_output, norm_name, act_name)[源代码]#

基类:Module

HRNet fusion block.

参数
  • channels (List[int]) – Fusion channels.

  • multi_scale_output (bool) – Whether output multi-scale features.

  • norm_name (str) – Normalization layer.

  • act_name (str) – Activation function.

forward(x_list)[源代码]#
class basecls.models.hrnet.HRModule(block_name, num_blocks, in_channels, channels, multi_scale_output, norm_name, act_name)[源代码]#

基类:Module

HRNet module.

参数
  • block_name (str) – Branch block type.

  • num_blocks (List[int]) – Number of blocks.

  • in_channels (List[int]) – Input channels.

  • channels (List[int]) – Output channels.

  • multi_scale_output (bool) – Whether output multi-scale features.

  • norm_name (str) – Normalization layer.

  • act_name (str) – Activation function.

forward(x_list)[源代码]#
class basecls.models.hrnet.HRTrans(in_chs, out_chs, norm_name, act_name)[源代码]#

基类:Module

HRNet transition block.

参数
  • in_chs (List[int]) – Input channels.

  • out_chs (List[int]) – Output channels.

  • norm_name (str) – Normalization layer.

  • act_name (str) – Activation function.

forward(x_list)[源代码]#
class basecls.models.hrnet.HRStage(num_modules, num_blocks, block_name, pre_channels, cur_channels, multi_scale_output, w_fst, norm_name, act_name)[源代码]#

基类:Module

HRNet stage.

参数
  • num_modules (int) – Number of modules.

  • num_blocks (List[int]) – Number of blocks for each module.

  • block_name (str) – Branch block type.

  • pre_channels (List[int]) – Channels of previous stage (an empty list for the first stage).

  • cur_channels (List[int]) – Channels of current stage.

  • multi_scale_output (bool) – Whether output multi-scale features.

  • w_fst (Optional[int]) – Width of stem for the first stage (None for other stages).

  • norm_name (str) – Normalization layer.

  • act_name (str) – Activation function.

forward(x_list)[源代码]#
class basecls.models.hrnet.HRMerge(block_name, pre_channels, channels, norm_name, act_name)[源代码]#

基类:Module

HRNet merge block.

参数
  • block_name (str) – Head block type.

  • pre_channels (List[int]) – Channels of the last stage.

  • channels (List[int]) – Channels of each scale to merge.

  • norm_name (str) – Normalization layer.

  • act_name (str) – Activation function.

forward(x_list)[源代码]#
class basecls.models.hrnet.HRNet(stage_modules, stage_blocks, stage_block_names, stage_channels, w_stem=64, multi_scale_output=True, merge_block_name='bottleneck', merge_channels=[32, 64, 128, 256], norm_name='BN', act_name='relu', head=None, **kwargs)[源代码]#

基类:Module

HRNet model.

参数
  • stage_modules (List[int]) – Number of modules for each stage.

  • stage_blocks (List[List[int]]) – Number of blocks for each module in stages.

  • stage_block_names (List[str]) – Branch block types for each stage.

  • stage_channels (List[List[int]]) – Number of channels for each stage.

  • w_stem (int) – Stem width. Default: 64

  • multi_scale_output (bool) – Whether output multi-scale features. Default: True

  • merge_block_name (str) – Merge block type. Default: "bottleneck"

  • merge_channels (List[int]) – Channels of each scale in merge block. Default: [32, 64, 128, 256]

  • norm_name (str) – Normalization layer. Default: "BN"

  • act_name (str) – Activation function. Default: "relu"

  • head (Optional[Mapping[str, Any]]) – head args. Default: None

forward(x)[源代码]#