el-defect-detection / README.md
nithishbasireddy's picture
Upload README.md
32e8b4f verified
---
title: EL Defect Detection System
emoji: πŸ”¬
colorFrom: blue
colorTo: red
sdk: docker
pinned: false
---
# πŸ”¬ EL Defect Detection System
Production-grade electroluminescence (EL) defect detection for solar PV modules.
## Features
- **Upload** any EL image (full module, single cell, any brightness/size)
- **Automatic grid detection** segments modules into individual cells
- **Deep learning** (U-Net with ResNet encoder) detects defects per cell
- **Quantitative analysis**: crack length (mm), dark area (%), severity classification
- **PASS/FAIL decision** with configurable quality thresholds
- **Visual overlays**: color-coded defect masks on original images
- **Downloadable reports** (JSON + overlay images)
## Defect Types Detected
| Color | Defect | Description |
|-------|--------|-------------|
| πŸ”΄ Red | Dark/Inactive | Area disconnected from cell circuit |
| πŸ”΅ Blue | Crack | Micro-crack in silicon |
| πŸ”· Cyan | Cross Crack | Crack at ribbon edge (high importance) |
| 🟒 Green | Busbar | Metal busbar connection (feature) |
## Architecture
```
input image β†’ preprocessing (CLAHE) β†’ grid detection β†’ cell extraction
β†’ U-Net inference β†’ mask cleaning β†’ crack/dark analysis β†’ PASS/FAIL
```
## Technical Details
- **Model**: U-Net with ResNet34 encoder (segmentation_models_pytorch)
- **Loss**: 0.5 Γ— Dice + 0.5 Γ— Weighted CrossEntropy
- **Dataset**: E-SCDD (snt-ubix/e-scdd) β€” 30 classes remapped to 5
- **Preprocessing**: CLAHE, percentile normalization, adaptive denoising
- **Grid Detection**: Projection profiles + FFT periodicity + peak detection
- **Crack Analysis**: Skeletonization + distance transform + false positive filtering
- **Dark Detection**: Adaptive threshold (0.6 Γ— mean intensity)
## Running Locally
```bash
pip install -r requirements.txt
streamlit run src/app/app.py
```
## Training
```bash
python src/train.py --encoder resnet34 --epochs 100 --batch_size 8
```