We can find many public traffic surveillance cameras across the world. Usually, their resolution is reduced to protect privacy and they offer only 10 to 15 s long streams which are updated in 2 to 10 minute intervals. Nevertheless, these cameras are suitable to analyze traffic, detect traffic jams, accidents and many things more. So, let’s build a simple traffic counter.

update: code published on GitHub now

I’m not going to show any annotated footage here since I’m unsure of licenses of these videos - except for TfL. Let’s select a few webcams from a few sources and put them into a csv.

NB!: webcams provided by Verkehrszentrale Hessen change their links on a daily basis

We can simply run a download script that downloads a video once it was updated. I ended up gathering data on December 12th, 2019. I even managed to capture a traffic jam after an accident (but not the accident itself - could have happened on an exit ramp that is outside the field of view).

How do we get the traffic count? Well, we simply run YOLOv3 on it. Be careful. Only YOLOv3 seems to work somehow. If look at the data, we can see that quite many cars are not detected, especially those a bit further away. Furthermore, only YOLOv3 seems to work somehow. tiny-yolov3 does not work. It basically classifies the Autobahn as a person. This is a good example for running a model on data that is extremely different from the distribution of data the original model was trained on.

Main differences:

  • different viewing angle
  • dawn and dusk conditions
  • “dark season”
  • many more vehicles in an image which are less clearly visible
  • reduced image size/some blurriness

So, let’s see what we can detect when filtering the data a bit. What I’ve done here is basically to average the count across each 10 second video.













The recording starts at 07:49UTC+01:00 and ends at 18:42UTC+01:00.

As we can see, we can detect both rush hours and see some variation between a few roads.

NB!: The footage from Piccadilly Circus is so bad from a video quality point of view, that hardly anything is detected without massive pre-processing.

Things I haven’t implemented in this toy example:

  • object tracking
  • trajectory extraction
  • traffic jam/accident detection
  • obstacle on road detection