You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm checking model zoo in mmpose.
I checked the simcc paper, and the results were Simcc HRNet model was better than Simcc + ResNet model.
I go mmpose library to use Simcc + HRNet model, but in mmpose/configs/body_2d_keypoint/simcc/ there are only ResNet and mobilenet, vipnas.
So, I tried to make custom config refer these config.
mmpose/configs/body_2d_keypoint/simcc/coco/simcc_res50_8xb64-210e_coco-256x192.py
mmpose/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_hrnet-w32_8xb64-210e_coco-256x192.py
So, I made config file like this.
_base_ = ['../../../_base_/default_runtime.py']
# runtime
train_cfg = dict(max_epochs=300, val_interval=10)
# optimizer
optim_wrapper = dict(optimizer=dict(
type='Adam',
lr=1e-3,
))
# learning policy
param_scheduler = [
dict(
type='LinearLR', begin=0, end=500, start_factor=0.001,
by_epoch=False), # warm-up
dict(
type='MultiStepLR',
begin=0,
end=300, #edit from 210
milestones=[170, 200],
gamma=0.1,
by_epoch=True)
]
# automatically scaling LR based on the actual training batch size
auto_scale_lr = dict(base_batch_size=512)
# hooks
default_hooks = dict(checkpoint=dict(save_best='coco/AP', rule='greater'))
# codec settings
codec = dict(
type='SimCCLabel',
input_size=(192, 256),
sigma=6.0,
simcc_split_ratio=2.0
)
# model settings
model = dict(
type='TopdownPoseEstimator',
# data preprocessor
data_preprocessor=dict(
type='PoseDataPreprocessor',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
bgr_to_rgb=True),
# backbone
backbone=dict(
type='HRNet',
in_channels=3,
extra=dict(
stage1=dict(
num_modules=1,
num_branches=1,
block='BOTTLENECK',
num_blocks=(4, ),
num_channels=(64, )),
stage2=dict(
num_modules=1,
num_branches=2,
block='BASIC',
num_blocks=(4, 4),
num_channels=(32, 64)),
stage3=dict(
num_modules=4,
num_branches=3,
block='BASIC',
num_blocks=(4, 4, 4),
num_channels=(32, 64, 128)),
stage4=dict(
num_modules=3,
num_branches=4,
block='BASIC',
num_blocks=(4, 4, 4, 4),
num_channels=(32, 64, 128, 256))),
# Using pretrained model to get good performance with small dataset
init_cfg=dict(
type='Pretrained',
# # If you want to load a checkpoint to your backbone, you should specify the prefix
# prefix='backbone.',
# checkpoint='/data/home/seondeok/Project/acupoint/mmpose/configs/body_2d_keypoint/pretrain/topdown_heatmap/td-hm_hrnet-w32_dark-8xb64-210e_coco-256x192-0e00bf12_20220914.pth'
),
),
head=dict(
type='SimCCHead',
in_channels=32,
out_channels=5, # edit
input_size=codec['input_size'],
in_featuremap_size=tuple([s // 32 for s in codec['input_size']]),
simcc_split_ratio=codec['simcc_split_ratio'],
loss=dict(type='KLDiscretLoss', use_target_weight=True),
decoder=codec),
test_cfg=dict(flip_test=True))
# base dataset settings
# choose type
"""
1. CocoArm 5
2. CocoLeg 13
3. CocoLegFront 7
4. CocoLegInside 2
5. CocoLegOutside 4
"""
# base dataset settings
dataset_type = 'CocoArm'
data_mode = 'topdown'
data_root = '/data/home/seondeok/Project/acupoint/coco_dataset/arm/2024_Paper_dataset/Train760/'
test_root = '/data/home/seondeok/Project/acupoint/coco_dataset/arm/2024_Paper_dataset/Test180/'
annotation_root = '/data/home/seondeok/Project/acupoint/coco_dataset/arm/2024_Paper_dataset/Train760.json'
annotation_root_val = '/data/home/seondeok/Project/acupoint/coco_dataset/arm/2024_Paper_dataset/Test180.json'
# pipelines
train_pipeline = [
dict(type='LoadImage'),
dict(type='GetBBoxCenterScale'),
dict(type='RandomFlip', direction='horizontal'),
dict(type='RandomHalfBody'),
dict(type='RandomBBoxTransform'),
dict(type='TopdownAffine', input_size=codec['input_size']),
dict(type='GenerateTarget', encoder=codec),
dict(type='PackPoseInputs')
]
val_pipeline = [
dict(type='LoadImage'),
dict(type='GetBBoxCenterScale'),
dict(type='TopdownAffine', input_size=codec['input_size']),
dict(type='PackPoseInputs')
]
# data loaders
train_dataloader = dict(
batch_size=64,
num_workers=2,
persistent_workers=True,
sampler=dict(type='DefaultSampler', shuffle=True),
dataset=dict(
type=dataset_type,
data_root=data_root,
data_mode=data_mode,
ann_file=annotation_root,
data_prefix=dict(img=data_root),
pipeline=train_pipeline,
))
val_dataloader = dict(
batch_size=32,
num_workers=2,
persistent_workers=True,
drop_last=False,
sampler=dict(type='DefaultSampler', shuffle=False, round_up=False),
dataset=dict(
type=dataset_type,
data_root=test_root,
data_mode=data_mode,
ann_file=annotation_root_val,
# bbox_file='data/coco/person_detection_results/'
# 'COCO_val2017_detections_AP_H_56_person.json',
data_prefix=dict(img=test_root),
test_mode=True,
pipeline=val_pipeline,
))
test_dataloader = val_dataloader
# evaluators
val_evaluator = dict(
type='CocoMetric',
ann_file=annotation_root_val)
test_evaluator = val_evaluator
I copied codec setting, head from simcc/ResNet config.
And I run train.py with this config, but the error accur.
Traceback (most recent call last):
File "tools/train.py", line 161, in <module>
main()
File "tools/train.py", line 157, in main
runner.train()
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1745, in train
model = self.train_loop.run() # type: ignore
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/loops.py", line 96, in run
self.run_epoch()
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/loops.py", line 112, in run_epoch
self.run_iter(idx, data_batch)
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/loops.py", line 128, in run_iter
outputs = self.runner.model.train_step(
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/model/base_model/base_model.py", line 114, in train_step
losses = self._run_forward(data, mode='loss') # type: ignore
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/model/base_model/base_model.py", line 340, in _run_forward
results = self(**data, mode=mode)
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/data/home/seondeok/Project/acupoint/mmpose/mmpose/models/pose_estimators/base.py", line 136, in forward
return self.loss(inputs, data_samples)
File "/data/home/seondeok/Project/acupoint/mmpose/mmpose/models/pose_estimators/topdown.py", line 74, in loss
self.head.loss(feats, data_samples, train_cfg=self.train_cfg))
File "/data/home/seondeok/Project/acupoint/mmpose/mmpose/models/heads/coord_cls_heads/simcc_head.py", line 323, in loss
pred_x, pred_y = self.forward(feats)
File "/data/home/seondeok/Project/acupoint/mmpose/mmpose/models/heads/coord_cls_heads/simcc_head.py", line 223, in forward
pred_x = self.mlp_head_x(x)
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/data/home/seondeok/.conda/envs/openmmlab/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (160x196608 and 3072x384)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I'm checking model zoo in mmpose.
![Screenshot from 2024-02-18 17-25-56](https://private-user-images.githubusercontent.com/118324988/305696168-4d644841-ddf3-411d-939a-46e4935ba0cc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzNDI2NTIsIm5iZiI6MTcxODM0MjM1MiwicGF0aCI6Ii8xMTgzMjQ5ODgvMzA1Njk2MTY4LTRkNjQ0ODQxLWRkZjMtNDExZC05MzlhLTQ2ZTQ5MzViYTBjYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxNFQwNTE5MTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00MDUwZTMzYzI4NDk3NTE5OGExZWI0OTVhNzNiZTkwN2E5MWM0ZjI4ZGNjYTQzZDFkOTRkZThkMDgzZjExNmQ4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.eFJhEECsXANsotDJxseapX_kr_S0N_ZF5JqxstST9xo)
I checked the simcc paper, and the results were Simcc HRNet model was better than Simcc + ResNet model.
I go mmpose library to use Simcc + HRNet model, but in mmpose/configs/body_2d_keypoint/simcc/ there are only ResNet and mobilenet, vipnas.
So, I tried to make custom config refer these config.
mmpose/configs/body_2d_keypoint/simcc/coco/simcc_res50_8xb64-210e_coco-256x192.py
mmpose/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_hrnet-w32_8xb64-210e_coco-256x192.py
So, I made config file like this.
I copied codec setting, head from simcc/ResNet config.
And I run train.py with this config, but the error accur.
Is there any idea to solve this problem?
Beta Was this translation helpful? Give feedback.
All reactions