AI Visual Quality Inspection in Anti-Counterfeit Traceability
How the YOLOv8-based AI visual quality inspection model identifies counterfeit product packaging defects and QR code anomalies — covering training data construction, inference performance optimization, and production line deployment.
Product quality inspection is a critical link in the traceability system. Traditional manual quality inspection suffers from low efficiency, inconsistent standards, and missed defects due to fatigue. ZhiShuYun's AI team built a production-line-grade AI visual inspection system based on the YOLOv8 object detection model, achieving multi-dimensional automatic detection of QR code quality, packaging defects, label misalignment, and more.
For model selection, we compared three mainstream detection frameworks: YOLOv8, RT-DETR, and EfficientDet. Balancing inference speed and detection accuracy, we chose YOLOv8-nano as the baseline model: inference speed of 2.3ms per image on an NVIDIA T4 GPU, with mAP@0.5 reaching 0.92. For high-speed production line scenarios (up to 120 items/minute), the model's inference latency fully meets real-time detection requirements.
Training data is key to model effectiveness. We built a dataset containing 100,000+ annotated samples covering 15 defect types including normal codes, blurred codes, incomplete codes, misaligned codes, and overprint codes. Data augmentation strategies include random cropping, brightness/contrast perturbation, Gaussian blur, and affine transformations. We also introduced hard negative mining strategies, conducting targeted training on edge cases where the model tends to misclassify.
Production line deployment uses an edge computing architecture: each inspection station is equipped with an NVIDIA Jetson Orin edge computing device for local model inference, with inspection results reported in real time to the MES system via the MQTT protocol. For detected defective products, a PLC-linked rejection mechanism completes waste separation within 50ms. The entire system has been running stably on three customer production lines for over 6 months, inspecting over 20 million products with a defect detection rate of 99.7%.