• Stars
    star
    150
  • Rank 247,323 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    Other
  • Created about 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Using a cell phone video to detect traffic speeds

Guerrilla traffic speed monitoring to inform and push for change

(or: using open source software and readily available tools to see how fast traffic moves on Forbes Ave)

October was a tragic month for the Oakland community in Pittsburgh. Two pedestrians and a cyclist were killed in car crashes within four days of each other. While the collisions are still under investigation, I have a strong suspicion that speed was a major factor in both. The survivability of a crash decreases very dramatically as speed increases from 20 to 40 miles per hour [1].

There's been a number of calls for traffic calming measures along Forbes Avenue, which is one of the few routes east for both cars and cyclists. I was curious what the current average traffic speed is, and if we could strengthen these calls with some real data. Even though there's no public data and I don't have a radar gun, it's possible to collect this myself with just a high vantage point, a cell phone video, and basic computer vision techniques.

The stretch of Forbes Avenue that I'd like to focus on is between Pitt and CMU:

Overview map of Forbes Ave, courtesy of Google Maps

It's here that the road and surrounding area "opens up." The previous 8-10 blocks go through the tightly packed Oakland business district, with timed traffic lights (matching the 25MPH speed limit) at every intersection. Once you reach Schenley Plaza, though, the buildings recede away and there's a sense of freedom. I also believe that the timings of lights change at this point, too, allowing you to exceed 25MPH for the first time since the highway exit. Once you get to the Natural History museum, a fourth travel lane is added on the left and the right lane turns into an unmarked 20ft wide luxury lane. The right side of this lane is intended as a bus stop, but the lack of markings makes it a bit of a free-for-all when there aren't any busses. I believe that all these things contribute to an overall increase in speed.

I don't have a radar gun, but I do have a cell phone and access to the Cathedral of Learning. At about 3:15pm on Friday afternoon, I recorded 10 minutes of traffic on Forbes Ave. The full movie is available on YouTube. Here's a snippet of what this looked like:

Two second snippet of the raw footage

You can see Dippy the Dino on the top left, with Schenley Plaza on the top right, and the intersection with Schenley Drive Extension in between. Unfortunately the trees obscure the section of the road where I think traffic moves the fastest, but there's a great view of about 300ft of the road. I rotated and cropped the image, used basic image processing techniques to detect objects and their locations, converted pixels to real distances, and computed their speeds. The full analysis is documented in the IJulia/Jupyter notebook within this repository as a mini-tutorial. It worked surprisingly well:

The same two second snippet, but rotated, cropped, and annotated with speeds in MPH

Now we can see how fast traffic can move! See the full ten minutes of annotated traffic at YouTube. I've exported the detected positions and speeds of all the vehicles as a CSV file, also posted within this repository. Here's the maximum speeds of all vehicles which got tracked for more than two seconds:

Histogram of vehicle speeds

Two cars were caught going over 40 miles per hour in this 25MPH zone. Ten others were between 35-40 miles per hour. And one oblivious driver ran the red light. Assuming this random 10-minute segment is representative of afternoon traffic, one out of every twenty vehicles exceeds 34 MPH (bootstrapped 95% confidence interval is 33-37 MPH). Were any of these drivers to hit a pedestrian or cyclist, regardless of the fault, there is a significantly greater chance of serious harm or death than if they were following the speed limit. This is strong evidence that the university and city need to work harder at reducing speeds throughout this busy corridor to keep students, pedestrians, cyclists, and drivers alike safe. Working towards comprehensive solutions over the next two to three years is a great goal, but there are small steps that they can take today to make this street a safer place. I think a great first step will be to increase speed awareness with more signs and enforcement.

More Repositories

1

ParallelWorkshop2019

Julia
37
star
2

CovidCountyDash.jl

Julia
27
star
3

Sparklines.jl

A Julia implementation of ▁▂▃▅▂▇ spark: simple printing of unicode trendlines
Julia
11
star
4

MNIST-demo

Julia
8
star
5

AdvancedML

Julia
7
star
6

MachineLearningWorkshop2019

Julia
7
star
7

Signals.jl

An abandoned work-in-progress for a high level Signal type with a common timebase (in seconds) and groups of channels. Deprecated in favor of AxisArrays.jl.
Julia
6
star
8

JuliaHub-Finance

Julia
5
star
9

mmake

A minimal subset of GNU make, implemented in MATLAB for MATLAB.
MATLAB
5
star
10

RaggedArrays.jl

Experimental package for contiguous arrays with one ragged (or jagged) dimension
Julia
5
star
11

Rafts.jl

Julia
4
star
12

dTrebuchet

∂Trebuchet: supplementary code and scratch work for "The impact of differentiable programming: how ∂P is enabling new science in Julia" at SPLASH2020
Julia
4
star
13

TakingImmutabilitySeriously.jl

Julia
3
star
14

mbauman.github.io

my website
HTML
1
star
15

OffsetIndices.jl

Julia
1
star
16

JuliaCon2018

Jupyter Notebook
1
star
17

hsst

Heuristic Spike Sort Tuner
MATLAB
1
star
18

ShawshankRandemption.jl

Prototype for changes to stdlib/Random.jl
Julia
1
star
19

Alberti

An imaginary Cocoa application that parses arbitrary binary data into human-readable data types. Unfortunately abandoned. It will likely languish here until I begin writing my thesis and discover a MATLAB save-figure bug which malforms something in the PDF datastream. At which point I will drop everything, and resume development on this… only to discover that my source code was _terribly_ written! I'll scrap this and start from scratch. And then I'll eventually realize that I'm *still* in grad school, and that I really should get that thesis done. And this will go back to its present state. Woefully incomplete.
Objective-C
1
star