# nerusuniharika/car-damage-detection architecture

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

- Interactive diagram: https://gitdiagram.com/nerusuniharika/car-damage-detection
- Repository: https://github.com/nerusuniharika/car-damage-detection

## Overview

This is a Flask car-damage detection application. Users can sign in, submit an image or MP4 with a confidence threshold, and view detections and damage-severity summaries; they can also view a live webcam stream. The app.py excerpt supports these flows and shows video-result cleanup and optional ffmpeg conversion. The tree also indicates chart, performance, and detection-related views, but their wiring is not shown, so those links are omitted.

Main entry points: [`app.py`](https://github.com/nerusuniharika/car-damage-detection/blob/main/app.py) (Flask routes), [`static/js/app.js`](https://github.com/nerusuniharika/car-damage-detection/blob/main/static/js/app.js) (Browser UI), [`best.pt`](https://github.com/nerusuniharika/car-damage-detection/blob/main/best.pt) (YOLO weights), [`static/results`](https://github.com/nerusuniharika/car-damage-detection/tree/main/static/results) (Video results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_browser["Browser UI<br/>[app.js]"]
  node_login["Sign-in view<br/>[login.html]"]
  node_home["Home view<br/>[first.html]"]
  node_image_view["Image view<br/>[image.html]"]
  node_video_view["Video view<br/>[video.html]"]
  node_webcam_view["Webcam view<br/>[webcam.html]"]
  node_chart_view["Chart view<br/>[chart.html]"]
  node_performance_view["Performance view<br/>[performance.html]"]
end

subgraph group_processing["Detection processing"]
  node_app["Flask routes<br/>[app.py]"]
  node_analysis["Detection summaries<br/>[app.py]"]
  node_weights["YOLO weights<br/>[best.pt]"]
end

subgraph group_media["Media and results"]
  node_uploads[("Upload files")]
  node_results[("Video results")]
end

subgraph group_integrations["External integrations"]
  node_yolo["YOLO inference"]
  node_image_library["Image decoding"]
  node_opencv["OpenCV media"]
  node_camera(("Webcam device"))
  node_ffmpeg["Video conversion"]
end

node_visitor(("User"))

node_visitor -->|"uses"| node_browser
node_browser -->|"submits requests"| node_app
node_app -->|"renders"| node_login
node_app -->|"renders"| node_home
node_app -->|"renders"| node_image_view
node_app -->|"renders"| node_video_view
node_app -->|"renders"| node_webcam_view
node_app -->|"loads"| node_weights
node_app -->|"decodes image"| node_image_library
node_app -->|"reads video"| node_opencv
node_app -->|"captures frames"| node_opencv
node_app -->|"predicts"| node_yolo
node_yolo -->|"uses"| node_weights
node_app -->|"summarizes detections"| node_analysis
node_app -->|"saves upload"| node_uploads
node_app -->|"writes processed video"| node_results
node_app -->|"prunes old files"| node_results
node_app -->|"opens stream"| node_camera
node_app -.->|"converts video"| node_ffmpeg
node_app -->|"renders"| node_chart_view
node_app -->|"renders"| node_performance_view

click node_browser "https://github.com/nerusuniharika/car-damage-detection/blob/main/static/js/app.js"
click node_login "https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/login.html"
click node_home "https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/first.html"
click node_image_view "https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/image.html"
click node_video_view "https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/video.html"
click node_webcam_view "https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/webcam.html"
click node_chart_view "https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/chart.html"
click node_performance_view "https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/performance.html"
click node_app "https://github.com/nerusuniharika/car-damage-detection/blob/main/app.py"
click node_analysis "https://github.com/nerusuniharika/car-damage-detection/blob/main/app.py"
click node_weights "https://github.com/nerusuniharika/car-damage-detection/blob/main/best.pt"
click node_uploads "https://github.com/nerusuniharika/car-damage-detection/tree/main/uploads"
click node_results "https://github.com/nerusuniharika/car-damage-detection/tree/main/static/results"

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_browser,node_login,node_home,node_image_view,node_video_view,node_webcam_view,node_chart_view,node_performance_view,node_visitor toneBlue
class node_app,node_analysis,node_weights toneAmber
class node_uploads,node_results toneMint
class node_yolo,node_image_library,node_opencv,node_camera,node_ffmpeg toneRose
```

## Components

### Web experience

- [Browser UI](https://github.com/nerusuniharika/car-damage-detection/blob/main/static/js/app.js): `static/js/app.js`
- [Sign-in view](https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/login.html): `templates/login.html`
- [Home view](https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/first.html): `templates/first.html`
- [Image view](https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/image.html): `templates/image.html`
- [Video view](https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/video.html): `templates/video.html`
- [Webcam view](https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/webcam.html): `templates/webcam.html`
- [Chart view](https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/chart.html): `templates/chart.html`
- [Performance view](https://github.com/nerusuniharika/car-damage-detection/blob/main/templates/performance.html): `templates/performance.html`

### Detection processing

- [Flask routes](https://github.com/nerusuniharika/car-damage-detection/blob/main/app.py): `app.py`
- [Detection summaries](https://github.com/nerusuniharika/car-damage-detection/blob/main/app.py): `app.py`
- [YOLO weights](https://github.com/nerusuniharika/car-damage-detection/blob/main/best.pt): `best.pt`

### Media and results

- [Upload files](https://github.com/nerusuniharika/car-damage-detection/tree/main/uploads): `uploads`
- [Video results](https://github.com/nerusuniharika/car-damage-detection/tree/main/static/results): `static/results`

### External integrations

- **YOLO inference**
- **Image decoding**
- **OpenCV media**
- **Webcam device**
- **Video conversion**

### Other components

- **User**

## Connections

- User → Browser UI: uses
- Browser UI → Flask routes: submits requests
- Flask routes → Sign-in view: renders
- Flask routes → Home view: renders
- Flask routes → Image view: renders
- Flask routes → Video view: renders
- Flask routes → Webcam view: renders
- Flask routes → YOLO weights: loads
- Flask routes → Image decoding: decodes image
- Flask routes → OpenCV media: reads video
- Flask routes → OpenCV media: captures frames
- Flask routes → YOLO inference: predicts
- YOLO inference → YOLO weights: uses
- Flask routes → Detection summaries: summarizes detections
- Flask routes → Upload files: saves upload
- Flask routes → Video results: writes processed video
- Flask routes → Video results: prunes old files
- Flask routes → Webcam device: opens stream
- Flask routes → Video conversion: converts video
- Flask routes → Chart view: renders
- Flask routes → Performance view: renders
