| @@ -18,7 +18,7 @@ for event in node: | |||||
| match event["id"]: | match event["id"]: | ||||
| case "image": | case "image": | ||||
| print("[object detection] received image input") | print("[object detection] received image input") | ||||
| frame = np.frombuffer(event["data"], dtype="uint8") | |||||
| frame = event["value"].to_numpy() | |||||
| frame = cv2.imdecode(frame, -1) | frame = cv2.imdecode(frame, -1) | ||||
| frame = frame[:, :, ::-1] # OpenCV image (BGR to RGB) | frame = frame[:, :, ::-1] # OpenCV image (BGR to RGB) | ||||
| results = model(frame) # includes NMS | results = model(frame) # includes NMS | ||||
| @@ -33,15 +33,15 @@ class Plotter: | |||||
| Args: | Args: | ||||
| dora_input["id"] (str): Id of the dora_input declared in the yaml configuration | dora_input["id"] (str): Id of the dora_input declared in the yaml configuration | ||||
| dora_input["data"] (bytes): Bytes message of the dora_input | |||||
| dora_input["value"] (arrow array): message of the dora_input | |||||
| """ | """ | ||||
| if dora_input["id"] == "image": | if dora_input["id"] == "image": | ||||
| frame = np.frombuffer(dora_input["data"], dtype="uint8") | |||||
| frame = dora_input["value"].to_numpy() | |||||
| frame = cv2.imdecode(frame, -1) | frame = cv2.imdecode(frame, -1) | ||||
| self.image = frame | self.image = frame | ||||
| elif dora_input["id"] == "bbox" and len(self.image) != 0: | elif dora_input["id"] == "bbox" and len(self.image) != 0: | ||||
| bboxs = np.frombuffer(dora_input["data"], dtype="float32") | |||||
| bboxs = dora_input["value"].to_numpy() | |||||
| self.bboxs = np.reshape(bboxs, (-1, 6)) | self.bboxs = np.reshape(bboxs, (-1, 6)) | ||||
| for bbox in self.bboxs: | for bbox in self.bboxs: | ||||
| [ | [ | ||||
| @@ -50,7 +50,7 @@ class Operator: | |||||
| Args: | Args: | ||||
| dora_input["id"] (str): Id of the dora_input declared in the yaml configuration | dora_input["id"] (str): Id of the dora_input declared in the yaml configuration | ||||
| dora_input["data"] (bytes): Bytes message of the dora_input | |||||
| dora_input["value"] (arrow array): message of the dora_input | |||||
| send_output Callable[[str, bytes | pa.UInt8Array, Optional[dict]], None]: | send_output Callable[[str, bytes | pa.UInt8Array, Optional[dict]], None]: | ||||
| Function for sending output to the dataflow: | Function for sending output to the dataflow: | ||||
| - First argument is the `output_id` | - First argument is the `output_id` | ||||