https://github.com/quartz/aistudio-copterbot
tracking helicopters and hopefully figuring out why they're hovering
https://github.com/quartz/aistudio-copterbot
Last synced: about 2 months ago
JSON representation
tracking helicopters and hopefully figuring out why they're hovering
- Host: GitHub
- URL: https://github.com/quartz/aistudio-copterbot
- Owner: Quartz
- License: mit
- Created: 2019-01-24T22:54:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-06T12:26:08.000Z (over 3 years ago)
- Last Synced: 2025-03-01T11:45:45.266Z (over 1 year ago)
- Language: Jupyter Notebook
- Size: 65.4 MB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NYPD Copterbot
==============
Chop chop chop!
What the f*** is going on here?
-------------------------------
It's a common feeling in New York City. _I got woken up at 4:30 in the morning last night by some damn police helicopter circling like five feet above my apartment_, you say. _Do you know what it was?_ your friend asks, even though they know. You don't have any idea.
This bot aims to help solve that problem, at least a little bit, by:
1. tracking where the NYPD's helicopters are flying -- with ADS-B
2. figuring out when they're hovering -- with machine learning
3. calculating the center point of the circles they make while flying -- with geometry
4. figuring out what happened at that point around that time -- with machine learning
So far, #1, #2 and #3 are at least partially solved.
Fun fact!
---------
Etymologically, _helicopter_ comes from _helix_ + _pteron_ meaning, well, "helix" and "wing" (like a _pterodactyl_). But someone reanalyzed it as _heli_ + _copter_ and now we have _copters_! Wow.
I want to do this myself, for my city.
--------------------------------------
Cool. It's kind of involved but it's totally doable. I believe in you.
1. You need to be able to receive ADSB signals for your area. You need to put a handful of Raspberry Pis with DVB-T receivers in areas with line of sight to most/all of your area. They don't have to all be in the same place. (We have receivers in far northern Manhattan, lower Manhattan and Brooklyn...)
2. Build out a basemap in dump1090-mapper. In New York City, we use parks, airports and rivers/the bay as wayfinding guides. What to use here depends on your city; in Atlanta, I'd use the freeways. Pull requests accepted.
3. Set up one MySQL database for all the receivers to write to.
4. more to come...
The machine learning part of this
---------------------------------
Once we've assembled a decent-sized corpus of helicopter flights, we need figure out how to detect when a helicopter is hovering. We're going to do that with machine learning. In order to do that, we need to give the computer hand-picked examples of helicopters hovering and helicopters doing other non-hovering things. Here's how we do that.
1. Run `ruby generate_images_for_hand_classification.rb` with the appropriate database env vars. This generates a `hover_train_png` folder (and a `hover_train_svg` folder in which you should run a webserver with `python -m http.server` lol sorry this is complicated) with PNGs representing 5 minute long segments of helicopter paths, along with `shingles.csv` with metadata about each segment. (The segments overlap.)
2. Create the `hand_coded_training_data` folder and COPY `hover_train_png` into `hand_coded_training_data/hover_train_png_hover_only` (not move, copy). Then, leaf through the images and delete all the ones that do not depict hovering. Use your judgment.
3. With `generate_training_data_from_handclassified_shingles.rb`, generate `training_data.csv`, which should soon include data about each shingle, plus features we generated. If you use additional `..._hover_only` folders in `hand_coded_training_data` be srue to record them in the Ruby script.
4. Then do some scikitlearn magic...
Matching centerpoints to events
-------------------------------
Experiment. Download from Google sheets [Tweets by NYCFireWire](https://docs.google.com/spreadsheets/d/1Z8kI0FhtHVOSp__CliM-GQjzj8JDue5DR2StBPzQwbo/edit#gid=0). Run `nycfirewire_parser.rb`. Upload the resulting `NYCFireWire_tweets.csv` to the TAMU Batch geocoder. Download that to `NYCFireWire_tw.csv` and you have points for that guy's tweets.
Qz Janky Deployment:
--------------------
`scp -r ../nypdcopterbot/*.rb ec2-user@whatever:/home/ec2-user/nypdcopterbot/`
`scp -r ../dump1090-mapper/*.js ec2-user@whatever:/home/ec2-user/dump1090-mapper/`
https://twitter.com/lb_bklyn/status/970981102188941312