• Hardware Platform (Jetson / GPU) -Jetson AGX
• DeepStream Version - 6.4
• JetPack Version (valid for Jetson only) - 6.0+b106
• TensorRT Version - 8.6.2
• NVIDIA GPU Driver Version (valid for GPU only) - 12.2
• Issue Type( questions, new requirements, bugs) - we are using FPENet algorithm for facial landmark extraction and we used primary model for face detection as facenet and seconday model used for FPENet and we can able to extract 80 landmark point and not sure about that particular detected face landmark so need to give solution for this
def tiler_sink_pad_buffer_probe(pad, info, u_data):
global attendace_data, prediction, frame_no, obj_id_confidences, previous_obj_id, obj_id, count
gst_buffer = info.get_buffer()
if not gst_buffer:
print("Unable to get GstBuffer")
return Gst.PadProbeReturn.OK
# Retrieve batch metadata from the buffer
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list
while l_frame is not None:
try:
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
except StopIteration:
break
obj_source_id = frame_meta.source_id
l_obj = frame_meta.obj_meta_list
frame_no += 1
# Get frame surface and convert to numpy array
n_frame = pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id)
frame = np.array(n_frame, copy=True, order='C')
bgr_frame = cv2.cvtColor(frame, cv2.COLOR_RGBA2BGR)
while l_obj is not None:
try:
obj_meta = pyds.NvDsObjectMeta.cast(l_obj.data)
except StopIteration:
break
# Process objects from the primary model
if obj_meta.unique_component_id == 1:
obj_id, confidence = obj_meta.object_id, obj_meta.confidence
x, y = obj_meta.rect_params.left, obj_meta.rect_params.top
bbox_width, bbox_height = obj_meta.rect_params.width, obj_meta.rect_params.height
x1, y1 = max(int(x - padding), 0), max(int(y - padding), 0)
x2, y2 = int(x + bbox_width + padding), int(y + bbox_height + padding)
if obj_id not in obj_id_confidences:
obj_id_confidences[obj_id] = {'confidences': [confidence], 'exec': False, 'uuid': uuid4().hex}
else:
obj_id_confidences[obj_id]["confidences"].append(confidence)
current_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
if confidence >= 0.4 and not obj_id_confidences[obj_id]['exec']:
current_confidence = obj_id_confidences[obj_id]['confidences'][-1]
img_file_name = f"{obj_id_confidences[obj_id]['uuid']}_{round(confidence, 2)}_{current_time}.jpg"
# Crop and convert image for saving
cropped_image = bgr_frame[y1:y2, x1:x2]
rgb_image = cv2.cvtColor(cropped_image, cv2.COLOR_BGR2RGB)
# Access the secondary model output (landmarks)
l_user_meta = obj_meta.obj_user_meta_list
while l_user_meta is not None:
try:
user_meta = pyds.NvDsUserMeta.cast(l_user_meta.data)
except StopIteration:
break
if user_meta and user_meta.base_meta.meta_type == pyds.NvDsMetaType.NVDSINFER_TENSOR_OUTPUT_META:
try:
tensor_meta = pyds.NvDsInferTensorMeta.cast(user_meta.user_meta_data)
except StopIteration:
break
# Extract landmarks from tensor output
for i in range(tensor_meta.num_output_layers):
layer = pyds.get_nvds_LayerInfo(tensor_meta, i)
if layer is not None and layer.buffer:
layer_name = layer.layerName
if layer_name == "conv_keypoints_m80":
output = []
# Assuming buffer contains float32 data
for j in range(80): # Extract 80 keypoints
x = pyds.get_detections(layer.buffer, j * 2) # X-coordinate
y = pyds.get_detections(layer.buffer, j * 2 + 1) # Y-coordinate
if x is not None and y is not None:
output.append((x, y)) # Store as tuple of (x, y) coordinates
print(f"Extracted {len(output)} landmarks: {output}")
# Draw circles on landmarks
for (x, y) in output:
x = int(x)
y = int(y)
cv2.circle(rgb_image, (x, y), 5, (0, 255, 0), -1) # Draw a green circle
# Save the image with landmarks
img_file_path = f"landmark_img/{count}_{img_file_name}"
cv2.imwrite(img_file_path, rgb_image)
count += 1
print(f"Saved image with landmarks to {img_file_path}")
try:
l_user_meta = l_user_meta.next
except StopIteration:
break
try:
l_obj = l_obj.next
except StopIteration:
break
try:
l_frame = l_frame.next
except StopIteration:
break
return Gst.PadProbeReturn.OK
give right way to implement triton server on jetson orin with cuda
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)