File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed
mmdeploy/codebase/mmpose/deploy
tests/test_codebase/test_mmpose Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,6 @@ def create_input(self,
135135 Returns:
136136 tuple: (data, img), meta information for the input image and input.
137137 """
138- from mmpose .apis .inference import _box2cs
139138 from mmpose .datasets .dataset_info import DatasetInfo
140139 from mmpose .datasets .pipelines import Compose
141140
@@ -160,17 +159,12 @@ def create_input(self,
160159 image_size = input_shape
161160 else :
162161 image_size = np .array (cfg .data_cfg ['image_size' ])
163- for bbox in bboxes :
164- center , scale = _box2cs (cfg , bbox )
165162
163+ for bbox in bboxes :
166164 # prepare data
167165 data = {
168166 'img' :
169167 imgs ,
170- 'center' :
171- center ,
172- 'scale' :
173- scale ,
174168 'bbox_score' :
175169 bbox [4 ] if len (bbox ) == 5 else 1 ,
176170 'bbox_id' :
@@ -190,6 +184,17 @@ def create_input(self,
190184 }
191185 }
192186
187+ # for compatibility of mmpose
188+ try :
189+ # for mmpose<=v0.25.1
190+ from mmpose .apis .inference import _box2cs
191+ center , scale = _box2cs (cfg , bbox )
192+ data ['center' ] = center
193+ data ['scale' ] = scale
194+ except ImportError :
195+ # for mmpose>=v0.26.0
196+ data ['bbox' ] = bbox
197+
193198 data = test_pipeline (data )
194199 batch_data .append (data )
195200
Original file line number Diff line number Diff line change 11# Copyright (c) OpenMMLab. All rights reserved.
22# model settings
3+ import mmpose
4+ from packaging import version
5+
36channel_cfg = dict (
47 num_output_channels = 17 ,
58 dataset_joints = 17 ,
4750
4851test_pipeline = [
4952 dict (type = 'LoadImageFromFile' ),
53+ # dict(type='TopDownGetBboxCenterScale'),
5054 dict (type = 'TopDownAffine' ),
5155 dict (type = 'ToTensor' ),
5256 dict (
6165 'flip_pairs'
6266 ]),
6367]
68+ # compatible with mmpose >=v0.26.0
69+ if version .parse (mmpose .__version__ ) >= version .parse ('0.26.0' ):
70+ test_pipeline .insert (1 , dict (type = 'TopDownGetBboxCenterScale' ))
6471
6572dataset_info = dict (
6673 dataset_name = 'coco' ,
Original file line number Diff line number Diff line change 4646
4747
4848def test_create_input ():
49- model_cfg = load_config (model_cfg_path )[0 ]
5049 deploy_cfg = mmcv .Config (
5150 dict (
5251 backend_config = dict (type = Backend .ONNXRUNTIME .value ),
You can’t perform that action at this time.
0 commit comments