How chando0185/car_parking_detection_space_count works
Project Type and Purpose
• This is a full-stack web application for real-time parking space detection. It has two main phases:
a. Model training/data preparation (offline)
b. Inference & web-serving (online)
Main Components
A. Training Pipeline (offline)
• Data Collection Script (datacollection.py)
• Jupyter Notebook (“Car Parking System Using Deep Learning.ipynb”)
• Training Data Archive (train_data.zip)
• Training Framework (TensorFlow/Keras)
• Output Artifacts:
• Trained CNN Model (model_final.h5)
• Parking-space positions (carposition.pkl)
B. Inference & Serving (online)
1. Video Source
• Local video file (car_test.mp4) or live camera feed
2. Video Processing Module
• Uses OpenCV to read frames and extract regions of interest (ROIs) based on carposition.pkl
3. Classification Module
• Loads trained CNN model (.h5) via TensorFlow/Keras and NumPy
• Classifies each ROI as “car” or “no car”
4. Overlay & Counting Module
5. Flask Web Application
• Routes in main.py (or app.py) define controllers for:
• Homepage (renders templates/index.html)
• /video_feed (streaming MJPEG frames)
• /space_count (JSON API returning current counts)
6. Frontend UI
• HTML template (templates/index.html) displaying live video and counts
7. Dependencies & Config
• requirements.txt (Flask, OpenCV, TensorFlow, Keras, NumPy, Pickle)
Relationships and Data Flow
• Video Source → Video Processing → Classification Module → Overlay/Counting →
• Streamed to Browser via /video_feed
• Count data exposed via /space_count API → Frontend UI
• Offline: Data Collection → Notebook → Model Training → Persist model & positions
Architectural Patterns and Principles
• MVC (Model–View–Controller) in Flask:
• Model: CNN model + parking-position data
• View: HTML template for UI
• Controller: Flask route functions handling video stream & API
• Separation of Concerns: training vs inference; processing pipeline vs web-serving
• Single responsibility: each module does one task (data collection, training, processing, serving)
Essential Elements
• Labels on every component (e.g., “OpenCV Frame Grabber”, “TensorFlow Classifier”)
• Compute modules vs stored artifacts vs external clients