contrastive learning for defect embeddings
**Contrastive Learning for Defect Embeddings** is the **training of a representation model that maps defect images to a feature space where similar defects are close and dissimilar defects are far apart** — creating meaningful defect representations without requiring class labels.
**How Contrastive Learning Works for Defects**
- **Positive Pairs**: Two augmented views of the same defect image are pulled together in embedding space.
- **Negative Pairs**: Views from different defects are pushed apart.
- **Losses**: InfoNCE, NT-Xent, or triplet loss enforces the embedding structure.
- **Frameworks**: SimCLR, MoCo, BYOL, DINO adapted for defect images.
**Why It Matters**
- **No Labels Needed**: Learns useful representations without class labels — purely self-supervised.
- **Downstream Tasks**: Contrastive embeddings transfer to classification, retrieval, and clustering tasks.
- **Defect Retrieval**: Find similar historical defects by nearest-neighbor search in embedding space.
**Contrastive Learning** is **teaching the model defect similarity** — learning to organize defect images by visual similarity without being told the categories.