HRNet的学习笔记

1 HRNet论文学习

论文:《Deep High-Resolution Representation Learning for Visual Recognition》
arxiv链接:https://arxiv.org/abs/1908.07919

2 开源代码

来自于stefanopini开源项目:simple-HRNet
感谢stefanopini的分享!

3 代码学习笔记

HRNet类,即HRNet模型的模块类,

  • c:表示输出通道数;
  • nof_joints:表示关节预测的特征维数,默认为17;
  • bn_momentum:表示bn的动量大小;

3.1 前向推理——forward()函数

def forward(self, x):
	# conv1进行2倍下采样
    x = self.conv1(x)
    x = self.bn1(x)
    x = self.relu(x)
    # conv2:3x3卷积,2倍下采样
    x = self.conv2(x)
    x = self.bn2(x)
    x = self.relu(x)
	
	# 基于Bottleneck的特征提取层,不过没有进行下采样,4s特征图
    x = self.layer1(x)
    x = [trans(x) for trans in self.transition1]  # Since now, x is a list (# == nof branches)

    x = self.stage2(x)
    # x = [trans(x[-1]) for trans in self.transition2]    # New branch derives from the "upper" branch only
    x = [
        self.transition2[0](x[0]),
        self.transition2[1](x[1]),
        self.transition2[2](x[-1])
    ]  # New branch derives from the "upper" branch only

    x = self.stage3(x)
    # x = [trans(x) for trans in self.transition3]    # New branch derives from the "upper" branch only
    x = [
        self.transition3[0](x[0]),
        self.transition3[1](x[1]),
        self.transition3[2](x[2]),
        self.transition3[3](x[-1])
    ]  # New branch derives from the "upper" branch only

    x = self.stage4(x)

    x = self.final_layer(x[0])

    return x

你可能感兴趣的:(《南溪的目标检测学习笔记》,目标检测,开源计划,HRNet)