An AI-powered smart parking system using YOLOv8, OpenCV, and Flask to provide real-time slot detection and navigation.
- Real-time Object Detection: Uses a custom-trained YOLOv8 model to detect free (
free) and occupied (car) spots. - Live Video Streaming: The Flask backend (
api_server.py) streams the processed video feed directly to the web dashboard. - Dynamic Dashboard: The frontend (
features.html) polls a JSON API (/api/status) to display real-time counts. - Navigation Guidance: Calculates the vector from an entry point to the nearest free slot and provides simple directions.
- Futuristic UI: A modern frontend built with HTML, Tailwind CSS, and vanilla JavaScript.
- Backend: Python, Flask, Flask-CORS
- AI/CV: Ultralytics YOLOv8, OpenCV
- Frontend: HTML5, Tailwind CSS, Vanilla JavaScript
-
Clone the repository:
git clone [https://github.com/your-username/swift-slot-ai-parking.git](https://github.com/your-username/swift-slot-ai-parking.git) cd swift-slot-ai-parking -
Create and activate a virtual environment:
# On macOS/Linux python3 -m venv venv source venv/bin/activate # On Windows python -m venv venv .\venv\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
Before running the server, you must configure the entry points for your video feeds.
- Open
api_server.py. - Find the
ENTRY_POINTSdictionary. - Update the
(x, y)coordinates for each video source to match the location of the "entry" gate in your video.# Example: ENTRY_POINTS = { "North_Lot": (320, 480), # <-- CHANGE THIS "South_Garage": (100, 450), # <-- CHANGE THIS "East_Field": (600, 450), # <-- CHANGE THIS }
-
Start the Flask server:
python api_server.py
-
View the application:
- This project does not currently serve the frontend. The easiest way is to open the
features.htmlfile directly in your browser. - (See "Professional Improvements" below for how to serve this file from Flask).
- This project does not currently serve the frontend. The easiest way is to open the