mmpose.apis.webcam.nodes.DetectorNode¶
- class mmpose.apis.webcam.nodes.DetectorNode(name: str, model_config: str, 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', bbox_thr: float = 0.5, multi_input: bool = False)[源代码]¶
Detect objects from the frame image using MMDetection model.
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)
model_cfg (str) – The model config file
model_checkpoint (str) – The model checkpoint file
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_key
is 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:None
enable (bool) – Default enable/disable status. Default:
True
device (str) – Specify the device to hold model weights and inference the model. Default:
'cuda:0'
bbox_thr (float) – Set a threshold to filter out objects with low bbox scores. Default: 0.5
multi_input (bool) – Whether load all frames in input buffer. If True, all frames in buffer will be loaded and stacked. The latest frame is used to detect objects of interest. Default: False
- Example::
>>> cfg = dict( ... type='DetectorNode', ... name='detector', ... model_config='demo/mmdetection_cfg/' ... 'ssdlite_mobilenetv2_scratch_600e_coco.py', ... model_checkpoint='https://download.openmmlab.com' ... '/mmdetection/v2.0/ssd/' ... 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_' ... 'scratch_600e_coco_20210629_110627-974d9307.pth', ... # `_input_` is an executor-reserved buffer ... input_buffer='_input_', ... output_buffer='det_result')
>>> from mmpose.apis.webcam.nodes import NODES >>> node = NODES.build(cfg)