FAF API

Health

health

GET https://faf.traces.cloud/api/v1/health

This endpoint allows to test that service is up

Headers

Name
Type
Description

x-api-key*

string

Authorization API key to access Traces FAF API

ALIVE

Example

curl -X GET https://faf.traces.cloud/api/v1.1/health -H "x-api-key: YOUR_API_KEY"

Operations

filter-alarm

POST https://faf.traces.cloud/api/v1/filter-alarm

Performs alarm filtering and returns alarm type, confidence, and a list of objects that triggered an event with corresponding information. This endpoint accepts any number of frames with a minimum limit of 5 frames per event.

Headers

Name
Type
Description

x-api-key*

string

Authorization API key to access Traces FAF API

Request Body

Name
Type
Description

metadata*

object

A dictionary with the following keys: "event_id", "camera_id", "timestamp"

image_0*

string

frame #1; image file ($binary)

image_1*

string

frame #2; image file ($binary)

image_2*

string

frame #3; image file ($binary)

image_3*

string

frame #4; image file ($binary)

image_4*

string

frame #5; image file ($binary)

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.7892204529672106,
  "triggered_by": [
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        527,
        400,
        827,
        569
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        122,
        399,
        335,
        536
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        202,
        270,
        325,
        337
      ],
      "frame_id": 2,
      "direction": null
    }
  ]
}

Example

An example of a request with 5 frames.

curl -X POST "https://faf.traces.cloud/api/v1.1/filter-alarm"
 -H "accept: */*"
 -H "x-api-key: YOUR_API_KEY"
 -H "Content-Type: multipart/form-data"
 -F "metadata={ "event_id": "ddf27b34-d3b5-41a5-b2a6-3873a589ec09", "camera_id": "b5271b30-aecd-4897-bc95-ff25c8466b9e", "timestamp": 1585840725 }" -F 
"image_0=@customer_frame0.png;type=image/png" -F "image_1=@customer_frame1.png;type=image/png" -F "image_2=@customer_frame2.png;type=image/png" -F "image_3=@customer_frame3.png;type=image/png" -F "image_4=@customer_frame4.png;type=image/png"

An example of a request with 12 frames.

curl -X POST "https://faf.traces.cloud/api/v1.1/filter-alarm"
 -H "accept: */*"
 -H "x-api-key: YOUR_API_KEY"
 -H "Content-Type: multipart/form-data"
 -F "metadata={ "event_id": "ddf27b34-d3b5-41a5-b2a6-3873a589ec09", "camera_id": "b5271b30-aecd-4897-bc95-ff25c8466b9e", "timestamp": 1585840725 }" 
 -F "image_0=@customer_frame0.png;type=image/png" 
 -F "image_1=@customer_frame1.png;type=image/png"
 -F "image_2=@customer_frame2.png;type=image/png" 
 -F "image_3=@customer_frame3.png;type=image/png" 
 -F "image_4=@customer_frame4.png;type=image/png"
 -F "image_5=@customer_frame5.png;type=image/png"
 -F "image_6=@customer_frame6.png;type=image/png"
 -F "image_7=@customer_frame7.png;type=image/png"
 -F "image_8=@customer_frame8.png;type=image/png"
 -F "image_9=@customer_frame9.png;type=image/png"
 -F "image_10=@customer_frame10.png;type=image/png"
 -F "image_11=@customer_frame11.png;type=image/png"

filter-video-alarm

POST https://faf.traces.cloud/api/v1/filter-video-alarm

Performs alarm filtering and returns alarm type, confidence, and a list of objects that triggered an event with corresponding information. This endpoint accepts video files. It is recommended to send a video 10-20 seconds long. Sending videos longer than 30 seconds may result in a prolonged response time.

Headers

Name
Type
Description

x-api-key*

string

Authorization API key to access Traces FAF API

Request Body

Name
Type
Description

video*

string

video file ($binary)

metadata*

object

A dictionary with the following keys: "event_id", "camera_id", "timestamp"

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.7892204529672106,
  "triggered_by": [
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        527,
        400,
        827,
        569
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        122,
        399,
        335,
        536
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        202,
        270,
        325,
        337
      ],
      "frame_id": 2,
      "direction": null
    }
  ]
}

Examples of Alarm Responses to different motion events

Examples of Alarm Responses for customers on a General tier.

Each trigger includes the following information for each frame: 'object_type', 'action', 'bbox', 'frame_id', and 'direction'.

If more information is needed, refer to examples of Alarm Responses on an Advanced tier.

Example of False Alarm

Input data

FAF Response

{
  "alarm_confirmed": false,
  "alarm_confidence": null,
  "triggered_by": []
}

Example of an alarm triggered by a "Person"

Input data

FAF Response

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.7866996370706637,
  "triggered_by": [
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        621,
        1051,
        711,
        1269
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        959,
        1100,
        1031,
        1337
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        718,
        1148,
        815,
        1368
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        769,
        977,
        859,
        1233
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        687,
        971,
        771,
        1189
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        940,
        983,
        1026,
        1217
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        983,
        875,
        1059,
        1086
      ],
      "frame_id": 2,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        833,
        886,
        894,
        1121
      ],
      "frame_id": 2,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        738,
        871,
        816,
        1080
      ],
      "frame_id": 2,
      "direction": null
    }
  ]
}

Example of an alarm triggered by "Vehicle"

Input data

FAF Response

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.7540868690800507,
  "triggered_by": [
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        2084,
        604,
        2420,
        774
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        1433,
        456,
        1723,
        588
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        805,
        514,
        1104,
        699
      ],
      "frame_id": 2,
      "direction": null
    }
  ]
}

Example of an alarm triggered by both "Person" and "Vehicle"

Input data

FAF Response

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.6292241402835548,
  "triggered_by": [
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        677,
        486,
        925,
        653
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        447,
        195,
        496,
        269
      ],
      "frame_id": 0,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        673,
        466,
        923,
        653
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "person",
      "action": "moving",
      "bbox": [
        588,
        393,
        624,
        495
      ],
      "frame_id": 1,
      "direction": null
    },
    {
      "object_type": "vehicle",
      "action": "moving",
      "bbox": [
        584,
        468,
        814,
        620
      ],
      "frame_id": 2,
      "direction": null
    }
  ]
}

Examples of Alarm Responses for customers on an Advanced tier.

Customers on the Advanced tier will receive comprehensive alarm responses that contain all the information from the General tier, as well as additional data fields such as object_class and object_color. These fields provide additional context and insights into the alarm event, enabling customers to quickly and effectively respond to any issues with their system.

The newly introduced object_class field provides supplementary information regarding the specific class of a vehicle that has triggered an alarm. The supported vehicle classes within our API solution include four distinct categories: "car", "truck", "bus", and "motorbike".

The recently added object_color field outlines the color of a vehicle that has triggered an alarm. Our library comprises 147 distinct colors for this purpose. The object_color value is computed for each bounding box associated with a vehicle trigger. It is important to note that factors such as varying lighting conditions and shadows may influence the accuracy of the detected color.

Below are some examples of input data and their corresponding responses with updated structure. These examples showcase the latest changes and improvements to the response format, enabling customers to better understand and utilize our API's features.

Examples of an alarm triggered by both "Vehicle" with extended details.

Example 1.

Input data

FAF Response

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.8125502391157845,
  "triggered_by": [
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        520,
        352,
        714,
        512
      ],
      "frame_id": 0,
      "direction": null,
      "object_color": "slategray"
    },
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        413,
        345,
        574,
        472
      ],
      "frame_id": 1,
      "direction": null,
      "object_color": "slategray"
    },
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        392,
        322,
        511,
        450
      ],
      "frame_id": 2,
      "direction": null,
      "object_color": "slategray"
    }
  ]
}

Example 2.

Input data

FAF Response

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.7021554756882509,
  "triggered_by": [
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        588,
        332,
        672,
        371
      ],
      "frame_id": 0,
      "direction": null,
      "object_color": "darkslateblue"
    },
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        628,
        319,
        709,
        361
      ],
      "frame_id": 1,
      "direction": null,
      "object_color": "darkslateblue"
    },
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        727,
        313,
        826,
        347
      ],
      "frame_id": 2,
      "direction": null,
      "object_color": "darkslateblue"
    }
  ]
}

Example 3.

Input data

FAF Response

{
  "alarm_confirmed": true,
  "alarm_confidence": 0.694689647096008,
  "triggered_by": [
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        1537,
        77,
        1627,
        167
      ],
      "frame_id": 0,
      "direction": null,
      "object_color": "darkslategray"
    },
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        1475,
        137,
        1579,
        238
      ],
      "frame_id": 1,
      "direction": null,
      "object_color": "darkslategray"
    },
    {
      "object_type": "person",
      "object_class": "person",
      "action": "moving",
      "bbox": [
        451,
        482,
        490,
        585
      ],
      "frame_id": 1,
      "direction": null,
      "object_color": null
    },
    {
      "object_type": "vehicle",
      "object_class": "car",
      "action": "moving",
      "bbox": [
        1379,
        201,
        1515,
        316
      ],
      "frame_id": 2,
      "direction": null,
      "object_color": "darkslategray"
    },
    {
      "object_type": "person",
      "object_class": "person",
      "action": "moving",
      "bbox": [
        456,
        476,
        497,
        575
      ],
      "frame_id": 2,
      "direction": null,
      "object_color": null
    }
  ]
}

EventMetadata

Key
Type
Example
Description

camera_id*

str

"b5271b30-aecd-4897-bc95-ff25c8466b9e"

A unique ID number of the video camera. Used for AI auto training pipeline, consensus algorithm, and billing.

timestamp*

int

1585840725

A timestamp in seconds since the epoch

event_id*

str

"ddf27b34-d3b5-41a5-b2a6-3873a589ec09"

A unique ID of the event.

Used for synchronization and AI auto training pipeline

motion_masks

list

[((0, 0), (900, 0),
 (900, 130), (0, 580)), 
 ((1920, 1090), (1920, 500),
 (1000, 1090))]

Last updated