ObjectAssignerNode¶
- class mmpose.apis.webcam.nodes.ObjectAssignerNode(name: str, frame_buffer: str, object_buffer: str, output_buffer: Union[str, List[str]])[source]¶
Assign the object information to the frame message.
ObjectAssignerNode
enables asynchronous processing of model inference and video I/O, so the video will be captured and displayed smoothly regardless of the model inference speed. Specifically,ObjectAssignerNode
takes messages from both model branch and video I/O branch as its input, indicated as “object message” and “frame message” respectively. When an object message arrives it will update the latest object information; and when a frame message arrives, it will be assigned with the latest object information and output.Specially, if the webcam executor is set to synchrounous mode, the behavior of
ObjectAssignerNode
will be different: When an object message arrives, it will trigger an output of itself; and the frame messages will be ignored.- Parameters
name (str) – The node name (also thread name)
frame_buffer (str) – Buffer name for frame messages
object_buffer (str) – Buffer name for object messages
output_buffer (str) – The name(s) of the output buffer(s)
- Example::
>>> cfg =dict( ... type='ObjectAssignerNode', ... name='object assigner', ... frame_buffer='_frame_', ... # `_frame_` is an executor-reserved buffer ... object_buffer='animal_pose', ... output_buffer='frame')
>>> from mmpose.apis.webcam.nodes import NODES >>> node = NODES.build(cfg)
- process(input_msgs)[source]¶
The method that implements the function of the node.
This method will be invoked when the node is enabled and the input data is ready. All subclasses of Node should override this method.
- Parameters
input_msgs (dict[str,
Message
]) – The input data collected from the buffers. For each item, the key is the input_name of the registered input buffer, and the value is a Message instance fetched from the buffer (or None if the buffer is non-trigger and not ready).- Returns
The output message of the node which will be send to all registered output buffers.
- Return type