A real-time parking lot occupancy tracking system that uses YOLO computer vision to monitor parking spots and provides a web-based dashboard for viewing current availability.
- Real-time Computer Vision: Uses YOLOv11 model to detect and track parked vehicles
- Live Web Dashboard: Beautiful, responsive web interface with live updates
- REST API: RESTful endpoints for parking status updates and retrieval
- Visual Indicators: Color-coded occupancy bar (green/yellow/red based on capacity)
- Live Camera Feed: Displays live snapshots from the parking lot camera
- Automatic Updates: Real-time status updates every second
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β parkinglot.py ββββββ app.py ββββββ index.html β
β (CV Processing)β β (Flask API) β β (Web Dashboard) β
β β β β β β
β β’ YOLO Detectionβ β β’ REST API β β β’ Live Updates β
β β’ Spot Trackingβ β β’ Data Storage β β β’ Progress Bar β
β β’ API Updates β β β’ CORS Support β β β’ Live Feed β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
parking/
βββ app.py # Flask web server and API
βββ parkinglot.py # Computer vision processing
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation
βββ models/
β βββ yolo11n.pt # YOLOv11 model weights
βββ resources/
β βββ background.jpg # Dashboard background image
β βββ bounding_boxes.json # Parking spot annotations
β βββ screenshot_to_plot.png # Reference image
βββ static/
β βββ resources/
β βββ background.jpg # Static assets
βββ templates/
β βββ index.html # Web dashboard template
βββ screenshots/
βββ tracked_spots_59.png # Sample output
- Python 3.13 or higher
- Virtual environment (recommended)
- Internet connection for live camera feed
-
Clone the repository
git clone https://github.com/ptrpetro/ParkingLot_Occupancy.git cd parking -
Set up virtual environment
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Start the Flask web server
python app.py
The web dashboard will be available at
http://127.0.0.1:5000 -
Start the computer vision processor (in a new terminal)
python parkinglot.py
-
View the dashboard Open your browser and navigate to
http://127.0.0.1:5000
The web interface provides:
- Live Camera Feed: Real-time snapshots from the Ocean City inlet parking lot
- Occupancy Statistics: Current occupied and available spots
- Visual Progress Bar: Color-coded occupancy indicator
- π’ Green: < 50% occupied
- π‘ Yellow: 50-80% occupied
- π΄ Red: > 80% occupied
- Last Updated: Timestamp of the most recent data update
Returns the current parking status.
Response:
{
"occupied": 23,
"available": 36,
"last_updated": "2025-07-02 14:30:15"
}Updates the parking status (used by the CV processor).
Request Body:
{
"occupied": 23,
"available": 36
}Response:
{
"status": "success",
"data": {
"occupied": 23,
"available": 36,
"last_updated": "2025-07-02 14:30:15"
}
}- Model: YOLOv11 Nano (
yolo11n.pt) - Tracker: BotSORT for improved accuracy
- Detection: Vehicle detection and tracking in parking spots
Parking spots are defined in resources/bounding_boxes.json with bounding box coordinates for each monitored parking space.
Currently configured to monitor the Ocean City inlet parking lot via live stream:
stream_url = "https://t1.ipcamlive.com/timelapses/5aec8d9905b9a/2025-04-06/video.mp4"- Flask 3.1.0: Web framework and API
- Flask-CORS 5.0.0: Cross-origin resource sharing
- OpenCV 4.11.0: Computer vision processing
- Ultralytics 8.3.103: YOLO model implementation
- Requests 2.32.3: HTTP client for API communication
- PyTorch 2.6.0: Deep learning framework
- NumPy 2.1.1: Numerical computing
- Pandas 2.2.3: Data manipulation
- Matplotlib 3.10.1: Plotting and visualization
- Seaborn 0.13.2: Statistical visualization
Modify the stream_url in parkinglot.py:
stream_url = "your_camera_stream_url_here"# Get current status
curl http://127.0.0.1:5000/api/status
# Update parking data
curl -X POST http://127.0.0.1:5000/api/update-parking \
-H "Content-Type: application/json" \
-d '{"occupied": 25, "available": 34}'Update the total number of parking spots in parkinglot.py:
parkingSpots = 59 # Total number of parking spotsModify tracking parameters in the ParkingManagement initialization:
parkingmanager = solutions.ParkingManagement(
model="models/yolo11n.pt",
json_file="resources/bounding_boxes.json",
tracker="botsort.yaml" # or "bytetrack.yaml" for faster processing
)-
"Flask missing" error
pip install flask flask-cors
-
Camera stream not accessible
- Check internet connection
- Verify the stream URL is accessible
- Try using a local video file for testing
-
YOLO model not found
- Ensure
models/yolo11n.ptexists - Download from Ultralytics if missing
- Ensure
-
Permission errors
- Ensure virtual environment is activated
- Check file permissions in the project directory
This project is licensed under the MIT License - see the LICENSE file for details.
- Ultralytics for the YOLO implementation
- Ocean City Live for the parking lot camera feed
- Flask for the web framework
- Tailwind CSS for the responsive UI