Automated Illegal Parking Monitor for 311 Based on Publicly Available Data

Study Overview

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:

  • 52.15% of complaints were closed while vehicles were still illegally parked
  • Only 2.87% of complaints resulted in ticket issuance
  • Significant discrepancies between official police resolutions and observed ground truth
  • Identification of persistent illegal parking hotspots across the city

The code in this repository forms the backbone of the data collection, processing, and analysis pipeline used in the study.

Data Requirements

The system requires access to:

  1. NYC Department of Transportation (DOT) traffic camera feeds
  2. NYC 311 service request system

Data preprocessing involves:

  • Defining regions of interest (ROIs) for each camera feed
  • Mapping camera locations and ROIs to physical addresses
  • Configuring complaint categories in the 311 system

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))] |

Installation

  1. Ensure Python 3.7+ is installed on your system.

  2. Clone the repository:

    git clone [repository_url]
    cd [repository_name]
    
  3. Install required packages:

    pip install -r requirements.txt
    
  4. Configure the config.py file with appropriate credentials and settings.

Usage

  1. Start the monitoring process:

    python parking_monitor.py
    
  2. To modify the study parameters (e.g., observation period, camera selection):

    • Update relevant settings in config.py
    • Modify the camera list stored as a csv.

Results & Output

The system generates:

  1. CSV files containing service request details and resolutions
  2. Annotated images showing detected illegal parking incidents
  3. Logs of system activity and errors

Reproducibility

To reproduce the study:

  1. Configure the system with the same camera locations and observation period
  2. Run the monitoring process for the specified duration

Note: Exact reproduction may be challenging due to the dynamic nature of urban environments and potential changes in enforcement practices.

Features

  1. Camera Management (camera.py): Handles interaction with NYC Department of Transportation (DOT) cameras, including region of interest definition and vehicle tracking.

  2. Object Detection (detector.py): Implements YOLO-based object detection to identify vehicles in camera feeds.

  3. Service Request Automation (service_request.py): Automates the process of submitting and tracking 311 service requests for illegal parking.

  4. Parking Monitor (parking_monitor.py): Coordinates the overall monitoring process, including illegal parking detection, complaint submission, and response tracking.

Limitations

  • Limited by the resolution and placement of existing DOT cameras
  • Potential for false positives in challenging lighting conditions or complex urban scenes
  • Assumes consistent interpretation of parking regulations across different areas
  • Does not account for potential variations in enforcement due to special events or emergencies

Citation

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.

License & Distribution

This code is licensed under the AGPL license.