Traffic Counting
Use case for counting traffic on dedicated urban & highway streets with the classification of vehicles according to our Classes/Subclasses


You would like to know the traffic situation of an urban street or highway? SWARM software is providing the solution to get the number of vehicles passing at the street split by object type (Classes) and direction.
In order to efficiently organize and plan strategic infrastructure and traffic installations, gathering accurate and reliable data is key. Our traffic counting solution builds on Artificial Intelligence based software that is designed to detect, count and classify objects taking part in road traffic scenarios such as highways, urban and country roads, broad walks, intersections, and roundabouts. Generated traffic data can be used as an information basis helping decision-making processes in large Smart City projects as well as to answer basic questions about local traffic situations such as:
  • How many trucks are using an inner-city intersection every day?
  • Smart Insights about traffic load — Do I need to expand the road?
  • How many people are driving in the wrong direction?
  • Why/When and Where are people parking/using side strips on the highway?
  • What areas are more frequently used than others on the road?


Technology wise our traffic counting system consists of the following parts: object detection, object tracking, counting objects crossing a virtual line in the field of interest as well as object classification. The following section of this article will briefly describe those pretrained technologies used for traffic counting.

Object Detection

The main task here is to distinguish objects from the background of the video stream. This is accomplished by training our algorithm to recognize a car as an object of interest in contrast to a tree, for example. This computer vision technology deals with localization of the object. While framing the item in the image retrieved from the frames per second out of the analyzed stream, it is correctly labeled with one of the predefined classes.

Object Classification

The recognized objects are furthermore classified to differentiate the different types of vehicles available in traffic. Depending on the weight, axis and other features, the software can distinguish the recognized images from predefined and trained classes. For each item, our machine learning model will provide one of the object classes detected by SWARM as an output.

Object Tracking

Where was the object initially detected, and where did it leave the retrieved camera image? We accomplish to equip you with information to answer to this question. Our software is detecting the same object again and again and in the way tracking it from one frame to the next within the generated stream. The gathered data enables you to visualize the exact way of the object for e.g. generating heat maps, analyzing frequented areas in the scene and/or planning strategic infrastructure needs.

Crossing Virtual Lines

Another technology available in our traffic counting is used to monitor the streamed scene. By manually drawing a virtual line in our Swarm Control Center (SCC), we offer an opportunity to quantify the objects of interest crossing your counting line (CL). When objects are successfully detected and tracked until they reach a CL, our software will be triggering an event, setting the counter for this line accordingly.

Technology Specifics

In traffic counting we distinguish between the following use cases: highway, roundabout, urban traffic and country road. We measure the accuracy values individually for each scene. This way ensures that every new version of our model not only improves accuracy in some usecases but delivers more stable and more accurate measurements across possible scenarios.
Our performance laboratory (“Performance Lab”) is set up like a real-world installation. For each scene, we send a test video from our Happytime RTSP Server to all of our supported devices using an ethernet connection. The following columns will provide an overview about two scenes before we offer the performance values gathered in our accuracy measurement tests.
SWARM Performance Lab structure


When measuring performance of our traffic counting solution, a crucial point is the selection of the scene. We are choosing real-world scenarios from some of our installations as well as publicly available video material. We make sure that accuracy values obtained in our test laboratory reflect real life use cases in the best possible way. All video material used to test performance fulfills the specification requirements, which can be found in our set-up documentation.


Highway Scene for Traffic Counting
  • Scene description: Highway with four lanes
  • Task: Count cars and trucks in both directions
  • Conditions: daylight
  • Camera setup: 1280×720 resolution, 6 m height, 20 m distance
  • Object velocity: 60-130 km/h
  • Objects: >900


Roundabout Scene for Traffic Counting
  • Scene description: Roundabout with four exits
  • Task: Count cars and trucks in all eight directions
  • Conditions: daylight
  • Camera setup: 1280×720 resolution, 4 m height, 30 m distance
  • Object velocity: 5-30 km/h
  • Objects: >100


In order to understand how to interpret our accuracy-numbers, we gave some more technical details on our traffic monitoring solution. The detailed way of our accuracy calculation and an explanation of our test-setup is documented in our “How do we measure Performance” section.
Our Traffic Counting solution acquires an accuracy over 93.59%*.
*SWARM main classes detected only (Person, Rider, Vehicle — PRV)

Application Limitations

In general, there are several reasons why traffic counting systems cannot be expected to reach 100% accuracy. Those reasons can again be split into various categories (technological, environmental and software side) that either lead to missed or over-counts. Given our technical and environmental prerequisites specified in our set-up documentation, we could reveal the following limitations in the provided software.
Wrong Perspective
Object Similarity
  • Crossing line or item behind a big obstacle
  • Object (PRV), with high distance to the camera
  • Camera perspective is not matching our set-up requirements
  • Objects overlap strongly, so our detection model detects more than 1 object as only 1
  • Color and/or shape of Objects are very similar to the background, so our detection model is not able to distinguish between object and background (r.g. grey cars, persons dressed in grey/white)
  • Different objects (classes) look very similar from certain perspectives, e.g. single-unit-trucks are barely distinguishable from articulated-trucks when only seen from the front or behind