mmpose.apis.webcam.nodes.PoseTrackerNode¶
- class mmpose.apis.webcam.nodes.PoseTrackerNode(name: str, det_model_config: str, det_model_checkpoint: str, pose_model_config: str, pose_model_checkpoint: str, input_buffer: str, output_buffer: Union[str, List[str]], enable_key: Optional[Union[str, int]] = None, enable: bool = True, device: str = 'cuda:0', det_interval: int = 1, class_ids: Optional[List] = None, labels: Optional[List] = None, bbox_thr: float = 0.5, kpt2bbox_cfg: Optional[dict] = None, smooth: bool = False, smooth_filter_cfg: str = 'configs/_base_/filters/one_euro.py')[源代码]¶
Perform object detection and top-down pose estimation. Only detect objects every few frames, and use the pose estimation results to track the object at interval.
Note that MMDetection is required for this node. Please refer to MMDetection documentation for the installation guide.
- 参数
name (str) – The node name (also thread name)
det_model_cfg (str) – The config file of the detection model
det_model_checkpoint (str) – The checkpoint file of the detection model
pose_model_cfg (str) – The config file of the pose estimation model
pose_model_checkpoint (str) – The checkpoint file of the pose estimation model
input_buffer (str) – The name of the input buffer
output_buffer (str|list) – The name(s) of the output buffer(s)
enable_key (str|int, optional) – Set a hot-key to toggle enable/disable of the node. If an int value is given, it will be treated as an ascii code of a key. Please note: (1) If
enable_keyis set, thebypass()method need to be overridden to define the node behavior when disabled; (2) Some hot-keys are reserved for particular use. For example: ‘q’, ‘Q’ and 27 are used for exiting. Default:Noneenable (bool) – Default enable/disable status. Default:
Truedevice (str) – Specify the device to hold model weights and inference the model. Default:
'cuda:0'det_interval (int) – Set the detection interval in frames. For example,
det_interval==10means inference the detection model every 10 frames. Default: 1class_ids (list[int], optional) – Specify the object category indices to apply pose estimation. If both
class_idsandlabelsare given,labelswill be ignored. If neither is given, pose estimation will be applied for all objects. Default:Nonelabels (list[str], optional) – Specify the object category names to apply pose estimation. See also
class_ids. Default:Nonebbox_thr (float) – Set a threshold to filter out objects with low bbox scores. Default: 0.5
kpt2bbox_cfg (dict, optional) – Configure the process to get object bbox from its keypoints during tracking. Specifically, the bbox is obtained from the minimal outer rectangle of the keyponits with following configurable arguments:
'scale', the coefficient to expand the keypoint outer rectangle, defaults to 1.5;'kpt_thr': a threshold to filter out low-scored keypoint, defaults to 0.3. Seeself.default_kpt2bbox_cfgfor detailssmooth (bool) – If set to
True, aSmootherwill be used to refine the pose estimation result. Default:Truesmooth_filter_cfg (str) – The filter config path to build the smoother. Only valid when
smooth==True. Default to use an OneEuro filter
- Example::
>>> cfg = dict( ... type='PoseTrackerNode', ... name='pose tracker', ... det_model_config='demo/mmdetection_cfg/' ... 'ssdlite_mobilenetv2_scratch_600e_coco.py', ... det_model_checkpoint='https://download.openmmlab.com' ... '/mmdetection/v2.0/ssd/' ... 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_' ... 'scratch_600e_coco_20210629_110627-974d9307.pth', ... pose_model_config='configs/wholebody/2d_kpt_sview_rgb_img/' ... 'topdown_heatmap/coco-wholebody/' ... 'vipnas_mbv3_coco_wholebody_256x192_dark.py', ... pose_model_checkpoint='https://download.openmmlab.com/mmpose/' ... 'top_down/vipnas/vipnas_mbv3_coco_wholebody_256x192_dark' ... '-e2158108_20211205.pth', ... det_interval=10, ... labels=['person'], ... smooth=True, ... device='cuda:0', ... # `_input_` is an executor-reserved buffer ... input_buffer='_input_', ... output_buffer='human_pose')
>>> from mmpose.apis.webcam.nodes import NODES >>> node = NODES.build(cfg)