Skip to content

AdhithyanB/Wall-crack-detection

Repository files navigation

Overview

An end-to-end deep learning system for automated wall crack detection, delivering pixel-accurate segmentation to support preventive maintenance and safety assessments in buildings and civil infrastructure. The project packages training, evaluation, and inference into a reproducible pipeline with a ready-to-run sample dataset and a configuration-driven workflow.

Problem

Manual crack inspection is costly, inconsistent, and slow across large surfaces, which delays repairs and increases risk. Traditional edge/threshold methods struggle with texture, lighting variation, hairline cracks, and cluttered backgrounds.

Solution

A U-Net segmentation model with encoder–decoder skip connections produces fine-grained crack masks that localize thin structures at pixel level. The system combines a hybrid BCE+Dice loss, robust augmentations, and IoU/Dice monitoring to stabilize learning on sparse crack pixels.

Data

The repository includes a small synthetic dataset (train/val/test) arranged as images and corresponding single-channel PNG masks for immediate smoke testing. The pipeline also supports public crack datasets (e.g., crack segmentation sets) by organizing them under data/train|val|test with same-stem image–mask pairs.

Model

Core architecture uses a lightweight U-Net with configurable feature widths and input size for flexible performance–speed trade-offs. Final outputs are binarized with a configurable threshold to balance precision and recall for thin cracks.

Training

Training is driven by a YAML config controlling epochs, batch size, image size, learning rate, weight decay, workers, and model features. A ReduceLROnPlateau scheduler adapts learning rates on validation IoU, and the best model is checkpointed automatically when IoU improves.

Metrics

Primary metrics are Intersection over Union (IoU) and Dice/F1, reported per epoch for both training and validation. These metrics reflect overlap quality on sparse crack masks and are robust for imbalanced foreground–background distributions.

Inference

Single-image inference loads the best checkpoint, resizes to the configured input size, predicts a probability map, thresholds to a binary mask, upsamples back to original resolution, and writes both mask and a red overlay visualization. Threshold can be tuned per deployment tolerance.

Engineering

  • Data pipeline: OpenCV/Pillow loading, resizing, and Albumentations-based augmentation.
  • Reproducibility: Seed setting, config-driven paths, and deterministic preprocessing.
  • Usability: Clear folder structure, minimal commands, and defensive type-casts to avoid YAML typing issues.

Results

On the included synthetic data, the model converges quickly and generates visually coherent masks that track thin, meandering crack patterns. With real crack datasets, the same configuration typically yields strong IoU/Dice once images and high-quality binary masks are provided.

How to run

  • Train: python -m src.train --config configs/config.yaml
  • Infer: python -m src.infer --weights outputs/checkpoints/best.pth --image data/test/images/sample_test_0.png --out outputs/preds

Extensions

  • Swap backbones or add attention modules for improved thin-structure recovery.
  • Multi-class masks for crack types/severity or instance segmentation for defect isolation.
  • Lightweight export (ONNX/TensorRT) for edge deployment on phones, drones, or inspection robots.

Impact

By automating crack localization, the system reduces inspection time and subjectivity, enabling earlier interventions, data-driven maintenance scheduling, and improved safety for built environments.

About

An end-to-end deep learning system for automated wall crack detection, delivering pixel-accurate segmentation to support preventive maintenance and safety assessments in buildings and civil infrastructure. The project packages training, evaluation, and inference into a reproducible pipeline with a ready-to-run sample dataset and a configuration

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages