# youseef3550/concrete-crack-inspection architecture

> Architecture diagram of the GitHub repository youseef3550/concrete-crack-inspection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/youseef3550/concrete-crack-inspection
- Repository: https://github.com/youseef3550/concrete-crack-inspection

## Overview

This is a classical digital-image-processing system for detecting concrete surface cracks and classifying structural condition. The principal workflow loads an image, runs a selectable pipeline to produce a crack mask and—on the advanced path—morphological measurements and a PASS/MONITOR/FAIL assessment, then presents or evaluates the result. Separate branches support interactive inspection, dataset acquisition, and reproducible benchmarking. Edges reflect the README and shown source references; unsampled modules are included where documented, but uncertain calls are omitted.

Main entry points: [`src/pipeline.py`](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/pipeline.py) (Pipeline Engine), [`experiments/run_experiments.py`](https://github.com/youseef3550/concrete-crack-inspection/blob/main/experiments/run_experiments.py) (Tuning and Ablations), [`app/app.py`](https://github.com/youseef3550/concrete-crack-inspection/blob/main/app/app.py) (Interactive Web Demo), [`src/data.py`](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/data.py) (Image and Mask Loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Image Inputs"]
  node_dataset[("Crack Dataset")]
  node_acquire["Dataset Fetcher<br/>[download_data.py]"]
  node_data_io["Image and Mask Loading<br/>[data.py]"]
end

subgraph group_processing["Image Processing"]
  node_enhance["Spatial Enhancement<br/>[enhancement.py]"]
  node_restore["Noise Restoration<br/>[restoration.py]"]
  node_frequency["Frequency Filtering<br/>[frequency.py]"]
  node_segment["Crack Segmentation<br/>[segmentation.py]"]
  node_pipeline["Pipeline Engine<br/>[pipeline.py]"]
end

subgraph group_assessment["Assessment and Evaluation"]
  node_morph["Morphology and Measurement<br/>[morphology.py]"]
  node_metrics["Image Metrics and RLE<br/>[metrics.py]"]
  node_evaluation["Benchmark and Failure Analysis<br/>[evaluate.py]"]
  node_experiments["Tuning and Ablations<br/>[run_experiments.py]"]
end

subgraph group_interfaces["Inspection Interfaces"]
  node_cli["Single-Image Inspection<br/>[run_pipeline.py]"]
  node_web["Interactive Web Demo<br/>[app.py]"]
end

node_engineer(("Civil Engineer"))
node_image["Concrete Image"]
node_result["Mask and Verdict"]

node_acquire -->|"fetches"| node_dataset
node_dataset -->|"loads pairs"| node_data_io
node_image -->|"submits"| node_cli
node_cli -->|"loads image"| node_data_io
node_cli -->|"runs Pipeline C"| node_pipeline
node_pipeline -->|"enhances"| node_enhance
node_pipeline -->|"filters"| node_frequency
node_pipeline -->|"segments"| node_segment
node_pipeline -->|"measures damage"| node_morph
node_pipeline -->|"produces mask and verdict"| node_result
node_cli -->|"encodes mask"| node_metrics
node_result -->|"reports"| node_engineer
node_engineer -->|"selects image and pipeline"| node_web
node_web -->|"loads samples"| node_data_io
node_web -->|"runs selected pipeline"| node_pipeline
node_web -->|"shows metrics"| node_metrics
node_web -->|"presents inspection"| node_result
node_evaluation -->|"loads and splits data"| node_data_io
node_evaluation -->|"evaluates pipelines"| node_pipeline
node_evaluation -->|"scores predictions"| node_metrics
node_experiments -->|"loads development data"| node_data_io
node_experiments -->|"tunes filters"| node_frequency
node_experiments -->|"tunes thresholds"| node_segment
node_experiments -->|"tunes morphology"| node_morph
node_experiments -->|"scores trials"| node_metrics

click node_dataset "https://github.com/youseef3550/concrete-crack-inspection/tree/main/data"
click node_acquire "https://github.com/youseef3550/concrete-crack-inspection/blob/main/data/download_data.py"
click node_data_io "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/data.py"
click node_enhance "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/enhancement.py"
click node_restore "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/restoration.py"
click node_frequency "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/frequency.py"
click node_segment "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/segmentation.py"
click node_morph "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/morphology.py"
click node_pipeline "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/pipeline.py"
click node_cli "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/run_pipeline.py"
click node_web "https://github.com/youseef3550/concrete-crack-inspection/blob/main/app/app.py"
click node_metrics "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/metrics.py"
click node_evaluation "https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/evaluate.py"
click node_experiments "https://github.com/youseef3550/concrete-crack-inspection/blob/main/experiments/run_experiments.py"

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_dataset,node_acquire,node_data_io toneBlue
class node_enhance,node_restore,node_frequency,node_segment,node_pipeline toneAmber
class node_morph,node_metrics,node_evaluation,node_experiments toneMint
class node_cli,node_web toneRose
class node_engineer,node_image,node_result toneIndigo
```

## Components

### Image Inputs

- [Crack Dataset](https://github.com/youseef3550/concrete-crack-inspection/tree/main/data): `data`
- [Dataset Fetcher](https://github.com/youseef3550/concrete-crack-inspection/blob/main/data/download_data.py): `data/download_data.py`
- [Image and Mask Loading](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/data.py): `src/data.py`

### Image Processing

- [Spatial Enhancement](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/enhancement.py): `src/enhancement.py`
- [Noise Restoration](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/restoration.py): `src/restoration.py`
- [Frequency Filtering](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/frequency.py): `src/frequency.py`
- [Crack Segmentation](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/segmentation.py): `src/segmentation.py`
- [Pipeline Engine](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/pipeline.py): `src/pipeline.py`

### Assessment and Evaluation

- [Morphology and Measurement](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/morphology.py): `src/morphology.py`
- [Image Metrics and RLE](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/metrics.py): `src/metrics.py`
- [Benchmark and Failure Analysis](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/evaluate.py): `src/evaluate.py`
- [Tuning and Ablations](https://github.com/youseef3550/concrete-crack-inspection/blob/main/experiments/run_experiments.py): `experiments/run_experiments.py`

### Inspection Interfaces

- [Single-Image Inspection](https://github.com/youseef3550/concrete-crack-inspection/blob/main/src/run_pipeline.py): `src/run_pipeline.py`
- [Interactive Web Demo](https://github.com/youseef3550/concrete-crack-inspection/blob/main/app/app.py): `app/app.py`

### Other components

- **Civil Engineer**
- **Concrete Image**
- **Mask and Verdict**

## Connections

- Dataset Fetcher → Crack Dataset: fetches (evidence: `README.md`)
- Crack Dataset → Image and Mask Loading: loads pairs (evidence: `README.md`)
- Concrete Image → Single-Image Inspection: submits (evidence: `README.md`)
- Single-Image Inspection → Image and Mask Loading: loads image (evidence: `src/run_pipeline.py`)
- Single-Image Inspection → Pipeline Engine: runs Pipeline C (evidence: `src/run_pipeline.py`)
- Pipeline Engine → Spatial Enhancement: enhances (evidence: `src/pipeline.py`)
- Pipeline Engine → Frequency Filtering: filters (evidence: `src/pipeline.py`)
- Pipeline Engine → Crack Segmentation: segments (evidence: `src/pipeline.py`)
- Pipeline Engine → Morphology and Measurement: measures damage (evidence: `README.md`)
- Pipeline Engine → Mask and Verdict: produces mask and verdict (evidence: `README.md`)
- Single-Image Inspection → Image Metrics and RLE: encodes mask (evidence: `src/run_pipeline.py`)
- Mask and Verdict → Civil Engineer: reports (evidence: `README.md`)
- Civil Engineer → Interactive Web Demo: selects image and pipeline (evidence: `app/app.py`)
- Interactive Web Demo → Image and Mask Loading: loads samples (evidence: `app/app.py`)
- Interactive Web Demo → Pipeline Engine: runs selected pipeline (evidence: `app/app.py`)
- Interactive Web Demo → Image Metrics and RLE: shows metrics (evidence: `app/app.py`)
- Interactive Web Demo → Mask and Verdict: presents inspection (evidence: `README.md`)
- Benchmark and Failure Analysis → Image and Mask Loading: loads and splits data (evidence: `src/evaluate.py`)
- Benchmark and Failure Analysis → Pipeline Engine: evaluates pipelines (evidence: `src/evaluate.py`)
- Benchmark and Failure Analysis → Image Metrics and RLE: scores predictions (evidence: `src/evaluate.py`)
- Tuning and Ablations → Image and Mask Loading: loads development data (evidence: `experiments/run_experiments.py`)
- Tuning and Ablations → Frequency Filtering: tunes filters (evidence: `experiments/run_experiments.py`)
- Tuning and Ablations → Crack Segmentation: tunes thresholds (evidence: `experiments/run_experiments.py`)
- Tuning and Ablations → Morphology and Measurement: tunes morphology (evidence: `experiments/run_experiments.py`)
- Tuning and Ablations → Image Metrics and RLE: scores trials (evidence: `experiments/run_experiments.py`)
