VisionInspect AI is an intelligent industrial quality inspection system that detects surface defects using a custom PatchCore-inspired anomaly detection pipeline with ResNet50 feature extraction. The application provides anomaly visualization through heatmaps, AI-generated inspection reports using Google Gemini, downloadable PDF reports, and an interactive Streamlit dashboard for real-time quality inspection.
๐ https://himanshu-visioninspect-ai.streamlit.app
- ๐ Surface Defect Detection using PatchCore-inspired anomaly detection
- ๐ง Deep Feature Extraction using ResNet50
- ๐ฅ Heatmap Visualization for anomaly localization
- ๐ค AI-generated Inspection Reports using Google Gemini
- ๐ Downloadable PDF Inspection Reports
- ๐ Confidence Score & Anomaly Score
- ๐ฅ Interactive Streamlit Dashboard
- โก CUDA (GPU) Support
- ๐ Modular Project Structure
| Category | Technology |
|---|---|
| Language | Python |
| Deep Learning | PyTorch |
| Backbone | ResNet50 |
| Anomaly Detection | PatchCore-inspired Method |
| Machine Learning | Scikit-learn |
| Computer Vision | OpenCV |
| Dashboard | Streamlit |
| Generative AI | Google Gemini |
| PDF Generation | ReportLab |
| Image Processing | Pillow |
| Numerical Computing | NumPy |
VisionInspect-AI/
โ
โโโ app.py
โโโ train.py
โโโ inference.py
โโโ feature_extractor.py
โโโ patchcore.py
โโโ heatmap.py
โโโ ai_report.py
โโโ pdf_report.py
โโโ test_gemini.py
โ
โโโ models/
โโโ outputs/
โโโ screenshots/
โ
โโโ requirements.txt
โโโ README.md
โโโ .gitignore
โโโ .env
- Python 3.11+
- Windows / Linux / macOS
- CUDA-compatible GPU (Optional)
- Google Gemini API Key
git clone https://github.com/<YOUR_GITHUB_USERNAME>/VisionInspect-AI.git
cd VisionInspect-AIpython -m venv venvActivate it:
.\venv\Scripts\Activate.ps1source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root.
Add:
GEMINI_API_KEY=YOUR_API_KEY
Replace YOUR_API_KEY with your Google Gemini API key.
Run the Streamlit application:
python -m streamlit run app.pyOpen:
http://localhost:8501
To rebuild the Memory Bank and Threshold:
python train.pypython inference.py- Upload an industrial product image.
- Extract deep features using ResNet50.
- Compare extracted features with the PatchCore Memory Bank.
- Compute the anomaly score.
- Generate an anomaly heatmap.
- Produce an AI inspection report using Google Gemini.
- Download a professional PDF inspection report.
Product Image
โ
โผ
ResNet50 Feature Extraction
โ
โผ
PatchCore Memory Bank
โ
โผ
Anomaly Detection
โ
โผ
Heatmap Generation
โ
โผ
Google Gemini AI Report
โ
โผ
PDF Inspection Report
Run:
python -m streamlit run app.pyinstead of:
streamlit run app.pyVerify Python:
where pythonEnsure it points to your active virtual environment.
If the free API quota is exhausted:
- Wait until the quota resets.
- Generate the report again.
- The application automatically shows a fallback report until the API becomes available.
- Multi-product support
- Batch image inspection
- Real-time camera inspection
- Database integration
- Inspection history dashboard
- Cloud deployment
- True PatchCore anomaly localization
Himanshu Singh Patel
VisionInspect AI
AI-Powered Industrial Surface Defect Detection & Intelligent Inspection Assistant
Please consider giving it a โญ on GitHub.



