AI-Powered Industrial Defect Inspection Platform
Binary Segmentation • Defect Analysis • Severity Assessment • Automated Reporting
SegAgent-AI transforms a research-grade surface defect segmentation model into a deployable industrial inspection platform.
The system enables users to upload inspection images, perform automated binary defect segmentation, calculate defect statistics, assess severity levels, and generate downloadable inspection reports through both a web dashboard and REST API.
This project was developed to bridge the gap between academic deep learning research and production-ready AI inspection systems.
The project is deployed on a Microsoft Azure virtual machine.
http://72.155.89.101:8501
API documentation:
http://72.155.89.101:8000/docs
Note: The live demo may be temporarily unavailable to reduce cloud credit usage.
Industrial surface inspection often relies on manual visual assessment, which can be:
- Time-consuming
- Subjective
- Error-prone
- Difficult to scale
Although modern deep learning models can accurately segment defects, many research implementations remain limited to notebooks, offline experiments, or local scripts.
SegAgent-AI addresses this challenge by providing a complete workflow from image upload to segmentation, defect analysis, severity assessment, and automated reporting.
The primary objectives of this project are:
- Detect defective regions using deep learning-based binary segmentation
- Generate binary segmentation masks automatically
- Produce probability maps for model confidence visualization
- Calculate defect area, defect pixels, and area percentage
- Assess defect severity automatically
- Generate downloadable HTML inspection reports
- Provide REST API access for external integration
- Deliver an interactive web dashboard
- Support reproducible deployment using Docker
- Deploy the system on Microsoft Azure
Input Image
│
▼
Segmentation Model
│
▼
Binary Mask Generation
│
▼
Defect Analysis
│
▼
Severity Assessment
│
▼
Report Generation
│
▼
Web Dashboard / REST API
The segmentation model used in SegAgent-AI was trained on the SD-Saliency-900 dataset, a benchmark dataset for industrial surface defect segmentation.
Dataset characteristics:
- 900 industrial inspection images
- Pixel-level defect annotations
- Binary segmentation task
- Various defect types and defect sizes
- Designed for surface defect detection and segmentation research
The model predicts:
- Binary defect masks
- Defect area percentage
- Defect severity level
- Overlay visualizations
- Inspection reports
| Feature | Description |
|---|---|
| Binary Segmentation | Detects defective regions using a trained deep learning segmentation model |
| Probability Map Generation | Produces pixel-level confidence maps |
| Defect Area Analysis | Computes defect area percentage and pixel-level statistics |
| Severity Assessment | Automatically estimates defect severity levels |
| Automated Reporting | Generates downloadable HTML inspection reports |
| REST API | Provides model access through FastAPI endpoints |
| Interactive Dashboard | Streamlit-based web interface for image upload and result visualization |
| Docker Deployment | Fully containerized deployment environment |
| Cloud Deployment | Deployed on Microsoft Azure VM |
| Layer | Technologies |
|---|---|
| Deep Learning | PyTorch, Swin Transformer, Custom CNN Encoder |
| Computer Vision | OpenCV, NumPy |
| Backend API | FastAPI, Uvicorn |
| Frontend | Streamlit |
| Reporting | HTML Report Generation |
| Containerization | Docker |
| Cloud Deployment | Microsoft Azure Virtual Machine |
| Model Hosting | Hugging Face |
| Development | Python 3.11 |
| Version Control | Git, GitHub |
| Dataset | SD-Saliency-900 |
SegAgent-AI
│
├── app
│ ├── model
│ ├── agents
│ └── utils
│
├── streamlit_app
│
├── sample_images
│
├── assets
│
├── Dockerfile
├── requirements.txt
├── .dockerignore
├── .gitignore
└── README.md
| Original Image | Binary Mask | Overlay Result |
|---|---|---|
![]() |
![]() |
![]() |
The generated report includes:
- Defect area statistics
- Severity assessment
- Segmentation visualizations
- Automated recommendations
- Inspection summary
git clone https://github.com/rasoulameri/SegAgent-AI.git
cd SegAgent-AIpip install -r requirements.txtDue to GitHub file size limitations, the trained model weights are hosted on Hugging Face.
Download the model weights from:
https://huggingface.co/rasoulameri/SegAgent-AI/resolve/main/weights_class.model
Place the downloaded file in:
app/model/weights_class.model
You can also download the weights directly using:
wget -O app/model/weights_class.model \
https://huggingface.co/rasoulameri/SegAgent-AI/resolve/main/weights_class.modelOpen a terminal and run:
cd SegAgent-AI
uvicorn app.main:app --reload --port 8001The FastAPI documentation will be available at:
http://127.0.0.1:8001/docs
Open a second terminal and run:
cd SegAgent-AI/frontend
npm install
npm run devThe React dashboard will be available at:
http://localhost:5173
- Open the dashboard in your browser.
- Upload an inspection image.
- Click Analyze Image.
- Review the generated mask, overlay visualization, defect statistics, severity assessment, and inspection report.
curl -X POST "http://127.0.0.1:8000/predict" \
-F "file=@sample_images/sample1.bmp"Example response:
{
"status": "success",
"analysis": {
"defect_detected": true,
"defect_area_percent": 1.73,
"severity": "Low"
}
}docker build -t segagent-ai .docker run -p 8000:8000 -p 8501:8501 segagent-aiDashboard:
http://localhost:8501
API documentation:
http://localhost:8000/docs
The project was deployed on a Microsoft Azure virtual machine using Docker.
Deployment workflow:
GitHub Repository
│
▼
Azure Virtual Machine
│
▼
Docker Container
│
├── FastAPI Backend
└── Streamlit Dashboard
Main deployment steps:
git clone https://github.com/rasoulameri/SegAgent-AI.git
cd SegAgent-AI
wget -O app/model/weights_class.model \
https://huggingface.co/rasoulameri/SegAgent-AI/resolve/main/weights_class.model
docker build -t segagent-ai .
docker run -p 8000:8000 -p 8501:8501 segagent-ai- Binary segmentation inference
- Probability map generation
- Defect area estimation
- Defect pixel statistics
- Severity assessment
- Automated HTML report generation
- FastAPI REST API
- Interactive Streamlit dashboard
- Dockerized deployment
- Microsoft Azure deployment
- Professional React / Next.js dashboard
- Inspection history database
- Multi-user authentication
- PDF report generation
- Batch image processing
- Azure Blob Storage integration
- Persistent report storage
- Automated deployment pipeline
- Monitoring and logging
- Explainable AI module
- Agentic decision-support framework
- Advanced severity analysis
- Maintenance recommendation engine
This project is inspired by my research in industrial surface defect detection and segmentation using deep learning and computer vision techniques.
The development of SegAgent-AI has been influenced by insights gained from the following publications:
-
Ameri, R., Hsu, C.-C., & Band, S. S. (2024). A systematic review of deep learning approaches for surface defect detection in industrial applications. Engineering Applications of Artificial Intelligence, 130, 107717.
-
Ameri, R., & Hsu, C.-C. (2026). LACTNet: A Label-Aware CNN-Transformer Network for Surface Defect Segmentation. Expert Systems with Applications.
These studies provided valuable insights into industrial defect inspection, segmentation methodologies, and deployment considerations. SegAgent-AI extends these research concepts into a practical end-to-end inspection platform that integrates image analysis, automated reporting, REST APIs, and modern web technologies.
MIT License
Rasoul Ameri
📧 rasoulameri90@gmail.com
🔗 GitHub Profile





