# ahmednasr6770164-ui/crash-detection-cnn architecture

> Architecture diagram of the GitHub repository ahmednasr6770164-ui/crash-detection-cnn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmednasr6770164-ui/crash-detection-cnn
- Repository: https://github.com/ahmednasr6770164-ui/crash-detection-cnn

## Overview

This repository presents an accident/no-accident image classifier, with a Streamlit upload-and-predict workflow and a bundled EfficientNetB0 model. The README also advertises video-based real-time detection, Grad-CAM checks, and email alerts; these are shown as documented capabilities, but their implementation and wiring cannot be confirmed from the sampled source. The notebooks indicate model-development work, but their contents were not inspected.

Main entry points: [`streamlit/app.py`](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py) (Streamlit app), [`streamlit/best_crash_detection_efficientnetb0.keras`](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/best_crash_detection_efficientnetb0.keras) (EfficientNetB0 model), [`README.md`](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/README.md) (Real-time video detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Image inference"]
  node_streamlit_app["Streamlit app<br/>[app.py]"]
  node_image_upload["Image upload<br/>[app.py]"]
  node_preprocess["Image preprocessing<br/>[app.py]"]
  node_predict["Image prediction<br/>[app.py]"]
  node_results["Prediction results<br/>[app.py]"]
end

subgraph group_models["Model assets"]
  node_model_loader["Model loader<br/>[app.py]"]
  node_model["EfficientNetB0 model"]
  node_training_notebook["CNN notebook"]
  node_efficientnet_notebook["EfficientNet notebook"]
  node_crash_notebook["Crash detection notebook"]
end

subgraph group_capabilities["Documented capabilities"]
  node_video_detection["Real-time video detection<br/>[README.md]"]
  node_gradcam["Grad-CAM checks<br/>[README.md]"]
  node_email_alerts["Automated email alerts<br/>[README.md]"]
end

node_user(("User"))
node_email_service["Email service"]

node_user -->|"uses"| node_streamlit_app
node_streamlit_app -->|"loads model"| node_model_loader
node_model_loader -->|"reads"| node_model
node_user -->|"uploads image"| node_image_upload
node_image_upload -->|"provides image"| node_streamlit_app
node_streamlit_app -->|"invokes"| node_predict
node_predict -->|"preprocesses"| node_preprocess
node_predict -->|"runs inference"| node_model
node_predict -->|"returns prediction"| node_results
node_streamlit_app -->|"displays"| node_results
node_video_detection -.->|"uses model"| node_model
node_gradcam -.->|"checks model"| node_model
node_email_alerts -.->|"sends alerts"| node_email_service

click node_streamlit_app "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py"
click node_image_upload "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py"
click node_preprocess "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py"
click node_predict "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py"
click node_results "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py"
click node_model_loader "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py"
click node_model "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/best_crash_detection_efficientnetb0.keras"
click node_training_notebook "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/Accident_Detection_CNN_(2).ipynb"
click node_efficientnet_notebook "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/efficientnet_headRegulaization_headsize.ipynb"
click node_crash_notebook "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/ahmed_crash_detection_cnn.ipynb"
click node_video_detection "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/README.md"
click node_gradcam "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/README.md"
click node_email_alerts "https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/README.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_streamlit_app,node_image_upload,node_preprocess,node_predict,node_results,node_user toneBlue
class node_model_loader,node_model,node_training_notebook,node_efficientnet_notebook,node_crash_notebook toneAmber
class node_video_detection,node_gradcam,node_email_alerts toneMint
class node_email_service toneIndigo
```

## Components

### Image inference

- [Streamlit app](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py): `streamlit/app.py`
- [Image upload](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py): `streamlit/app.py`
- [Image preprocessing](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py): `streamlit/app.py`
- [Image prediction](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py): `streamlit/app.py`
- [Prediction results](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py): `streamlit/app.py`

### Model assets

- [Model loader](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/app.py): `streamlit/app.py`
- [EfficientNetB0 model](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/streamlit/best_crash_detection_efficientnetb0.keras): `streamlit/best_crash_detection_efficientnetb0.keras`
- [CNN notebook](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/Accident_Detection_CNN_(2).ipynb): `Accident_Detection_CNN_(2).ipynb`
- [EfficientNet notebook](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/efficientnet_headRegulaization_headsize.ipynb): `efficientnet_headRegulaization_headsize.ipynb`
- [Crash detection notebook](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/ahmed_crash_detection_cnn.ipynb): `ahmed_crash_detection_cnn.ipynb`

### Documented capabilities

- [Real-time video detection](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/README.md): `README.md`
- [Grad-CAM checks](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/README.md): `README.md`
- [Automated email alerts](https://github.com/ahmednasr6770164-ui/crash-detection-cnn/blob/main/README.md): `README.md`

### Other components

- **User**
- **Email service**

## Connections

- User → Streamlit app: uses
- Streamlit app → Model loader: loads model
- Model loader → EfficientNetB0 model: reads
- User → Image upload: uploads image
- Image upload → Streamlit app: provides image
- Streamlit app → Image prediction: invokes
- Image prediction → Image preprocessing: preprocesses
- Image prediction → EfficientNetB0 model: runs inference
- Image prediction → Prediction results: returns prediction
- Streamlit app → Prediction results: displays
- Real-time video detection → EfficientNetB0 model: uses model
- Grad-CAM checks → EfficientNetB0 model: checks model
- Automated email alerts → Email service: sends alerts
