Skip to content

mrigankad/Ussop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ussop Logo

Ussop Visual Inspection Engine

"I am the Sniper King!" β€” Ussop's precision, now for your production line.

Status Python FastAPI React License

Ussop is a premium, production-ready AI visual inspection system that combines high-speed object detection (Faster R-CNN) with precise edge segmentation (NanoSAM) to automate quality control in industrial manufacturing environmentsβ€”all engineered to run exceptionally fast on standard CPUs.

🌟 Key Features

βœ… CPU-Only β€” No GPU required, runs on standard industrial PCs βœ… Fast Deployment β€” Hours to deploy, not months βœ… Precise Segmentation β€” SAM masks enable accurate measurements βœ… Cost-Effective β€” 1/3 the price of competitors like Cognex βœ… Industrial Grade β€” Modbus TCP, MQTT, OPC-UA, REST API βœ… Production Ready β€” 70+ API endpoints, JWT auth, audit logging βœ… Premium UI/UX β€” Modern 'OS-in-Browser' TypeScript dashboard with fluid light & dark modes βœ… Real-Time Telemetry β€” Live WebSockets rendering advanced Chart.js KPI analytics βœ… Multi-Station Fleet β€” Centralized panoramic overview across all connected production lines βœ… AI Query β€” Natural language questions about your inspection data βœ… On-Device Retraining β€” Fine-tune models from active-learning annotations


πŸ’» Modern Tech Stack

Frontend (OS-in-Browser UI)
  • React 18 (Vite + TypeScript)
  • Tailwind CSS (Custom Olive Brand Tokens, Fluid Typography, 12px Radii System)
  • Radix UI & Phosphor Icons (Accessible, Premium Aesthetics)
  • Chart.js (Real-time Analytics, Scatter Plots & Pareto Visualizations)
Backend (Performant Web Engine)
  • FastAPI (Async, high-throughput REST + WebSockets)
  • SQLAlchemy & Alembic (Robust ORM & Database Migrations)
  • PyJWT (Secure RBAC Authentication & Session Management)
  • Redis & Prometheus (Caching and Real-time Telemetry)
AI & Computer Vision Core
  • PyTorch & OpenVINO (CPU-Optimized Inference Engine)
  • Faster R-CNN (Real-time Defect Object Detection)
  • NanoSAM (Sub-millisecond Instance Segmentation)
  • Transformers/VLM (Natural Language Scene Understanding)

πŸ—οΈ Technical Architecture

graph TD
    classDef frontend fill:#4EA5D9,stroke:#333,stroke-width:2px,color:#fff;
    classDef core fill:#2A4494,stroke:#333,stroke-width:2px,color:#fff;
    classDef ml fill:#F05D5E,stroke:#333,stroke-width:2px,color:#fff;
    classDef storage fill:#2892D7,stroke:#333,stroke-width:2px,color:#fff;
    classDef ext fill:#44CFCB,stroke:#333,stroke-width:2px,color:#fff;

    UI(React SPA Dashboard):::frontend
    API(FastAPI Backend):::core
    
    subgraph Inspection Engine
        Det(Faster-RCNN Detection):::ml
        Seg(NanoSAM Segmentation):::ml
        OV(OpenVINO Optimizer):::ml
    end
    
    subgraph Services
        AL(Active Learning):::core
        VLM(Vision Language Model):::core
        Wkr(Background Workers):::core
    end
    
    subgraph Storage layer
        DB[(PostgreSQL / SQLite)]:::storage
        Cach[(Redis Cache)]:::storage
        FS[(Local Image Storage)]:::storage
    end

    subgraph Hardware & Integrations
        Cam[Cameras / CCTV]:::ext
        PLC[Modbus / OPC-UA / MQTT]:::ext
    end

    UI <-->|REST & WebSockets| API
    Cam -->|Image Streams| API
    API <--> Det
    Det --> Seg
    Seg --> OV
    API <--> AL
    API <--> VLM
    
    API <--> Cach
    API <--> DB
    API <--> FS
    
    Wkr <--> DB
    Wkr <--> Cach
    
    API -->|Hardware Signals| PLC
Loading

πŸ”„ Inspection Workflow

sequenceDiagram
    participant Cam as Camera
    participant API as Server (FastAPI)
    participant ML as Inspector (CV)
    participant DB as Database
    participant UI as Dashboard (WebSockets)
    participant EXT as PLC / OPC-UA

    Cam->>API: 1. Send Frame (Trigger)
    API->>ML: 2. Process Image
    Note over ML: Detect Objects (Faster R-CNN)
    Note over ML: Generate Masks (NanoSAM)
    Note over ML: AI Query Description (VLM)
    ML-->>API: 3. Inspection Results
    API->>DB: 4. Save Record & Images
    API->>EXT: 5. Signal Modbus/OPC-UA/MQTT
    API->>UI: 6. Push Live Update (WS)
Loading

πŸš€ Quick Start

Option 1: Docker Compose (Recommended)

cp .env.example .env        # fill in secrets
docker compose -f docker/docker-compose.yml up -d
# API:     http://localhost:8080
# UI:      http://localhost:8080
# Grafana: http://localhost:3001  (admin / admin)

Option 2: Python (Development)

# 1. Download models
python scripts/download_models.py

# 2. Install dependencies
pip install -e ".[full]"

# 3. Setup database
python scripts/migrate.py upgrade

# 4. Start API
cd ussop && python run.py

# 5. Start frontend dev server (separate terminal)
cd ussop/frontend && npm install && npm run dev

# Access at http://localhost:8080

πŸ“ Project Structure

ussop-project/
β”œβ”€β”€ ussop/                      # Production application package
β”‚   β”œβ”€β”€ api/                    # FastAPI app + 70+ endpoints
β”‚   β”œβ”€β”€ services/               # Core domain services (inspector, models, etc.)
β”‚   β”œβ”€β”€ integrations/           # Modbus TCP, MQTT, Webhooks, OPC-UA server
β”‚   β”œβ”€β”€ models/                 # SQLAlchemy ORM (9 tables)
β”‚   β”œβ”€β”€ config/                 # Pydantic settings loading
β”‚   β”œβ”€β”€ frontend/               # React 18 + TypeScript + Vite SPA
β”‚   β”œβ”€β”€ tests/                  # 437 tests across 13 files β€” all passing
β”‚   β”œβ”€β”€ worker.py               # Background workers (batch, training, alerts)
β”‚   └── run.py                  # Application entry point
β”œβ”€β”€ alembic/                    # Database migrations
β”œβ”€β”€ docs/                       # Comprehensive documentation
β”œβ”€β”€ examples/                   # Reference implementations (legacy ML code)
β”œβ”€β”€ scripts/                    # Utility scripts (download_models.py, migrate.py)
β”œβ”€β”€ docker/                     # Docker configuration (Nginx, Prometheus, Grafana)
β”œβ”€β”€ pyproject.toml              # Dependencies (PEP 517)
β”œβ”€β”€ .env.example                # Configuration template
└── README.md                   # This file

πŸ“š Documentation

Document Description
API Reference All REST + WebSocket endpoints
Deployment Guide Docker + bare-metal setup
Customer Onboarding 8-step go-live guide
Architecture Technical design
Roadmap Product roadmap

βš™οΈ System Requirements

  • Minimum: Intel Core i5-10400 (6+ cores), 16GB RAM, 256GB SSD, Win10/Ubuntu 20.04
  • Recommended: Intel Core i7-12700 (12 cores), 32GB RAM, 512GB NVMe SSD, Ubuntu 22.04 LTS

πŸ”Œ Core API Endpoints

Interactive Swagger docs available at http://localhost:8080/docs

Method Path Description
POST /api/v1/inspect Upload and inspect image
GET /api/v1/inspections List inspection history
GET /api/v1/statistics Dashboard statistics (cached 30s)
POST /api/v1/query Natural language query
POST /api/v1/models/deploy Hot-swap inference model
GET /api/v1/opcua/status OPC-UA server status
WS /ws/dashboard Real-time dashboard push

πŸ› οΈ Testing & Performance

  • Inference: < 1s on Intel i5 (MobileNet + NanoSAM)
  • Throughput: 30+ inspections/minute
  • Accuracy: > 85% mAP (Detection), > 80% IoU (Segmentation)
# Run all tests (437 passing tests)
cd ussop
pytest tests/ -v

🀝 Contributing

  1. Create a branch: git checkout -b feature/name
  2. Make changes and test: pytest tests/ -v
  3. Commit: git commit -am "Add feature"
  4. Push and open a Pull Request

πŸ“„ License

  • License: MIT License β€” See LICENSE file for details.

Ussop v2.0 β€” Sniper precision. Enterprise ready. "Every defect is a target, and we never miss."

About

A premium, production-ready AI visual inspection engine for manufacturing. Combines Faster R-CNN detection and NanoSAM segmentation to run state-of-the-art anomaly detection entirely on standard CPUs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors