Skip to content

Traffic History

Introduction

BrainFrame allows you to analyze the traffic conditions by counting objects in specified zones. You will be able to see the data from the BrainFrame client, or through the REST API. In BrainFrame, there are two metrics to measure the traffic history:

  • total_entered: The total number of objects that have entered the zone
  • total_exited: The total number of objects that have exited the zone

This is a core feature of BrainFrame and is enabled by default. However, you will need to match certain capsule requirements in order to utilize this feature. As the implementation is different, the requirements vary for different types of zones, e.g. regions and lines. For more information about zones, please refer to the documentation.

Regions

In BrainFrame, regions are represented as polygons (more than two coordinates). For a region, total_exited represents the total number of objects that have moved from the inside of the region to the outside, total_entered is the inverse.

You will need an object detector to enable BrainFrame to analyze the traffic. Aotu supplies two starter capsules Detector Person And Vehicle Fast and Detector Person Vehicle Bike Openvino that can satisfy this requirement. As regions are primarily used to analyze enclosed objects, the client only displays the counts of objects that are currently contained within regions.

However, you can retrieve the entire, unabridged counts using get_latest_zone_statuses() or get_zone_status_stream() or the corresponding REST API. You will get a ZoneStatus object:

{
  "2": {
    "Store": {
      "zone": {...},
      "tstamp": 1601450507.8037934,
      "total_entered": {
        "person": 146
      },
      "total_exited": {
        "person": 148
      },
      "within": [],
      "entering": [],
      "exiting": [],
      "alerts": []
    }
  },
  "Screen": {...},
}

In the above example, 146 people have entered the "Store" region, and 148 have exited. (Note: in order to make the example clearer, some fields were removed for succinctness)

Lines

In BrainFrame, lines are a type of zone that only have two coordinates. Similar to regions, total_entered and total_exited represent the number of objects that have moved across the line. You will be able to see the traffic data in the BrainFrame client. For each line, there will be an arrow indicating the "entering" direction of the line.

Similar to regions, you can also get the data through the REST API:

{
  "2": {
    "Street": {
      "zone": {...},
      "tstamp": 1601456309.9824505,
      "total_entered": {
        "person": 20,
      },
      "total_exited": {
        "person": 15,
      },
      "within": [],
      "entering": [],
      "exiting": [],
      "alerts": []
    }
  },
  "Screen": {...},
}

In the example above, 20 people have entered the line named "Street", and 15 people have exited.

As it is difficult to determine the direction of movements using only object detectors, you will also need an object tracker to enable BrainFrame to analyze the trajectory of objects. Some object tracker capsules track encoded detections and will depend on an additional encoding capsule. For example, TrackerPerson will need Encoder Person to work together. On the other hand, Tracker Vehicle doesn't need one as it tracks vehicles using an IOU-based algorithm.

An encoder capsule's name usually starts with Encoder, you can distinguish an encoder by its output type on our download page. If a capsule states Encoded: True in its Output field, it's an encoder. Here are some encoders available on our website:

  • Encoder Person
  • Encoder Person Openvino

Similarly, a tracker capsule's name usually starts with Tracker, and states Tracked: True in its Output field. In addition, if it states Encoded: True in the Required Input field, that means this capsule needs a corresponding object encoder to work. Here are some trackers available on our website:

  • Tracker Person
  • Tracker Vehicle

You can use the following capsules combinations as an example:

  • Detector Person And Vehicle Fast
  • Encoder Person
  • Tracker Person

Or:

  • Detector Person Vehicle Bike Openvino
  • Tracker Vehicle