Computer vision system that inspects product images, detects defects with bounding box localization, and generates automated quality control reports.
- 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
- Python 3.11
- FastAPI
- Anthropic Claude
claude-sonnet-4-20250514for vision and report generation - Pydantic v2
- React + Vite + Tailwind CSS
1. Clone and configure:
git clone <repository>
cd corseco-qc
cp .env.example .env
# Add your ANTHROPIC_API_KEY to .env2. Backend (Terminal 1):
cd backend
pip install -r requirements.txt
python -m uvicorn api.main:app --reloadAPI available at: http://localhost:8000
3. Frontend (Terminal 2):
cd frontend
npm install
npm run devFrontend available at: http://localhost:3000
Open http://localhost:3000 in your browser and start inspecting!
| 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 |
curl -X POST http://localhost:8000/inspect/file \
-F "file=@sample.jpg" \
-F "product_type=Furniture" \
-F "industry=Manufacturing"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.
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.
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
cd backend
pytest tests/
python tests/test_with_real_image.pyThe 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.
Once the server is running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
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.