| 1 |
/* |
| 2 |
* GStreamer gstreamer-facedetectortensordecoder |
| 3 |
* Copyright (C) 2025 Collabora Ltd |
| 4 |
* |
| 5 |
* gstfacedetectortensordecoder.h |
| 6 |
* |
| 7 |
* This library is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU Library General Public |
| 9 |
* License as published by the Free Software Foundation; either |
| 10 |
* version 2 of the License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This library is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
* Library General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU Library General Public |
| 18 |
* License along with this library; if not, write to the |
| 19 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 20 |
* Boston, MA 02110-1301, USA. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef __GST_FACE_DETECTOR_TENSOR_DECODER_H__ |
| 24 |
#define __GST_FACE_DETECTOR_TENSOR_DECODER_H__ |
| 25 |
|
| 26 |
#include <gst/gst.h> |
| 27 |
#include <gst/video/video.h> |
| 28 |
#include <gst/base/base.h> |
| 29 |
|
| 30 |
G_BEGIN_DECLS |
| 31 |
#define GST_TYPE_FACE_DETECTOR_TENSOR_DECODER (gst_face_detector_tensor_decoder_get_type()) |
| 32 |
G_DECLARE_FINAL_TYPE (GstFaceDetectorTensorDecoder, |
| 33 |
gst_face_detector_tensor_decoder, GST, FACE_DETECTOR_TENSOR_DECODER, |
| 34 |
GstBaseTransform) |
| 35 |
|
| 36 |
typedef struct |
| 37 |
{ |
| 38 |
guint16 index; |
| 39 |
gfloat *box; |
| 40 |
gfloat *score; |
| 41 |
} Candidate; |
| 42 |
|
| 43 |
/** |
| 44 |
* GstFaceDetectorTensorDecoder: |
| 45 |
* |
| 46 |
* Since: 1.28 |
| 47 |
*/ |
| 48 |
struct _GstFaceDetectorTensorDecoder |
| 49 |
{ |
| 50 |
GstBaseTransform basetransform; |
| 51 |
|
| 52 |
/* Confidence threshold. */ |
| 53 |
gfloat score_threshold; |
| 54 |
|
| 55 |
/* Intersection-of-Union threshold. */ |
| 56 |
gfloat iou_threshold; |
| 57 |
|
| 58 |
/* Video Info */ |
| 59 |
GstVideoInfo video_info; |
| 60 |
|
| 61 |
/* Candidates with a class confidence level above threshold. */ |
| 62 |
GPtrArray *sel_candidates; |
| 63 |
|
| 64 |
/* Final candidates selected that respect class confidence level, |
| 65 |
* NMS and maximum detection. */ |
| 66 |
GPtrArray *selected; |
| 67 |
|
| 68 |
/* Candidates with a class confidence level and bounding boxes. */ |
| 69 |
Candidate *candidates; |
| 70 |
}; |
| 71 |
|
| 72 |
/** |
| 73 |
* GstFaceDetectorTensorDecoderClass: |
| 74 |
* |
| 75 |
* @parent_class base transform base class |
| 76 |
* |
| 77 |
* Since: 1.28 |
| 78 |
*/ |
| 79 |
struct _GstFaceDetectorTensorDecoderClass |
| 80 |
{ |
| 81 |
GstBaseTransformClass parent_class; |
| 82 |
}; |
| 83 |
|
| 84 |
GST_ELEMENT_REGISTER_DECLARE (face_detector_tensor_decoder) |
| 85 |
G_END_DECLS |
| 86 |
#endif /* __GST_FACE_DETECTOR_TENSOR_DECODER_H__ */ |