This commit is contained in:
Amit Nandi 2025-03-07 23:32:10 +05:30
parent 92d2fd039c
commit e78ac38602
3 changed files with 212 additions and 8 deletions

46
.gitignore vendored Normal file
View file

@ -0,0 +1,46 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Virtual environments
venv/
env/
.venv/
.python-version
# Distribution / packaging
build/
dist/
*.egg-info/
.eggs/
# Logs and local settings
*.log
*.env
.envrc
# Jupyter Notebook checkpoints
.ipynb_checkpoints/
# MyPy cache
.mypy_cache/
# PyTest cache
.pytest_cache/
# Coverage reports
htmlcov/
.coverage
.coverage.*
.cache
# IDE and editor files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace
# macOS and Linux files
.DS_Store
*.swp

34
.idea/workspace.xml generated
View file

@ -4,13 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="85abbeda-8a77-4d5c-b3f2-ff26f9463a91" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/new-plate.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<list default="true" id="85abbeda-8a77-4d5c-b3f2-ff26f9463a91" name="Changes" comment="dcpush">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -63,13 +60,34 @@
<updated>1741367638904</updated>
<workItem from="1741367639868" duration="88000" />
<workItem from="1741367738212" duration="165000" />
<workItem from="1741367912497" duration="1082000" />
<workItem from="1741367912497" duration="2352000" />
</task>
<task id="LOCAL-00001" summary="dcpush">
<option name="closed" value="true" />
<created>1741369090367</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1741369090367</updated>
</task>
<task id="LOCAL-00002" summary="dcpush">
<option name="closed" value="true" />
<created>1741369108114</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1741369108114</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="dcpush" />
<option name="LAST_COMMIT_MESSAGE" value="dcpush" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/new_plate$main.coverage" NAME="main Coverage Results" MODIFIED="1741368772133" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>

140
README.md Normal file
View file

@ -0,0 +1,140 @@
# 🚀 Helmet Violation Detector
A **real-time helmet violation detection system** that identifies motorcycles, detects whether riders are wearing helmets, and reads license plates using **YOLO, PaddleOCR, and OpenCV**.
---
## 📌 Features
- 🏍️ **Motorcycle Detection** (YOLO-based)
- 🎩 **Helmet Detection** (Custom YOLO model)
- 🚶 **Person-Motorcycle Association** (using IoU & aspect ratio similarity)
- 🔍 **License Plate Recognition** (PaddleOCR)
- 🚗 **License Plate Detection** (YOLO-based)
- 🎥 **Real-time Camera Processing** (OpenCV)
- 📊 **Report Generation in Excel** (OpenPyXL)
- 🖥️ **GUI Interface** (PyQt6)
---
## 🛠️ Installation
### 1⃣ Clone the Repository
```bash
git clone https://github.com/yourusername/helmet-violation-detector.git
cd helmet-violation-detector
```
### 2⃣ Set Up Virtual Environment (Recommended)
```bash
python -m venv venv
source venv/bin/activate # On macOS/Linux
.\venv\Scripts\activate.bat # On Windows CMD
.\venv\Scripts\activate.ps1 # On Powershell
```
### 3⃣ Install Dependencies
Ensure you have **Python 3.8+** installed. Then, run:
```bash
pip install -r requirements.txt
```
**🔹 Note:**
1. If you face **PaddleOCR-related dependency issues**, make sure to install **paddlepaddle**:
```bash
pip install paddlepaddle
```
2. If you face **Protobuf related issues**, make sure to install correct version of protobuf (4.25.*):
```bash
pip install protobuf==4.25.*
```
---
## 🚀 Usage
### 🔹 GUI Mode
To launch the **Helmet Violation Detector GUI**, run:
```bash
python main.py
```
### 🔹 Real-time Camera Detection
Click **"Start Real-Time Analysis"** in the GUI to process frames from your webcam.
### 🔹 Processing Images/Videos
1. Click **"Upload Media"** and select an image or video.
2. Click **"Analyze Media"** to process.
3. Click **"Create Report"** to generate an **Excel report**.
4. Click **"Start Real-Time Mode"** to start/stop **analysis on connected webcam/camera feed**.
---
## 📝 Limitations
- Cannot do excel writes in real time mode , however console outs detected number plates at all times
- Model Accuracy depends on presented input source quality and fidelity.
- Currently motorcycle to person association is done however,associations for person to helmet is also required.
---
## ⚙️ Dependencies
This project requires:
- **Python 3.8+**
- **YOLO (Ultralytics)**
- **PaddleOCR**
- **OpenCV**
- **Mediapipe**
- **PyQt6**
- **OpenPyXL (Excel support)**
You can install them using:
```bash
pip install -r requirements.txt
```
---
## 📌 Troubleshooting
### ❓ Facing PaddleOCR Issues?
If you get errors related to `protobuf` or `paddleocr`, try:
```bash
pip install paddlepaddle
```
or
```bash
pip install protobuf==3.20.*
```
---
## 📜 License
This project is licensed under the **Apache 2.0 License**.
---
## 👨‍💻 Author
Developed by **Bitmutex Technologies** 🚀