This project implements an AI-driven system to systematically analyze police response to illegal parking complaints in New York City. Using computer vision and machine learning techniques, the study leverages publicly available traffic camera feeds to detect illegal parking incidents, automatically file complaints through the NYC 311 system and monitor police responses.
Key findings from the study include:
The code in this repository forms the backbone of the data collection, processing, and analysis pipeline used in the study.
The system requires access to:
Data preprocessing involves:
You need to edit the config.py
and add the following:
username for NYC's 311 portal
password for NYC's 311 portal
API key to for 311 data, must be requested here: https://api-portal.nyc.gov/product#product=NYC-311-Public-Developers
model that you want to use -- in the config, you put either pretrained
or custom
. To go along with that, you will also need the model file as .pt
in this directory, either:
custom.pt
if you use a custom model (custom
)best.pt
if you trained on COCO (pretrained
)CSV of camera information obtained from NYC DOT and from illegal parking incidents via 311:
camera_name
: name of the camera. Can be the DOT identifier or any other name you choose.url
: URL of the camera feed.address
: address of the location of the region of interest.descriptor
: category of the type of illegal parking in the 311 system.description_txt
: short text description of the illegal parking incident.roi
: list of tuples, where each element of the tuple is xy coordinates of the region of interest stored as a tuple.A minimal example of this CSV (included here as cam_test.csv
) looks like:
| camera_name | url | address | descriptor | description_txt | roi | |------------------|-----------------------------------------------------------------------------------------------|-----------------------------------|------------------|----------------------|------------------------------------------------------------------| | QnsBlvd_65Ave | https://webcams.nyctmc.org/api/cameras/e179ded3-4cdc-4110-ac9c-f12c20f9ccad/image | 97-47 QUEENS BOULEVARD, REGO PARK | Blocked Bike Lane | car parked illegally blocking bike lane | [((262.0, 62.0), (0.0, 200.0), (0.0, 240.0), (178.0, 240.0), (246.0, 130.0), (275.0, 66.0), (262.0, 62.0))] |
Ensure Python 3.7+ is installed on your system.
Clone the repository:
git clone [repository_url]
cd [repository_name]
Install required packages:
pip install -r requirements.txt
Configure the config.py
file with appropriate credentials and settings.
Start the monitoring process:
python parking_monitor.py
To modify the study parameters (e.g., observation period, camera selection):
config.py
The system generates:
To reproduce the study:
Note: Exact reproduction may be challenging due to the dynamic nature of urban environments and potential changes in enforcement practices.
Camera Management (camera.py
): Handles interaction with NYC Department of Transportation (DOT) cameras, including region of interest definition and vehicle tracking.
Object Detection (detector.py
): Implements YOLO-based object detection to identify vehicles in camera feeds.
Service Request Automation (service_request.py
): Automates the process of submitting and tracking 311 service requests for illegal parking.
Parking Monitor (parking_monitor.py
): Coordinates the overall monitoring process, including illegal parking detection, complaint submission, and response tracking.
If you use this code, please cite it:
Arnav and Ensari. (2024). 311 Complaints Regarding Illegal Parking. NYU UltraViolet. https://doi.org/10.58153/1vs56-e3h85.
This code is licensed under the AGPL license.