diff --git a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json index d15af4382c..d20c7fa02f 100644 --- a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json +++ b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json @@ -235257,6 +235257,178 @@ "tracers": {}, "url": "Unknown package origin" }, + "onnx": { + "description": "ONNX neural network plugin", + "elements": { + "onnxinference": { + "author": "Aaron Boxer ", + "description": "Apply neural network to video frames and create tensor output", + "hierarchy": [ + "GstOnnxInference", + "GstBaseTransform", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Filter/Effect/Video", + "pad-templates": { + "sink": { + "caps": "video/x-raw:\n format: { RGB, RGBA, BGR, BGRA }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "sink", + "presence": "always" + }, + "src": { + "caps": "video/x-raw:\n format: { RGB, RGBA, BGR, BGRA }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "src", + "presence": "always" + } + }, + "properties": { + "execution-provider": { + "blurb": "ONNX execution provider", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "cpu (0)", + "mutable": "null", + "readable": true, + "type": "GstOnnxExecutionProvider", + "writable": true + }, + "input-image-format": { + "blurb": "Input image format", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "hwc (0)", + "mutable": "null", + "readable": true, + "type": "GstMlInputImageFormat", + "writable": true + }, + "input-tensor-offset": { + "blurb": "offset each tensor value by this value", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "0", + "max": "3.40282e+38", + "min": "-3.40282e+38", + "mutable": "null", + "readable": true, + "type": "gfloat", + "writable": true + }, + "input-tensor-scale": { + "blurb": "Divide each tensor value by this value", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "1", + "max": "3.40282e+38", + "min": "1.17549e-38", + "mutable": "null", + "readable": true, + "type": "gfloat", + "writable": true + }, + "model-file": { + "blurb": "ONNX model file", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "NULL", + "mutable": "null", + "readable": true, + "type": "gchararray", + "writable": true + }, + "optimization-level": { + "blurb": "ONNX optimization level", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "disable-all (0)", + "mutable": "null", + "readable": true, + "type": "GstOnnxOptimizationLevel", + "writable": true + } + }, + "rank": "primary" + } + }, + "filename": "gstonnx", + "license": "LGPL", + "other-types": { + "GstMlInputImageFormat": { + "kind": "enum", + "values": [ + { + "desc": "Height Width Channel (HWC) a.k.a. interleaved image data format", + "name": "hwc", + "value": "0" + }, + { + "desc": "Channel Height Width (CHW) a.k.a. planar image data format", + "name": "chw", + "value": "1" + } + ] + }, + "GstOnnxExecutionProvider": { + "kind": "enum", + "values": [ + { + "desc": "CPU execution provider", + "name": "cpu", + "value": "0" + }, + { + "desc": "CUDA execution provider", + "name": "cuda", + "value": "1" + } + ] + }, + "GstOnnxOptimizationLevel": { + "kind": "enum", + "values": [ + { + "desc": "Disable all optimization", + "name": "disable-all", + "value": "0" + }, + { + "desc": "Enable basic optimizations (redundant node removals))", + "name": "enable-basic", + "value": "1" + }, + { + "desc": "Enable extended optimizations (redundant node removals + node fusions)", + "name": "enable-extended", + "value": "2" + }, + { + "desc": "Enable all possible optimizations", + "name": "enable-all", + "value": "3" + } + ] + } + }, + "package": "GStreamer Bad Plug-ins", + "source": "gst-plugins-bad", + "tracers": {}, + "url": "Unknown package origin" + }, "openal": { "description": "OpenAL plugin library", "elements": { diff --git a/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c b/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c index d21f2ccfbd..185eaa8fbc 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c +++ b/subprojects/gst-plugins-bad/ext/onnx/gstonnx.c @@ -24,6 +24,18 @@ #include "config.h" #endif +/** + * SECTION:plugin-onnx + * @title: ONNX + * @short_description: A plugin for ONNX-Runtime + * + * A plugin containing the inference elements using the ONNX Runtime project. + * + * See https://onnxruntime.ai/ + * + * Since: 1.20 + */ + #include "gstonnxinference.h" static gboolean diff --git a/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h b/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h index f0d480cdda..d70637e83c 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h +++ b/subprojects/gst-plugins-bad/ext/onnx/gstonnxclient.h @@ -30,6 +30,12 @@ GST_DEBUG_CATEGORY_EXTERN (onnx_inference_debug); +/** + * GstOnnxOptimizationLevel: + * + * Since: 1.20 + */ + typedef enum { GST_ONNX_OPTIMIZATION_LEVEL_DISABLE_ALL, @@ -38,6 +44,12 @@ typedef enum GST_ONNX_OPTIMIZATION_LEVEL_ENABLE_ALL, } GstOnnxOptimizationLevel; +/** + * GstOnnxExecutionProvider: + * + * Since: 1.20 + */ + typedef enum { GST_ONNX_EXECUTION_PROVIDER_CPU, diff --git a/subprojects/gst-plugins-bad/ext/onnx/gstonnxinference.cpp b/subprojects/gst-plugins-bad/ext/onnx/gstonnxinference.cpp index 3abdb3645e..6233a0b2c2 100644 --- a/subprojects/gst-plugins-bad/ext/onnx/gstonnxinference.cpp +++ b/subprojects/gst-plugins-bad/ext/onnx/gstonnxinference.cpp @@ -54,7 +54,7 @@ * to enable users to easily add and remove meta data from json files. It can also dump * the names of all output layers, which can then be used to craft the json meta data file. * - * + * Since: 1.20 */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -331,6 +331,13 @@ gst_onnx_inference_class_init (GstOnnxInferenceClass * klass) GST_DEBUG_FUNCPTR (gst_onnx_inference_transform_caps); basetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_onnx_inference_set_caps); + + gst_type_mark_as_plugin_api (GST_TYPE_ONNX_OPTIMIZATION_LEVEL, + (GstPluginAPIFlags) 0); + gst_type_mark_as_plugin_api (GST_TYPE_ONNX_EXECUTION_PROVIDER, + (GstPluginAPIFlags) 0); + gst_type_mark_as_plugin_api (GST_TYPE_ML_MODEL_INPUT_IMAGE_FORMAT, + (GstPluginAPIFlags) 0); } static void