CoolFace
Apppublic

gphua1/rklb_materials_deploy

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿ” Defect Detection with Vision Transformer

Production-grade defect detection system using state-of-the-art Vision Transformers.

๐Ÿš€ Quick Start

Installation

bash
pip install -r requirements.txt

Training

bash
# Full training
python train.py --epochs 50 --model_type efficient_vit --pretrained

# Quick test (toy mode)
python train.py --toy --epochs 3

Inference

Web Interface (Streamlit)
bash
python app.py --mode web
# Open browser to http://localhost:8501
API Server
bash
python app.py --mode api
# API at http://localhost:8000
# Web UI at http://localhost:8000/interface
Command Line
bash
# Single image
python app.py --mode cli --image path/to/image.png

# Batch processing
python app.py --mode cli --directory path/to/images/ --output results.json

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ app.py              # Main application (Web/API/CLI)
โ”œโ”€โ”€ train.py            # Training pipeline
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ vision_transformer.py  # Model architectures
โ”œโ”€โ”€ data/               # Dataset directory
โ”œโ”€โ”€ requirements.txt    # Dependencies
โ””โ”€โ”€ vercel.json        # Deployment config

๐ŸŒ Deployment

Vercel (Serverless)

bash
vercel --prod

Docker

bash
docker build -t defect-detection .
docker run -p 8000:8000 defect-detection

๐Ÿงช Model Options

  • โ€”efficient_vit: Best accuracy (default)
  • โ€”hybrid_vit: CNN + Transformer hybrid
  • โ€”vit: Standard Vision Transformer
  • โ€”dual_attention_vit: Dual attention mechanism

๐Ÿ“Š Performance

  • โ€”Accuracy: 95%+ on industrial defect datasets
  • โ€”Inference: <100ms per image
  • โ€”Model size: ~350MB (efficient_vit)

๐Ÿ“ License

MIT