mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
1ff585233a
This element refactors functionality from gstonnxinference element, namely separating out the ONNX inference from the subsequent analysis. The new element runs an ONNX model on each video frame, and then attaches a TensorMeta meta with the output tensor data. This tensor data will then be consumed by downstream elements such as gstobjectdetector. At the moment, a provisional TensorMeta is used just in the ONNX plugin, but in future this will upgraded to a GStreamer API for other plugins to consume. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4916>
69 lines
1.8 KiB
C
69 lines
1.8 KiB
C
/*
|
|
* GStreamer gstreamer-tensor
|
|
* Copyright (C) 2023 Collabora Ltd
|
|
*
|
|
* gsttensor.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_TENSOR_H__
|
|
#define __GST_TENSOR_H__
|
|
|
|
|
|
/**
|
|
* GstTensorType:
|
|
*
|
|
* @GST_TENSOR_TYPE_INT8 8 bit integer tensor data
|
|
* @GST_TENSOR_TYPE_INT16 16 bit integer tensor data
|
|
* @GST_TENSOR_TYPE_INT32 32 bit integer tensor data
|
|
* @GST_TENSOR_TYPE_FLOAT16 16 bit floating point tensor data
|
|
* @GST_TENSOR_TYPE_FLOAT32 32 bit floating point tensor data
|
|
*
|
|
* Since: 1.24
|
|
*/
|
|
typedef enum _GstTensorType
|
|
{
|
|
GST_TENSOR_TYPE_INT8,
|
|
GST_TENSOR_TYPE_INT16,
|
|
GST_TENSOR_TYPE_INT32,
|
|
GST_TENSOR_TYPE_FLOAT16,
|
|
GST_TENSOR_TYPE_FLOAT32
|
|
} GstTensorType;
|
|
|
|
|
|
/**
|
|
* GstTensor:
|
|
*
|
|
* @id unique tensor identifier
|
|
* @num_dims number of tensor dimensions
|
|
* @dims tensor dimensions
|
|
* @type @ref GstTensorType of tensor data
|
|
* @data @ref GstBuffer holding tensor data
|
|
*
|
|
* Since: 1.24
|
|
*/
|
|
typedef struct _GstTensor
|
|
{
|
|
GQuark id;
|
|
gint num_dims;
|
|
int64_t *dims;
|
|
GstTensorType type;
|
|
GstBuffer *data;
|
|
} GstTensor;
|
|
|
|
#define GST_TENSOR_MISSING_ID -1
|
|
|
|
#endif
|