tensordecoders: Move decoder out of the ONNX plugin

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6000>
This commit is contained in:
Olivier Crête 2024-01-25 01:09:13 -05:00 committed by GStreamer Marge Bot
parent 03fd6fadbc
commit 8fa4c8f2f0
9 changed files with 148 additions and 9 deletions

View file

@ -245050,6 +245050,86 @@
"tracers": {},
"url": "Unknown package origin"
},
"tensordecoders": {
"description": "Tensor decoders elements",
"elements": {
"ssdobjectdetector": {
"author": "Aaron Boxer <aaron.boxer@collabora.com>, Marcus Edel <marcus.edel@collabora.com>",
"description": "Apply tensor output from inference to detect objects in video frames",
"hierarchy": [
"GstSsdObjectDetector",
"GstBaseTransform",
"GstElement",
"GstObject",
"GInitiallyUnowned",
"GObject"
],
"klass": "TensorDecoder/Video",
"pad-templates": {
"sink": {
"caps": "video/x-raw:\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-raw:\n",
"direction": "src",
"presence": "always"
}
},
"properties": {
"label-file": {
"blurb": "Label file",
"conditionally-available": false,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "NULL",
"mutable": "null",
"readable": true,
"type": "gchararray",
"writable": true
},
"score-threshold": {
"blurb": "Threshold for deciding when to remove boxes based on score",
"conditionally-available": false,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "0.3",
"max": "1",
"min": "0",
"mutable": "null",
"readable": true,
"type": "gfloat",
"writable": true
},
"size-threshold": {
"blurb": "Threshold for deciding when to remove boxes based on proportion of the image",
"conditionally-available": false,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "0.9",
"max": "1",
"min": "0",
"mutable": "null",
"readable": true,
"type": "gfloat",
"writable": true
}
},
"rank": "primary"
}
},
"filename": "gsttensordecoders",
"license": "LGPL",
"other-types": {},
"package": "GStreamer Bad Plug-ins",
"source": "gst-plugins-bad",
"tracers": {},
"url": "Unknown package origin"
},
"timecode": {
"description": "Timecode-related elements",
"elements": {

View file

@ -24,16 +24,12 @@
#include "config.h"
#endif
#include "decoders/gstssdobjectdetector.h"
#include "gstonnxinference.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean success = GST_ELEMENT_REGISTER (ssd_object_detector, plugin);
success |= GST_ELEMENT_REGISTER (onnx_inference, plugin);
return success;
return GST_ELEMENT_REGISTER (onnx_inference, plugin);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -15,7 +15,6 @@ endif
if onnxrt_dep.found()
gstonnx = library('gstonnx',
'gstonnx.c',
'decoders/gstssdobjectdetector.c',
'gstonnxinference.cpp',
'gstonnxclient.cpp',
c_args : gst_plugins_bad_args + extra_args,
@ -23,7 +22,7 @@ if onnxrt_dep.found()
link_args : noseh_link_args,
include_directories : [configinc, libsinc, cuda_stubinc],
dependencies : [gstbase_dep, gstvideo_dep, gstanalytics_dep, onnxrt_dep,
libm, gio_dep] + extra_deps,
libm] + extra_deps,
install : true,
install_dir : plugins_install_dir,
)

View file

@ -11,7 +11,7 @@ foreach plugin : ['accurip', 'adpcmdec', 'adpcmenc', 'aiff', 'asfmux',
'mse', 'mxf', 'netsim', 'onvif', 'pcapparse', 'pnm', 'proxy',
'rawparse', 'removesilence', 'rist', 'rtmp2', 'rtp', 'sdp',
'segmentclip', 'siren', 'smooth', 'speed', 'subenc', 'switchbin',
'timecode', 'transcode', 'unixfd', 'videofilters',
'tensordecoders', 'timecode', 'transcode', 'unixfd', 'videofilters',
'videoframe_audiolevel', 'videoparsers', 'videosignal',
'vmnc', 'y4m']
if not get_option(plugin).disabled()

View file

@ -2,7 +2,7 @@
* GStreamer gstreamer-ssdobjectdetector
* Copyright (C) 2021 Collabora Ltd.
*
* gstssdobjectdetector.cpp
* gstssdobjectdetector.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public

View file

@ -0,0 +1,49 @@
/* GStreamer object detection overlay
* Copyright (C) <2024> Collabora Ltd.
* @author: Daniel Morin <daniel.morin@collabora.com>
*
* gsttensordecoders.c
*
* 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gstssdobjectdetector.h"
/**
* SECTION:plugin-tensordecoders
*
* Tensor decoders
*
* Since: 1.26
*/
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret = FALSE;
ret |= GST_ELEMENT_REGISTER (ssd_object_detector, plugin);
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
tensordecoders,
"Tensor decoders elements",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -0,0 +1,14 @@
tensordecoders_sources = [
'gsttensordecoders.c',
'gstssdobjectdetector.c'
]
gsttensordecoders = library('gsttensordecoders',
tensordecoders_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstvideo_dep, gstanalytics_dep, gio_dep, libm],
install : true,
install_dir : plugins_install_dir,
)
plugins += [gsttensordecoders]

View file

@ -67,6 +67,7 @@ option('smooth', type : 'feature', value : 'auto')
option('speed', type : 'feature', value : 'auto')
option('subenc', type : 'feature', value : 'auto')
option('switchbin', type : 'feature', value : 'auto')
option('tensordecoders', type : 'feature', value : 'auto')
option('timecode', type : 'feature', value : 'auto')
option('unixfd', type : 'feature', value : 'auto')
option('videofilters', type : 'feature', value : 'auto')