Common functions for various tensor_filters. More...
#include <glib-object.h>
#include <errno.h>
#include <nnstreamer_subplugin.h>
#include <nnstreamer_plugin_api_util.h>
#include <nnstreamer_plugin_api_filter.h>
#include "nnstreamer_watchdog.h"
Go to the source code of this file.
Classes | |
struct | _GstTensorFilterStatistics |
Structure definition for tensor-filter statistics. More... | |
struct | _GstTensorFilterCombination |
Structure definition for tensor-filter in/out combination. More... | |
struct | GstTensorFilterSharedModelRepresentation |
Data Structure to store shared table. More... | |
struct | _GstTensorFilterPrivate |
Structure definition for common tensor-filter properties. More... | |
Macros | |
#define | DBG (!priv->silent) |
Macro for debug mode. More... | |
#define | GST_TF_FW_VN(fw, vn) (fw && checkGstTensorFilterFrameworkVersion (fw->version, vn)) |
#define | GST_TF_FW_V0(fw) GST_TF_FW_VN (fw, 0) |
#define | GST_TF_FW_V1(fw) GST_TF_FW_VN (fw, 1) |
#define | gst_tensor_filter_v0_call(priv, ret, funcname, ...) |
Invoke callbacks of nn framework. Guarantees calling open for the first call. More... | |
#define | gst_tensor_filter_v1_call(priv, ret, funcname, ...) |
#define | GST_TF_FW_INVOKE_COMPAT(priv, ret, in, out) |
#define | GST_TF_STAT_MAX_RECENT (10) |
Typedefs | |
typedef struct _GstTensorFilterStatistics | GstTensorFilterStatistics |
Structure definition for tensor-filter statistics. More... | |
typedef struct _GstTensorFilterCombination | GstTensorFilterCombination |
Structure definition for tensor-filter in/out combination. More... | |
typedef struct _GstTensorFilterPrivate | GstTensorFilterPrivate |
Structure definition for common tensor-filter properties. More... | |
Enumerations | |
enum | { PROP_0, PROP_SILENT, PROP_FRAMEWORK, PROP_MODEL, PROP_INPUT, PROP_INPUTTYPE, PROP_INPUTNAME, PROP_INPUTLAYOUT, PROP_INPUTRANKS, PROP_OUTPUT, PROP_OUTPUTTYPE, PROP_OUTPUTNAME, PROP_OUTPUTLAYOUT, PROP_OUTPUTRANKS, PROP_CUSTOM, PROP_SUBPLUGINS, PROP_ACCELERATOR, PROP_IS_UPDATABLE, PROP_LATENCY, PROP_THROUGHPUT, PROP_INPUTCOMBINATION, PROP_OUTPUTCOMBINATION, PROP_SHARED_TENSOR_FILTER_KEY, PROP_LATENCY_REPORT, PROP_INVOKE_DYNAMIC, PROP_CONFIG, PROP_SUSPEND } |
GstTensorFilter properties. More... | |
Functions | |
gchar * | gst_tensorsinfo_compare_to_string (const GstTensorsInfo *info, const GstTensorsInfo *info2) |
Printout the comparison results of two tensors as a string. More... | |
void | gst_tensorsinfo_compare_print (const GstTensorsInfo *info1, const GstTensorsInfo *info2) |
Printout the comparison results of two tensors. More... | |
gboolean | gst_tensor_filter_allocate_in_invoke (GstTensorFilterPrivate *priv) |
check if the allocate_in_invoke is valid for the framework More... | |
void | gst_tensor_filter_install_properties (GObjectClass *gobject_class) |
Installs all the properties for tensor_filter. More... | |
void | gst_tensor_filter_common_init_property (GstTensorFilterPrivate *priv) |
Initialize the properties for tensor-filter. More... | |
void | gst_tensor_filter_common_free_property (GstTensorFilterPrivate *priv) |
Free the properties for tensor-filter. More... | |
gboolean | gst_tensor_filter_common_set_property (GstTensorFilterPrivate *priv, guint prop_id, const GValue *value, GParamSpec *pspec) |
Set the properties for tensor_filter. More... | |
gboolean | gst_tensor_filter_common_get_property (GstTensorFilterPrivate *priv, guint prop_id, GValue *value, GParamSpec *pspec) |
Get the properties for tensor_filter. More... | |
gboolean | gst_tensor_filter_common_get_combined_in_info (GstTensorFilterPrivate *priv, const GstTensorsInfo *in, GstTensorsInfo *combined) |
Configure input tensor info with combi option. More... | |
gboolean | gst_tensor_filter_common_get_combined_out_info (GstTensorFilterPrivate *priv, const GstTensorsInfo *in, const GstTensorsInfo *out, GstTensorsInfo *combined) |
Configure output tensor info with combi option. More... | |
gboolean | gst_tensor_filter_common_get_out_info (GstTensorFilterPrivate *priv, GstTensorsInfo *in, GstTensorsInfo *out) |
Get output tensor info from NN model with given input info. More... | |
void | gst_tensor_filter_load_tensor_info (GstTensorFilterPrivate *priv) |
Load tensor info from NN model. (both input and output tensor) More... | |
void | gst_tensor_filter_common_open_fw (GstTensorFilterPrivate *priv) |
Open NN framework. More... | |
void | gst_tensor_filter_common_unload_fw (GstTensorFilterPrivate *priv) |
Unload NN framework. More... | |
void | gst_tensor_filter_common_close_fw (GstTensorFilterPrivate *priv) |
Close NN framework. More... | |
gchar * | gst_tensor_filter_detect_framework (const gchar *const *model_files, const guint num_models, const gboolean load_conf) |
Get neural network framework name from given model file. This does not guarantee the framework is available on the target device. More... | |
gboolean | gst_tensor_filter_check_hw_availability (const gchar *name, const accl_hw hw, const char *custom) |
Check if the given hw is supported by the framework. More... | |
void | gst_tensor_filter_destroy_notify_util (GstTensorFilterPrivate *priv, void *data) |
Free the data allocated for tensor filter output. More... | |
Common functions for various tensor_filters.
Copyright (C) 2019 Parichay kapoor pk.ka poor @sams ung. com
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; version 2.1 of the License.
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.
Definition in file tensor_filter_common.h.
#define DBG (!priv->silent) |
Macro for debug mode.
Definition at line 41 of file tensor_filter_common.h.
#define gst_tensor_filter_v0_call | ( | priv, | |
ret, | |||
funcname, | |||
... | |||
) |
Invoke callbacks of nn framework. Guarantees calling open for the first call.
Definition at line 53 of file tensor_filter_common.h.
#define gst_tensor_filter_v1_call | ( | priv, | |
ret, | |||
funcname, | |||
... | |||
) |
Definition at line 61 of file tensor_filter_common.h.
#define GST_TF_FW_INVOKE_COMPAT | ( | priv, | |
ret, | |||
in, | |||
out | |||
) |
Definition at line 69 of file tensor_filter_common.h.
#define GST_TF_FW_V0 | ( | fw | ) | GST_TF_FW_VN (fw, 0) |
Definition at line 47 of file tensor_filter_common.h.
#define GST_TF_FW_V1 | ( | fw | ) | GST_TF_FW_VN (fw, 1) |
Definition at line 48 of file tensor_filter_common.h.
#define GST_TF_FW_VN | ( | fw, | |
vn | |||
) | (fw && checkGstTensorFilterFrameworkVersion (fw->version, vn)) |
Check tensor_filter framework version
Definition at line 45 of file tensor_filter_common.h.
#define GST_TF_STAT_MAX_RECENT (10) |
Definition at line 78 of file tensor_filter_common.h.
typedef struct _GstTensorFilterCombination GstTensorFilterCombination |
Structure definition for tensor-filter in/out combination.
typedef struct _GstTensorFilterPrivate GstTensorFilterPrivate |
Structure definition for common tensor-filter properties.
typedef struct _GstTensorFilterStatistics GstTensorFilterStatistics |
Structure definition for tensor-filter statistics.
anonymous enum |
GstTensorFilter properties.
Definition at line 83 of file tensor_filter_common.h.
gboolean gst_tensor_filter_allocate_in_invoke | ( | GstTensorFilterPrivate * | priv | ) |
check if the allocate_in_invoke is valid for the framework
[in] | priv | Struct containing the properties of the object |
Definition at line 757 of file tensor_filter_common.c.
gboolean gst_tensor_filter_check_hw_availability | ( | const gchar * | name, |
const accl_hw | hw, | ||
const char * | custom | ||
) |
Check if the given hw is supported by the framework.
[in] | name | The name of filter sub-plugin. |
[in] | hw | Backend accelerator hardware. |
[in] | custom | User-defined string to handle detailed hardware option. |
Only check for specific HW, DEFAULT/AUTO are always supported
Definition at line 2923 of file tensor_filter_common.c.
void gst_tensor_filter_common_close_fw | ( | GstTensorFilterPrivate * | priv | ) |
Close NN framework.
Definition at line 2560 of file tensor_filter_common.c.
void gst_tensor_filter_common_free_property | ( | GstTensorFilterPrivate * | priv | ) |
Free the properties for tensor-filter.
Definition at line 1065 of file tensor_filter_common.c.
gboolean gst_tensor_filter_common_get_combined_in_info | ( | GstTensorFilterPrivate * | priv, |
const GstTensorsInfo * | in, | ||
GstTensorsInfo * | combined | ||
) |
Configure input tensor info with combi option.
Definition at line 2270 of file tensor_filter_common.c.
gboolean gst_tensor_filter_common_get_combined_out_info | ( | GstTensorFilterPrivate * | priv, |
const GstTensorsInfo * | in, | ||
const GstTensorsInfo * | out, | ||
GstTensorsInfo * | combined | ||
) |
Configure output tensor info with combi option.
Definition at line 2315 of file tensor_filter_common.c.
gboolean gst_tensor_filter_common_get_out_info | ( | GstTensorFilterPrivate * | priv, |
GstTensorsInfo * | in, | ||
GstTensorsInfo * | out | ||
) |
Get output tensor info from NN model with given input info.
Definition at line 2374 of file tensor_filter_common.c.
gboolean gst_tensor_filter_common_get_property | ( | GstTensorFilterPrivate * | priv, |
guint | prop_id, | ||
GValue * | value, | ||
GParamSpec * | pspec | ||
) |
Get the properties for tensor_filter.
[in] | priv | Struct containing the properties of the object |
[in] | prop_id | Id for the property |
[in] | value | Container to return the asked property |
[in] | pspec | Metadata to specify the parameter |
Definition at line 2102 of file tensor_filter_common.c.
void gst_tensor_filter_common_init_property | ( | GstTensorFilterPrivate * | priv | ) |
Initialize the properties for tensor-filter.
Definition at line 1041 of file tensor_filter_common.c.
void gst_tensor_filter_common_open_fw | ( | GstTensorFilterPrivate * | priv | ) |
Open NN framework.
Definition at line 2491 of file tensor_filter_common.c.
gboolean gst_tensor_filter_common_set_property | ( | GstTensorFilterPrivate * | priv, |
guint | prop_id, | ||
const GValue * | value, | ||
GParamSpec * | pspec | ||
) |
Set the properties for tensor_filter.
[in] | priv | Struct containing the properties of the object |
[in] | prop_id | Id for the property |
[in] | value | Container to return the asked property |
[in] | pspec | Metadata to specify the parameter |
Although no one return !0 at this point, let's enable error handling.
Definition at line 1967 of file tensor_filter_common.c.
void gst_tensor_filter_common_unload_fw | ( | GstTensorFilterPrivate * | priv | ) |
Unload NN framework.
Definition at line 2545 of file tensor_filter_common.c.
void gst_tensor_filter_destroy_notify_util | ( | GstTensorFilterPrivate * | priv, |
void * | data | ||
) |
Free the data allocated for tensor filter output.
[in] | priv | Struct containing the properties of the object |
[in] | data | Data to be freed |
Definition at line 786 of file tensor_filter_common.c.
gchar* gst_tensor_filter_detect_framework | ( | const gchar *const * | model_files, |
const guint | num_models, | ||
const gboolean | load_conf | ||
) |
Get neural network framework name from given model file. This does not guarantee the framework is available on the target device.
[in] | model_files | the prediction model paths |
[in] | num_models | the number of model files |
[in] | load_conf | flag to load configuration for the priority of framework |
[in] | model_files | the prediction model paths |
[in] | num_models | the number of model files |
[in] | load_conf | flag to load configuration for the priority of framework |
Definition at line 1232 of file tensor_filter_common.c.
void gst_tensor_filter_install_properties | ( | GObjectClass * | gobject_class | ) |
Installs all the properties for tensor_filter.
[in] | gobject_class | Glib object class whose properties will be set |
min
max
default: off
min
max
default: off
Definition at line 888 of file tensor_filter_common.c.
void gst_tensor_filter_load_tensor_info | ( | GstTensorFilterPrivate * | priv | ) |
Load tensor info from NN model. (both input and output tensor)
if set-property called and already has info, verify it!
In case of dynamic invoke, output tensors info is determined after invoke.
if set-property called and already has info, verify it!
Definition at line 2409 of file tensor_filter_common.c.
void gst_tensorsinfo_compare_print | ( | const GstTensorsInfo * | info1, |
const GstTensorsInfo * | info2 | ||
) |
Printout the comparison results of two tensors.
[in] | info1 | The tensors to be shown on the left hand side |
[in] | info2 | The tensors to be shown on the right hand side |
[in] | info1 | The tensors to be shown on the left hand side |
[in] | info2 | The tensors to be shown on the right hand side |
Definition at line 874 of file tensor_filter_common.c.
gchar* gst_tensorsinfo_compare_to_string | ( | const GstTensorsInfo * | info1, |
const GstTensorsInfo * | info2 | ||
) |
Printout the comparison results of two tensors as a string.
[in] | info1 | The tensors to be shown on the left hand side |
[in] | info2 | The tensors to be shown on the right hand side |
Definition at line 811 of file tensor_filter_common.c.