Skip to content
Eric®
Portfolio & Journal中文

Work / AI Vision · YOLO · SAM

NeuralVision Pro

Real-time object detection and segmentation system based on YOLO and SAM, designed for industrial quality inspection with multi-class defect identification and pixel-level segmentation.

Role
Independent Developer
Duration
4 months
Team
3 People
Index
No. 12
Concept visualization from the original site

YOLO + SAM Industrial Inspection System

NeuralVision Pro is a visual inspection system for industrial quality control, using YOLOv8 for high-speed object detection combined with SAM (Segment Anything Model) for pixel-level defect segmentation. The system supports multiple industrial inspection scenarios including surface scratches, foreign object contamination, and dimensional deviations.

Through YOLO's rapid detection cascaded with SAM's precise segmentation, the system achieves sub-20ms end-to-end inference latency while maintaining detection accuracy. Built with Python + PyTorch, Flask backend, MySQL storage, and Docker containerization, it has been successfully validated across multiple real-world inspection scenarios.

PythonPyTorchYOLOv8SAMOpenCVDockerFlaskMySQL

Architecture

End-to-end technology selection from model training to service deployment

Core Capabilities

⚡
High-Speed YOLO Detection
Real-time object detection based on YOLOv8 with single-frame inference latency as low as 15ms, meeting production line real-time inspection requirements
🎯
Precise SAM Segmentation
Pixel-level segmentation of detected regions using SAM, precisely annotating defect boundaries with both automatic and Prompt-based segmentation modes
🏭
Multi-Scenario Support
Supports multiple industrial inspection scenarios including surface scratches, foreign objects, and dimensional deviations, with quick strategy switching via configuration files
📦
Containerized Deployment
Complete Docker deployment solution supporting standalone and cluster deployment, one-click inference service startup for rapid rollout across different production environments

Performance Metrics

Inference
15ms
mAP
95%
Models
3+
Images
50K+

Inference Pipeline

YOLO detection + SAM segmentation cascaded inference pipeline

pipeline.py
from ultralytics import YOLO
from segment_anything import sam_model_registry, SamPredictor
import cv2

# Initialize YOLO detector and SAM predictor
yolo = YOLO("yolov8m.pt")
sam = sam_model_registry["vit_h"](checkpoint="sam_vit_h.pth")
predictor = SamPredictor(sam)

# Step 1: YOLO detection
image = cv2.imread("defect_sample.jpg")
results = yolo.predict(image, conf=0.7)
boxes = results[0].boxes.xyxy.cpu().numpy()

# Step 2: SAM segmentation on detected regions
predictor.set_image(image)
masks, _, _ = predictor.predict(
    box=boxes[0],  # use first detection as prompt
    multimask_output=True
)

print(f"Detected {len(boxes)} defects, mask shape: {masks.shape}")
Next project — 13DataFlow Pipeline