| 1 |
/* |
| 2 |
* GStreamer gstreamer-classifiertensordecoder |
| 3 |
* Copyright (C) 2025 Collabora Ltd |
| 4 |
* @author: Daniel Morin <[email protected]> |
| 5 |
* |
| 6 |
* gstclassifiertensordecoder.h |
| 7 |
* |
| 8 |
* This library is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU Library General Public |
| 10 |
* License as published by the Free Software Foundation; either |
| 11 |
* version 2 of the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This library is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
* Library General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Library General Public |
| 19 |
* License along with this library; if not, write to the |
| 20 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 21 |
* Boston, MA 02110-1301, USA. |
| 22 |
*/ |
| 23 |
|
| 24 |
|
| 25 |
#ifndef __GST_CLASSIFIER_TENSOR_DECODER_H__ |
| 26 |
#define __GST_CLASSIFIER_TENSOR_DECODER_H__ |
| 27 |
|
| 28 |
#include <gst/gst.h> |
| 29 |
#include <gst/base/gstbasetransform.h> |
| 30 |
|
| 31 |
G_BEGIN_DECLS |
| 32 |
|
| 33 |
#define GST_TYPE_CLASSIFIER_TENSOR_DECODER (gst_classifier_tensor_decoder_get_type ()) |
| 34 |
G_DECLARE_FINAL_TYPE (GstClassifierTensorDecoder, gst_classifier_tensor_decoder, |
| 35 |
GST, CLASSIFIER_TENSOR_DECODER, GstBaseTransform) |
| 36 |
|
| 37 |
/** |
| 38 |
* GstClassifierTensorDecoder: |
| 39 |
* |
| 40 |
* @threshold: Class confidence threshold |
| 41 |
* @labels_file: Path where to read class labels |
| 42 |
* @class_quark: Class labels quark representation |
| 43 |
* @postproc_result: Buffer for post-processing (softmax, uint8->float conversion) |
| 44 |
* @class_count: Class count |
| 45 |
* @do_softmax: Whether softmax needs to be applied (determined by negotiated caps) |
| 46 |
* |
| 47 |
* Since: 1.24 |
| 48 |
*/ |
| 49 |
struct _GstClassifierTensorDecoder |
| 50 |
{ |
| 51 |
GstBaseTransform basetransform; |
| 52 |
gfloat threshold; |
| 53 |
gchar *labels_file; |
| 54 |
GArray *class_quark; |
| 55 |
GArray *postproc_result; |
| 56 |
gsize class_count; |
| 57 |
gboolean do_softmax; |
| 58 |
}; |
| 59 |
|
| 60 |
struct _GstClassifierTensorDecoderClass |
| 61 |
{ |
| 62 |
GstBaseTransformClass parent_class; |
| 63 |
|
| 64 |
/* TODO: Add vmethod to allow overwriting: decode, postprocess, load_labels */ |
| 65 |
}; |
| 66 |
|
| 67 |
GST_ELEMENT_REGISTER_DECLARE (classifier_tensor_decoder) |
| 68 |
|
| 69 |
G_END_DECLS |
| 70 |
#endif /* __GST_CLASSIFIER_TENSOR_DECODER_H__ */ |