EL Defect Detection — Training Package
Train a U-Net++ with EfficientNet-B4 encoder for solar cell EL defect segmentation.
Quick Start (RTX 4060 / any CUDA GPU)
# 1. Clone this repo
git clone https://huggingface.co/nithishbasireddy/el-defect-training
cd el-defect-training
# 2. Install dependencies
pip install -r requirements.txt
# 3. Verify setup
python test_setup.py
# 4. Train (auto-downloads E-SCDD dataset)
python train.py
Training takes ~2-3 hours on RTX 4060. Model saves to output/best_model.pth.
After Training
# Run the Streamlit app with your trained model
streamlit run app.py
# → Set model path to "output/best_model.pth" in sidebar
Architecture
- Model: U-Net++ + EfficientNet-B4 + scSE attention (20.9M params)
- Dataset: E-SCDD (903 images, 512×512, 30→5 class remap)
- Loss: 0.5 × Dice + 0.5 × Focal (γ=2.0) — handles severe class imbalance
- Optimizer: AdamW with differential LR (encoder 1e-4, decoder 5e-4)
- AMP: Mixed precision for 8GB VRAM GPUs
Classes (5)
| ID | Name | E-SCDD Labels | Color |
|---|---|---|---|
| 0 | background | 0-8, 21-24, 29 | Black |
| 1 | busbar | 9 | Green |
| 2 | crack | 10, 14 | Blue |
| 3 | dark/inactive | 11, 17, 20 | Red |
| 4 | other_defect | 12,13,15,16,18,19,25-28 | Yellow |
Why U-Net++ over U-Net?
U-Net++ has dense skip connections between encoder and decoder. For thin structures like cracks (often <10px wide), these nested connections preserve fine details that plain U-Net's single skip connections lose. Validated in medical imaging (thin vessels) and industrial inspection.