Skip to content

abhinai2244/ACCIDENT-DETECTION-SYSTEM-USING-CNN-AND-RESNET50

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Thanks for sharing the link! I checked your repository, and based on your current content, structure, and goals, here’s a fully enhanced version of your README.md β€” optimized for clarity, usability, and presentation on GitHub:


# πŸš— Accident Detection System using CNN and ResNet50 in 3D Architecture

A deep learning-based system for real-time accident detection using video frames, leveraging the power of 3D Convolutional Neural Networks (CNN) and a pretrained ResNet50 backbone for efficient feature extraction and classification.

---

## πŸ“Œ Project Overview

This system aims to detect road accidents from video feeds (e.g., CCTV, dashcams) by analyzing sequences of frames. By using a hybrid architecture combining 2D feature extractors (ResNet50) with 3D convolutional layers, the system captures both spatial and temporal patterns to identify accident events with high accuracy.

---

## 🎯 Objectives

- Detect vehicular accidents from real-world videos.
- Utilize pretrained **ResNet50** with **3D CNN** to capture spatiotemporal features.
- Enable real-time classification with camera input or pre-recorded video.
- Provide a base framework for integrating into traffic surveillance or vehicle safety systems.

---

## 🧰 Tech Stack

- **Python 3.x**
- **TensorFlow** / **Keras**
- **OpenCV**
- **NumPy**, **Matplotlib**
- **Jupyter Notebook** (for experimentation)

---

## 🧠 Model Architecture

- Base model: **ResNet50** (pretrained on ImageNet)
- Additional 3D convolutional layers for temporal processing
- Fully connected dense layers for binary classification (Accident vs Normal)
- Trained on labeled video sequences split into frames

---

ACCIDENT-DETECTION-SYSTEM-USING-CNN-AND-RESNET50/
β”œβ”€β”€ accident-classification-pre.ipynb       # Notebook for model training
β”œβ”€β”€ accident-classificationtry.ipynb        # Alternate training/experimentation
β”œβ”€β”€ accident-classification-2pre.ipynb      # Notebook with preprocessing or final version
β”œβ”€β”€ accident_model.json                     # Model architecture (JSON)
β”œβ”€β”€ model.json                              # Additional or alternate model structure
β”œβ”€β”€ camera.py                               # Real-time accident detection using webcam
β”œβ”€β”€ training_history.png                    # Accuracy/loss visualization
β”œβ”€β”€ requirements.txt                        # Dependencies
└── README.md                               # You're here!

## πŸš€ Getting Started

### 1. Clone the repository

```bash
git clone https://github.com/abhinai2244/ACCIDENT-DETECTION-SYSTEM-USING-CNN-AND-RESNET50.git
cd ACCIDENT-DETECTION-SYSTEM-USING-CNN-AND-RESNET50

2. Install dependencies

FOR DATASET USE THIS LINK TO DOWNLOAD : https://drive.google.com/drive/folders/18R_-TVD0jNkAKGhISgW84VfFAXyn_HTe?usp=drive_link

Create a virtual environment (optional but recommended):

python -m venv venv
source venv/bin/activate   # On Windows: venv\Scripts\activate

Install required packages:

pip install -r requirements.txt

🏁 How to Use

▢️ Run real-time detection using camera:

python camera.py

This script captures frames from your webcam and attempts to classify whether an accident is occurring in real-time.

πŸ““ Train or modify the model:

Use one of the Jupyter notebooks (.ipynb) provided:

jupyter notebook accident-classification-pre.ipynb

Follow the cells step-by-step for training, evaluation, and visualization.


πŸ“Š Training Results

The model was trained on sequences of video frames depicting accident and non-accident scenes. You can modify the training data and rerun the notebooks as needed.

Sample result (from training_history.png):

  • Accuracy: ~XX%
  • Loss: ~YY%

(Update with real values after training)


πŸ“ Dataset

Note: The dataset is not included in this repository due to size restrictions.

You can use any video dataset (e.g., dashcam or CCTV) and split it into sequences of frames labeled as Accident or Normal.

To use your own data:

  1. Extract frames from videos using OpenCV.
  2. Label them accordingly and structure them into folders.
  3. Modify the dataset paths in the notebooks or scripts.

πŸ“Έ Sample Output

Training Accuracy and Loss


βœ… To-Do / Improvements

  • Add Streamlit UI for easier demo
  • Integrate more robust dataset (e.g., UCF-Crime, CADP)
  • Upload trained model weights (.h5)
  • Implement video file upload support for offline detection

πŸ“„ License

This project is licensed under the MIT License – see the LICENSE file for details.


πŸ™Œ Credits & Acknowledgements


About

🧠 Accident Detection System using CNN and ResNet50 in 3D Architecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published