silent_debug (self, "Setting property for prop %d.\n", prop_id);
- if (!gst_tensor_filter_common_set_property (priv, prop_id, value, pspec))
+ if (prop_id == PROP_CONFIG) {
+ const gchar *config_path = g_value_get_string (value);
+ gst_tensor_parse_config_file (config_path, object);
+ } else if (!gst_tensor_filter_common_set_property (priv, prop_id, value,
+ pspec)) {
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
}
/**
static GHashTable *shared_model_table = NULL;
/**
- * @brief GstTensorFilter properties.
- */
-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,
-};
-
-/**
* @brief Initialize the tensors layout.
*/
static void
"input and output of the tensor filter. "
"With this option, the output caps is always in the format of flexible tensors.",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_CONFIG,
+ g_param_spec_string ("config-file", "Configuration-file",
+ "sets config file path which contains plugins properties", "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
/**
#define GST_TF_STAT_MAX_RECENT (10)
/**
+ * @brief GstTensorFilter properties.
+ */
+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
+};
+
+/**
* @brief Structure definition for tensor-filter statistics
*/
typedef struct _GstTensorFilterStatistics
--- /dev/null
+framework=tensorflow2-lite
+model=../test_models/models/sample_4x4x4x4x4_two_input_one_output.tflite
--- /dev/null
+framework=tensorflow2-lite
+model=../test_models/models/mobilenet_v1_1.0_224_quant.tflite
--- /dev/null
+framework=tensorflow2-lite
+model=../test_models/models/mobilenet_v1_1.0_224_quant.tflite
+input=7:1
+inputtype=float32
--- /dev/null
+framework=tensorflow2-lite
+output=1:7
+outputtype=int8
python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
testResult $? 1 "Golden test comparison" 0 1
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter config-file=config_file_golden.0 ! filesink location=tensorfilter.out.log" 1 0 0 $PERFORMANCE
+python3 checkLabel.py tensorfilter.out.log ${PATH_TO_LABEL} orange
+testResult $? 1 "Golden test comparison(with config_file_golden.0)" 0 1
+
# Fail test for invalid input properties
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow2-lite model=${PATH_TO_MODEL} input=7:1 inputtype=float32 ! filesink location=tensorfilter.out.log" 2F_n 0 1 $PERFORMANCE
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter config-file=config_file_golden.1 ! filesink location=tensorfilter.out.log" "2F_n(with config_file_golden.1)" 0 1 $PERFORMANCE
+
# Fail test for invalid output properties
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow2-lite model=${PATH_TO_MODEL} output=1:7 outputtype=int8 ! filesink location=tensorfilter.out.log" 3F_n 0 1 $PERFORMANCE
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter model=${PATH_TO_MODEL} config-file=config_file_golden.2 ! filesink location=tensorfilter.out.log" "3F_n(with config_file_golden.2)" 0 1 $PERFORMANCE
+
PATH_TO_MULTI_TENSOR_OUTPUT_MODEL="../test_models/models/multi_person_mobilenet_v1_075_float.tflite"
# Simple tests for multi-tensor output model
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"test_00.dat\" blocksize=-1 num_buffers=2 ! application/octet-stream ! tensor_converter input-dim=4:4:4:4:4 input-type=float32 ! tee name=t t. ! queue ! mux.sink_0 t. ! queue ! mux.sink_1 tensor_mux name=mux sync_mode=nosync ! queue ! tensor_filter framework=tensorflow2-lite model=${PATH_TO_MODEL} ! multifilesink location=tensorfilter.out.log" 6 0 0 $PERFORMANCE
callCompareTest test_00.dat.golden tensorfilter.out.log 6 "Compare 6" 1 0
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"test_00.dat\" blocksize=-1 num_buffers=2 ! application/octet-stream ! tensor_converter input-dim=4:4:4:4:4 input-type=float32 ! tee name=t t. ! queue ! mux.sink_0 t. ! queue ! mux.sink_1 tensor_mux name=mux sync_mode=nosync ! queue ! tensor_filter config-file=config_file.0 ! multifilesink location=tensorfilter.out.log" "6(with config_file.0)" 0 0 $PERFORMANCE
+callCompareTest test_00.dat.golden tensorfilter.out.log 6 "Compare 6 (with config_file.0)" 1 0
+
# Cleanup
rm info *.log *.dat *.golden