dlstreamer/pipeline-server

Zone counting pipeline can hang when watermarking is enabled

whbruce opened this issue · 1 comments

The following vaclient call results in a pipeline hang. This issue was initially reported by @antoniomtz in #80.

First create a parameter file that enables watermarking, call it object-zone-count-watermark.json

{
    "parameters": {
        "object-zone-count-config": {
            "zones": [
                {
                    "name": "Zone1",
                    "polygon": [[0.01,0.10],[0.005,0.53],[0.11,0.53],[0.095,0.10]]
                },
                {
                    "name": "Zone2",
                    "polygon": [[0.14,0.20],[0.18,0.67],[0.35,0.67],[0.26,0.20]]
                },
                {
                    "name": "Zone3",
                    "polygon": [[0.40,0.30],[0.50,0.83],[0.85,0.83],[0.57,0.30]]
                }
            ],
            "enable_watermark": true
        }
    }
}

Now run vaclient using the parameter file. Although the pipeline hangs after at timestamp=1583333333, pressing CTRL+C causes vaclient to stop it

$ vaclient/vaclient.sh run object_detection/object_zone_count https://github.com/intel-iot-devkit/sample-videos/blob/master/person-bicycle-car-detection.mp4?raw=true --parameter-file vaclient/parameter_files/object-zone-count-watermark.json
Starting pipeline...
Pipeline running: object_detection/object_zone_count, instance = 1
<snip>
Timestamp 1583333333
- Zone1 (0.00) [0.01, 0.10, 0.02, 0.11]
-  (0.00) [0.00, 0.53, 0.01, 0.53]
-  (0.00) [0.11, 0.53, 0.12, 0.53]
-  (0.00) [0.09, 0.10, 0.10, 0.11]
- Zone2 (0.00) [0.14, 0.20, 0.15, 0.21]
-  (0.00) [0.18, 0.67, 0.19, 0.68]
-  (0.00) [0.35, 0.67, 0.36, 0.68]
-  (0.00) [0.26, 0.20, 0.27, 0.21]
- Zone3 (0.00) [0.40, 0.30, 0.41, 0.31]
-  (0.00) [0.50, 0.83, 0.51, 0.84]
-  (0.00) [0.85, 0.83, 0.86, 0.84]
-  (0.00) [0.57, 0.30, 0.58, 0.31]
<no more output>
^C
Stopping Pipeline...
Pipeline stopped
avg_fps: 0.51

To fix it you must edit extensions/spatial_analytics/object_zone_count.py#L46 to conditionally call the zone detect function as follows

                    if not detected_object.label().startswith(zone["name"]):
                        zone_status = self._detect_zone_count(frame, detected_object, zone)
                        if zone_status:
                            statuses.append(zone_status)
                            related_objects.append(object_index)

Fixed in v0.6.1