Skip to content

Commit

Permalink
rename rtm_head to rtmcc_head
Browse files Browse the repository at this point in the history
  • Loading branch information
Tau-J committed Mar 9, 2023
1 parent afefe40 commit f8b9a14
Show file tree
Hide file tree
Showing 39 changed files with 89 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-s_udp-aic-coco_210e-256x192-92f5a029_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=512,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-s_udp-aic-coco_210e-256x192-92f5a029_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=512,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-tiny_udp-aic-coco_210e-256x192-cbed682d_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=384,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-tiny_udp-aic-coco_210e-256x192-cbed682d_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=384,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=14,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=16,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=68,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=98,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=21,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=133,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=133,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=133,
input_size=codec['input_size'],
Expand Down
6 changes: 3 additions & 3 deletions mmpose/models/heads/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .base_head import BaseHead
from .coord_cls_heads import RTMCCHead, SimCCHead
from .heatmap_heads import (AssociativeEmbeddingHead, CIDHead, CPMHead,
HeatmapHead, MSPNHead, RTMHead, SimCCHead,
ViPNASHead)
HeatmapHead, MSPNHead, ViPNASHead)
from .hybrid_heads import DEKRHead
from .regression_heads import (DSNTHead, IntegralRegressionHead,
RegressionHead, RLEHead)

__all__ = [
'BaseHead', 'HeatmapHead', 'CPMHead', 'MSPNHead', 'ViPNASHead',
'RegressionHead', 'IntegralRegressionHead', 'SimCCHead', 'RLEHead',
'DSNTHead', 'AssociativeEmbeddingHead', 'DEKRHead', 'CIDHead', 'RTMHead'
'DSNTHead', 'AssociativeEmbeddingHead', 'DEKRHead', 'CIDHead', 'RTMCCHead'
]
5 changes: 5 additions & 0 deletions mmpose/models/heads/coord_cls_heads/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .rtmcc_head import RTMCCHead
from .simcc_head import SimCCHead

__all__ = ['SimCCHead', 'RTMCCHead']
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
from torch import Tensor, nn

from mmpose.evaluation.functional import simcc_pck_accuracy
from mmpose.models.utils.rtmcc_block import RTMCCBlock, ScaleNorm
from mmpose.models.utils.tta import flip_vectors
from mmpose.registry import KEYPOINT_CODECS, MODELS
from mmpose.utils.tensor_utils import to_numpy
from mmpose.utils.typing import (ConfigType, InstanceList, OptConfigType,
OptSampleList)
from ...utils.rtmpose_block import RTMBlock, ScaleNorm
from ..base_head import BaseHead

OptIntSeq = Optional[Sequence[int]]


@MODELS.register_module()
class RTMHead(BaseHead):
class RTMCCHead(BaseHead):
"""Top-down head introduced in RTMPose (2023). The head is composed of a
large-kernel convolutional layer, a fully-connected layer and a Gated
Attention Unit to generate 1d representation from low-resolution feature
Expand Down Expand Up @@ -136,7 +136,7 @@ def __init__(
W = int(self.input_size[0] * self.simcc_split_ratio)
H = int(self.input_size[1] * self.simcc_split_ratio)

self.gau = RTMBlock(
self.gau = RTMCCBlock(
self.out_channels,
gau_cfg['hidden_dims'],
gau_cfg['hidden_dims'],
Expand Down
6 changes: 2 additions & 4 deletions mmpose/models/heads/heatmap_heads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
from .cpm_head import CPMHead
from .heatmap_head import HeatmapHead
from .mspn_head import MSPNHead
from .rtm_head import RTMHead
from .simcc_head import SimCCHead
from .vipnas_head import ViPNASHead

__all__ = [
'HeatmapHead', 'CPMHead', 'MSPNHead', 'ViPNASHead', 'SimCCHead',
'AssociativeEmbeddingHead', 'CIDHead', 'RTMHead'
'HeatmapHead', 'CPMHead', 'MSPNHead', 'ViPNASHead',
'AssociativeEmbeddingHead', 'CIDHead'
]
4 changes: 2 additions & 2 deletions mmpose/models/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .ckpt_convert import pvt_convert
from .rtmpose_block import RTMBlock, rope
from .rtmcc_block import RTMCCBlock, rope
from .transformer import PatchEmbed, nchw_to_nlc, nlc_to_nchw

__all__ = [
'PatchEmbed', 'nchw_to_nlc', 'nlc_to_nchw', 'pvt_convert', 'RTMBlock',
'PatchEmbed', 'nchw_to_nlc', 'nlc_to_nchw', 'pvt_convert', 'RTMCCBlock',
'rope'
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.bricks import DropPath
from mmengine.utils import digit_version
from mmengine.utils.dl_utils import TORCH_VERSION


def rope(x, dim):
Expand Down Expand Up @@ -107,7 +109,7 @@ def forward(self, x):
return x / norm.clamp(min=self.eps) * self.g


class RTMBlock(nn.Module):
class RTMCCBlock(nn.Module):
"""Gated Attention Unit (GAU) in RTMBlock.
Args:
Expand Down Expand Up @@ -162,7 +164,7 @@ def __init__(self,
use_rel_bias=True,
pos_enc=False):

super(RTMBlock, self).__init__()
super(RTMCCBlock, self).__init__()
self.s = s
self.num_token = num_token
self.use_rel_bias = use_rel_bias
Expand Down Expand Up @@ -197,7 +199,7 @@ def __init__(self,
nn.init.xavier_uniform_(self.uv.weight)

if act_fn == 'SiLU':
assert torch.__version__.split('.')[1] >= '7', \
assert digit_version(TORCH_VERSION) >= digit_version('1.7.0'), \
'SiLU activation requires PyTorch version >= 1.7'

self.act_fn = nn.SiLU(True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-s_udp-aic-coco_210e-256x192-92f5a029_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=512,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-tiny_udp-aic-coco_210e-256x192-cbed682d_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=384,
out_channels=17,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=68,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=21,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=133,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=1024,
out_channels=133,
input_size=codec['input_size'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth' # noqa
)),
head=dict(
type='RTMHead',
type='RTMCCHead',
in_channels=768,
out_channels=133,
input_size=codec['input_size'],
Expand Down
Loading

0 comments on commit f8b9a14

Please sign in to comment.