Skip to content

hejianzhong0214/industrial-defect-inspection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Industrial Part Surface Defect Inspection and Analysis System

A factory-dashboard application for metal surface defect localization and technician-ready quality diagnosis. The system combines a PyTorch/YOLO-style detector, an OpenAI-compatible LLM report generator, and a Streamlit web interface.

Architecture

data/               Dataset scripts and processing utilities
models/             Deep learning architecture and optional weights
  defect_detector.py
llm/                Prompt templates and OpenAI-compatible API client
  report_generator.py
app.py              Streamlit dashboard
requirements.txt    Python dependencies
run.bat             Windows one-click launcher
run.sh              Linux/macOS one-click launcher

Features

  • Safe CUDA initialization with automatic CPU fallback.
  • YOLOv8-compatible inference path when local weights are available.
  • Deterministic mock inference when weights are missing, returning high-confidence metal-surface defects.
  • OpenAI-compatible LLM API integration through LLM_API_KEY, LLM_BASE_URL, and LLM_MODEL.
  • Factory-dashboard style Streamlit interface with upload, bounding-box visualization, metrics, and quality report output.

Installation

Windows

run.bat

Linux/macOS

chmod +x run.sh
./run.sh

Both launchers create .venv, install dependencies from requirements.txt, and start:

streamlit run app.py

Optional LLM Configuration

Set these environment variables before launch if you want live LLM reports:

export LLM_API_KEY="your-api-key"
export LLM_BASE_URL="https://your-openai-compatible-endpoint/v1"
export LLM_MODEL="your-model-name"

If no API key is configured, the application uses an offline industrial quality report template.

Optional Real Detector Weights

Place trained YOLO weights at:

models/weights/best.pt

If weights are unavailable or fail to load, the detector automatically uses mock mode so the application remains runnable for demos and grading.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors