Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Add cfg file for flops and speed test, and fix some typo in related scripts and config file #1028

Merged
merged 1 commit into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 206 additions & 0 deletions .dev_scripts/benchmark/benchmark_cfg_flops_speed.yaml

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions .dev_scripts/benchmark/flops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import mmcv
from mmcv import Config

from mmpose.models import build_posenet
from mmpose.apis.inference import init_pose_model

try:
from mmcv.cnn import get_model_complexity_info
Expand Down Expand Up @@ -68,9 +68,7 @@ def main():
else:
input_shape = (3, image_size, image_size)

model = build_posenet(model_cfg.model)
model = model.cuda()
model.eval()
model = init_pose_model(cfg_file)

if hasattr(model, 'forward_dummy'):
model.forward = model.forward_dummy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext101',
pretrained='mmcls://resnext101_32x4d',
backbone=dict(type='ResNeXt', depth=101),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext101',
pretrained='mmcls://resnext101_32x4d',
backbone=dict(type='ResNeXt', depth=101),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext152',
pretrained='mmcls://resnext152_32x4d',
backbone=dict(type='ResNeXt', depth=152),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext152',
pretrained='mmcls://resnext152_32x4d',
backbone=dict(type='ResNeXt', depth=152),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext50',
pretrained='mmcls://resnext50_32x4d',
backbone=dict(type='ResNeXt', depth=50),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext50',
pretrained='mmcls://resnext50_32x4d',
backbone=dict(type='ResNeXt', depth=50),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext101',
pretrained='mmcls://resnext101_32x4d',
backbone=dict(type='ResNeXt', depth=101),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext152',
pretrained='mmcls://resnext152_32x4d',
backbone=dict(type='ResNeXt', depth=152),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://resnext50',
pretrained='mmcls://resnext50_32x4d',
backbone=dict(type='ResNeXt', depth=50),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
Expand Down
9 changes: 2 additions & 7 deletions tools/analysis/get_flops.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Copyright (c) OpenMMLab. All rights reserved.
import argparse

from mmcv import Config

from mmpose.models import build_posenet
from mmpose.apis.inference import init_pose_model

try:
from mmcv.cnn import get_model_complexity_info
Expand Down Expand Up @@ -35,10 +33,7 @@ def main():
else:
raise ValueError('invalid input shape')

cfg = Config.fromfile(args.config)
model = build_posenet(cfg.model)
model = model.cuda()
model.eval()
model = init_pose_model(args.config)

if hasattr(model, 'forward_dummy'):
model.forward = model.forward_dummy
Expand Down