# **Accident Detection System**
This is an **Accident Detection System** that uses machine learning to detect accidents in video footage. The system consists of a **frontend** built with **Next.js**, a **backend** built with **Flask**, and a **Streamlit admin dashboard** for managing and analyzing accident data.
---
## **Features**
1. **Accident Detection**:
- Detects accidents in uploaded video footage.
- Displays the severity score and accuracy in real-time.
2. **Admin Dashboard**:
- Upload and process video footage.
- View live video analysis with severity and accuracy overlays.
- View accident statistics and data in interactive charts.
3. **Database Integration**:
- Saves accident data (timestamp, location, severity, etc.) to a MySQL database.
4. **Real-Time Notifications**:
- Simulates real-time accident notifications for testing purposes.
---
## **Technologies Used**
- **Frontend**: Next.js
- **Backend**: Flask
- **Admin Dashboard**: Streamlit
- **Machine Learning**: TensorFlow/Keras (for accident detection)
- **Database**: MySQL
- **Video Processing**: OpenCV
---
## **How to Run the Application**
### **1. Prerequisites**
Before running the application, ensure you have the following installed:
- **Python 3.8+**
- **Node.js** (for Next.js frontend)
- **MySQL** (for the database)
- **Git** (optional, for cloning the repository)
---
### **2. Clone the Repository**
Clone the repository to your local machine:
```bash
git clone
github.com
cd RoadGuard-Rwanda
```
---
### **3. Set Up the Backend (Flask)**
1. Navigate to the `backend` folder:
```bash
cd backend
```
2. Install Python dependencies:
```bash
pip install -r requirements.txt
```
3. Set up the MySQL database:
- Create a database named `accident_detection`.
- Update the database credentials in `backend/config.py`.
4. Run the Flask server:
```bash
python app.py
```
The backend will be running at `
localhost`.
---
### **4. Set Up the Fronten …