Updated on 2024-02-29 GMT+08:00

Obtaining Task Results

After a task is executed, obtain the task result based on the output path set during task creation.

If Output Mode is set to Event Center, obtain the task result in Event Center. For details, see Event List.

To obtain the task result when the output mode is DIS or Webhook, follow the steps in this chapter.

Step 1 Obtain the Task Output Path

After a task is executed, click the task name on the task list page and obtain the task output path in the Configure Output tab.

  • Obtain the DIS channel for DIS output mode.
  • Obtain the webhook URL for webhook output mode.

Step 2 Obtain the Task Result

View the task result in the obtained output path.

DIS

  1. Log in to the DIS console.
  2. Click the obtained DIS stream, and check whether any incoming stream is generated.
  3. Obtain the result data through a DIS dump task. For details, see Creating a Dump Task.

Webhook

The service uses a POST request to send the task result, including structured data and images, as data streams in JSON format to the specified webhook URL.

As an example, the script in Starting a Webhook Service saves the webhook message that it receives in the post.txt file, which is in the same folder as the script.

Take the intrusion detection algorithm as an example. The following is an example of the JSON result output by the algorithm, indicating that an intrusion is detected in a specified area in the video.

{
    "event_type":196609,
    "timestamp":1581753322,
    "stream_id":"44000000581314000234#15#9f63890660f24175871c861b345e852d",
    "message_id":"849D1326-4FC8-11EA-8F73-0242AC110004",
    "image_base64":"/9j/4AAQSkZJRgA...",
    "task_id":"63eac48bf3704e8bb30af7f244fdcf3d",
    "data":{
        "event_set":[
            {
                "start_position":"in",
                "end_position":"in",
                "bounding_box":{
                    "y":327,
                    "h":216,
                    "x":876,
                    "w":105
                },
                "category":0,
                "detection_id":"83BFC020-4FC8-11EA-9F93-0242AC110004"
            }
        ]
    }
}

Table 1 JSON result fields

Field

Description

task_id

Task ID.

data

Recognition result output by the task.

bounding_box

Rectangle for the alarm object.

  • x: horizontal coordinate of the upper-left corner of a bounding box
  • y: vertical coordinate of the upper-left corner of a bounding box
  • w: width of a bounding box
  • h: height of a bounding box

detection_id

UUID of the alarm object.

category

Category of the alarm object. The value can be:
  • 0: person
  • 1: vehicle
  • 2: other

start_position

Start position of the intrusion.

  • For an intrusion against a line, the value is the name of the side from where the object enters.
  • For an intrusion into a region, the value is in or out.
    • in: The intrusion starts inside the region.
    • out: The intrusion starts outside the region.

end_position

End position of the intrusion.

  • For an intrusion across a line, the value is the name of the side where the object arrives.
  • For an intrusion into a region, the value is in or out.
    • in: The intrusion ends inside the region.
    • out: The intrusion ends outside the region.