/* * GStreamer gstreamer-yolotensordecoder * Copyright (C) 2024 Collabora Ltd * Authors: Daniel Morin * Vineet Suryan * Santosh Mahto * * gstyolotensordecoder.h * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __GST_YOLO_TENSOR_DECODER_H__ #define __GST_YOLO_TENSOR_DECODER_H__ #include #include #include G_BEGIN_DECLS #define GST_TYPE_YOLO_TENSOR_DECODER (gst_yolo_tensor_decoder_get_type ()) G_DECLARE_FINAL_TYPE (GstYoloTensorDecoder, gst_yolo_tensor_decoder, GST, YOLO_TENSOR_DECODER, GstBaseTransform) typedef struct _BBox { gint x; gint y; guint w; guint h; } BBox; struct _GstYoloTensorDecoder { GstBaseTransform basetransform; /* Box confidence threshold */ gfloat box_confi_thresh; /* Class confidence threshold */ gfloat cls_confi_thresh; /* Intersection-of-Union threshold */ gfloat iou_thresh; /* Maximum detection/mask */ gsize max_detection; /* Video Info */ GstVideoInfo video_info; /* Candidates with a class confidence level above threshold. */ GPtrArray *sel_candidates; /* Final candidates selected that respect class confidence level, * NMS and maximum detection. */ GPtrArray *selected; /* Tensor-id identifying mask tensors out of yolo inference process. */ GQuark mask_tensor_id; /* Tensor-id identifying logits tensors out of yolo inference process. */ GQuark logits_tensor_id; /* Region of the mask that contain valid segmentation information */ BBox mask_roi; /* Scaling factor to convert bounding-box coordinates to mask coordinates */ gfloat bb2mask_gain; /* Mask width */ guint mask_w; /* Mask height */ guint mask_h; /* Mask length */ gsize mask_length; /* BufferPool for mask */ GstBufferPool *mask_pool; /* Labels file */ gchar *label_file; /* Labels */ GArray *labels; }; struct _GstYoloTensorDecoderClass { GstBaseTransformClass parent_class; }; GST_ELEMENT_REGISTER_DECLARE (yolo_tensor_decoder) G_END_DECLS #endif /* __GST_YOLO_TENSOR_DECODER_H__ */