dlstreamer/pipeline-server

Parameter substitution in pipeline template crashes the server

Gauthamraju31 opened this issue · 3 comments

ISSUE DESCRIPTION

As per link, the direct substitution of parameters (in this example resolution) can be achieved with {parameters[..]} approach. However, after creating the template (mentioned below) in the same format the pipeline is failing on validation. The docker image was created from the master branch of this repositary.

JSON Template

{
	"type": "GStreamer",
	"template": [
		"{auto_source} ! decodebin ! videoscale",
		" ! video/x-raw,height={parameters[height]},width={parameters[width]} ! videoconvert",
		" ! gvadetect model={models[object_detection][person][network]} name=detection",
		" ! gvametaconvert name=metaconvert ! gvametapublish name=destination",
		" ! appsink name=appsink"
	],
	"description": "Person Detection based on person-detection-retail-0013 with resolution control",
	"parameters": {
		"type": "object",
		"properties": {
			"detection-properties": {
				"element": {
					"name": "detection",
					"format": "element-properties"
				}
			},
			"detection-device": {
				"element": {
					"name": "detection",
					"property": "device"
				},
				"type": "string",
				"default": "{env[DETECTION_DEVICE]}"
			},
			"width": {
				"type": "integer",
				"minimum": 400,
				"maximum": 600,
				"default": 400
			},
			"height": {
				"type": "integer",
				"minimum": 200,
				"maximum": 400,
				"default": 200
			}
		}
	}
}

Error Message

{"levelname": "ERROR", "asctime": "2022-09-06 07:11:40,206", "message": "Failed to Load Pipeline from: /home/pipeline-server/pipelines/object_detection/person_resolution/pipeline.json", "module": "pipeline_manager"}                                                                                           
{"levelname": "ERROR", "asctime": "2022-09-06 07:11:40,206", "message": "Exception: gst_parse_error: could not parse caps \"video/x-raw,height={parameters[height]},width={parameters[width]}\" (3)", "module": "pipeline_manager"}                                                                               
{"levelname": "ERROR", "asctime": "2022-09-06 07:11:40,208", "message": "Traceback (most recent call last):\n  File \"/home/pipeline-server/server/pipeline_manager.py\", line 108, in _load_pipelines\n 
   self.pipeline_types[config['type']].validate_config(\n  File \"/home/pipeline-server/server/gstreamer_pipeline.py\", line 390, in validate_config\n    pipeline = Gst.parse_launch(template)\ngi.repository.GLib.GError: gst_parse_error: could not parse caps 
\"video/x-raw,height={parameters[height]},width={parameters[width]}\" (3)\n", "module": "pipeline_manager"}

Thanks for posting this issue. Seems like stale/untested documentation. We're looking into a workaround.

We have a fix for this issue and it will be part of next release.

Fixed in 2022.2.0 (v1.0)