Skip to content

codezenithdev/corseco-qc-assessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corseco QC — AI-Powered Quality Inspection System

Computer vision system that inspects product images, detects defects with bounding box localization, and generates automated quality control reports.

Features

  • Single and batch image inspection
  • Defect classification as Good Quality, Minor Defect, Major Defect
  • Bounding box localization for each detected defect
  • AI-generated professional inspection reports
  • Multi-image aggregation with consistency detection
  • REST API with OpenAPI docs
  • React dashboard with visual defect overlay

Tech Stack

  • Python 3.11
  • FastAPI
  • Anthropic Claude claude-sonnet-4-20250514 for vision and report generation
  • Pydantic v2
  • React + Vite + Tailwind CSS

Quick Start

Setup

1. Clone and configure:

git clone <repository>
cd corseco-qc
cp .env.example .env
# Add your ANTHROPIC_API_KEY to .env

2. Backend (Terminal 1):

cd backend
pip install -r requirements.txt
python -m uvicorn api.main:app --reload

API available at: http://localhost:8000

3. Frontend (Terminal 2):

cd frontend
npm install
npm run dev

Frontend available at: http://localhost:3000

Open http://localhost:3000 in your browser and start inspecting!

API Reference

Method Endpoint Description
POST /inspect Inspect a single image (JSON or multipart)
POST /inspect/file Inspect a single image via file upload
POST /inspect/batch Inspect multiple images of the same product
GET /inspect/demo Get a demo inspection result without uploading
GET /health Health check endpoint

Example: Inspect Image via File Upload

curl -X POST http://localhost:8000/inspect/file \
  -F "file=@sample.jpg" \
  -F "product_type=Furniture" \
  -F "industry=Manufacturing"

Example Output

Inspection Result: FAIL
Overall Classification: Major Defect
Confidence Score: 92%
Recommended Action: REJECT

DETECTED ISSUES:
- Surface crack on upper-right panel (major)
- Discoloration on center surface (minor)

ASSESSMENT:
The product shows significant structural damage in the form of a surface crack spanning approximately 15% of the upper panel. Additional discoloration suggests possible material degradation.

INSPECTOR NOTES:
Product should be rejected and removed from inventory. Recommend reviewing upstream production process for root cause.

Edge Device Deployment

For production edge deployment, the Claude Vision API calls would be replaced with a quantized YOLO v8 or EfficientDet model fine-tuned on domain-specific defect images. The model would be exported to ONNX format and quantized to INT8 using TensorRT for Nvidia Jetson devices or ONNX Runtime for CPU-only devices like Raspberry Pi.

The report generation LLM would be replaced with a locally running Llama 3.2 3B model using llama.cpp or Ollama. This hybrid architecture would have edge devices handle real-time defect detection and classification while cloud handles report generation and data aggregation when connectivity is available.

Model updates would be pushed over the air using delta compression when devices reconnect to the internet. This approach enables offline operation with periodic sync to cloud infrastructure for continuous improvement and compliance tracking. The edge solution would support multiple inference backends (TensorRT, ONNX Runtime, CoreML) for maximum hardware compatibility.

Project Structure

corseco-qc/
├── backend/
│   ├── api/
│   │   ├── __init__.py
│   │   ├── config.py
│   │   ├── inspector.py          # Vision analysis and defect detection
│   │   ├── main.py               # FastAPI application
│   │   ├── models.py             # Pydantic models
│   │   └── reporter.py           # Report generation
│   ├── tests/
│   │   ├── test_inspector.py
│   │   └── test_with_real_image.py
│   ├── sample_images/
│   ├── requirements.txt
│   └── run_server.py
├── frontend/
│   ├── src/
│   │   ├── components/
│   │   │   ├── BatchUpload.jsx
│   │   │   ├── ImageCanvas.jsx
│   │   │   ├── InspectionReport.jsx
│   │   │   ├── StatusBadge.jsx
│   │   │   └── UploadZone.jsx
│   │   ├── pages/
│   │   │   ├── BatchInspect.jsx
│   │   │   └── Home.jsx
│   │   ├── App.jsx
│   │   ├── index.css
│   │   ├── main.jsx
│   │   ├── vite.config.js
│   │   ├── tailwind.config.js
│   │   ├── postcss.config.js
│   │   └── package.json
├── .env.example
├── .env
├── .gitignore
└── README.md

Running Tests

cd backend
pytest tests/
python tests/test_with_real_image.py

Environment Variables

The following environment variables are required:

  • ANTHROPIC_API_KEY: Your Anthropic API key for Claude Vision

Copy .env.example to .env and populate with your actual API key.

API Documentation

Once the server is running, visit:

Development

The frontend development server proxies API requests to http://localhost:8000, eliminating CORS issues during development.

To test with demo data without uploading images, use the /inspect/demo endpoint which returns realistic inspection results.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors