Method, system and device for fast detection of high-warp cap defect of bottle cap in industrial scenario
Patent Information
- Application Number
- CN202611215495.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-12
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2046-08-12
AI Technical Summary
检测效率低:人工检测速度有限,难以匹配现代生产线300-500瓶/分钟的输送速度,且长时间检测易疲劳,导致效率持续下降;传统模板匹配检测需针对不同瓶盖规格单独设置参数,切换产品时需停机调试,影响产线连续性
1.检测效率显著提升:实现300-500瓶/分钟产线速度下的实时检测,替代8-10名人工检测员,检测效率提升6-8倍,且支持多规格瓶盖快速切换,无需停机调试。
Smart Images

Figure CN122730832B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation visual inspection technology, and in particular to a method, system and equipment for rapid detection of bottle cap tilt defects in industrial settings. Background Technology
[0002] In the bottled product manufacturing industry, bottle caps are crucial components for packaging sealing and product safety, making defect detection a core aspect of ensuring production quality. Traditional detection methods and existing technologies suffer from the following significant problems: Low testing efficiency: Manual testing has limited speed and is difficult to match the conveying speed of 300-500 bottles / minute in modern production lines. Long-term testing can easily lead to fatigue, resulting in a continuous decline in efficiency. Traditional template matching testing requires setting parameters separately for different bottle cap specifications. When switching products, the machine needs to be stopped for debugging, which affects the continuity of the production line.
[0003] Poor detection accuracy: Humans are not good at recognizing minute defects (such as 0.5mm-level bottle cap tilting and 1mm-level height deviation), resulting in high rates of missed and false detections; Traditional template matching is greatly affected by changes in lighting and bottle shaking, and the recognition accuracy for irregular defects such as high-tilted caps is only about 85%, which cannot meet the high-precision detection requirements of over 99%.
[0004] Incomplete coverage of defect categories: Manual and traditional inspections cannot simultaneously and accurately identify all categories of defects such as misalignment, missing caps, color deviation, printing defects, abnormal cap height, tilting, contamination, and broken anti-theft rings. Furthermore, the lack of a unified defect judgment standard leads to poor consistency in test results.
[0005] Production line linkage response lag: Existing detection solutions mostly only output defect results and are not linked with the production line rejection and shutdown system. Non-conforming products need to be manually rejected, which results in response delays and can easily lead to non-conforming products flowing into downstream processes. At the same time, it is impossible to monitor production line jams caused by bottle cap defects in real time.
[0006] To address this, the present invention proposes a rapid detection solution for high cap misalignment defects in bottle caps that integrates multi-view data fusion, AI model optimization, and intelligent production line linkage, thereby solving the pain points of efficiency, accuracy, functional coverage, and linkage response in existing technologies. Summary of the Invention
[0007] The purpose of this invention is to provide a rapid detection method, system, and equipment for bottle cap misalignment defects in industrial settings, thereby improving detection efficiency and accuracy, enabling intelligent linkage of production lines, and applicable to bottling production lines for beverages, pharmaceuticals, etc.
[0008] To achieve the above objectives, this invention provides a rapid detection method for bottle cap tilt defects in industrial settings, comprising the following steps: Step S1, Image Acquisition: Acquire three-view images and position signals of the bottle cap; Step S2, Multi-view data fusion: The collected multimodal data is fused using a spatiotemporal alignment algorithm and image stitching technology to output a target image with location markers; Step S3, Defect Detection Inference: Using the optimized YOLOv8-S target detection model, inference is performed on the fused data to output the defect category and location coordinates; Step S4: Construction of High-Tilted Cover Judgment Rules: Construct high-tilted cover judgment rules, with a built-in algorithm for calculating the height difference and the angle between the axis, to quantify and judge the high-tilted cover candidate results output by the defect detection module and output the specific defect type; Step S5: Automatic rejection and alarm linkage: Upon receiving a defect detection signal indicating non-compliance, trigger the audible and visual alarm and the automatic rejection device; if the defect rate exceeds the standard, send a shutdown warning signal to the production line control unit.
[0009] Preferably, in step S1, the three-view image and position signal of the bottle cap are acquired, and the specific process is as follows: Step S11: First, deploy 3 industrial cameras above and on both sides of the conveyor channel of the bottling production line; one camera directly above covers the detection of bottle cap height and presence, and one camera on each side covers the detection of tilt, misalignment and anti-theft ring. Step S12: Then, in conjunction with the ring-shaped LED light source installed around the camera directly above, image acquisition is achieved at a frame rate of 50 frames per second. Step S13: Finally, install one photoelectric sensor in each channel to synchronously acquire the bottle cap position signal, forming multimodal data of three-view image data and position signal; For multiple images input from three cameras, a step-by-step preprocessing pipeline is designed, and the specific process is as follows: The first step is to perform geometric correction using OpenCV, and use the checkerboard calibration method to obtain camera intrinsic parameters to eliminate image shift caused by lens distortion. The second step involves using a combination of bilateral filtering and Gaussian filtering algorithms for noise reduction, removing noise caused by light source fluctuations and bottle reflections. The third step is to perform color correction by unifying the color space of the three-view images based on the standard color chart and using a white balance algorithm. The fourth step is to extract the ROI by retaining only the image regions corresponding to the bottle cap and bottle opening, thereby reducing the amount of invalid data.
[0010] Preferably, in step S2, spatial alignment is achieved by mapping image coordinates to physical coordinates, as follows: Let the intrinsic parameter matrix of the industrial camera be... Pixel coordinate system ) and camera coordinate system The mapping relationship between the two sides satisfies the perspective projection formula, as shown below: ; Among them, the intrinsic parameter matrix , ; The focal length of the lens; Pixel size; The coordinates of the camera's principal point are obtained using the checkerboard calibration method. Known camera installation height directly above Installation height of cameras on the left and right sides With the production line conveying direction as the X-axis, the perpendicular conveying direction as the Y-axis, and the vertical direction as the Z-axis, establish the physical coordinate system of the axes. The transformation relationship between this physical coordinate system and the camera coordinate system is as follows: Camera directly above: ; Left camera: ; Right-side camera: ; Combining the above formulas, we can derive the pixel coordinates. ) to physical coordinates ( The mapping formula for ) is: Camera directly above: ; Left camera: ; Right-side camera: ; in,( () represents the coordinates of the principal point of the camera directly above; )and( () represents the coordinates of the principal points of the left and right cameras; This formula converts the physical installation location of the photoelectric sensor into a Region of Interest (ROI) in a three-view image, achieving spatial alignment.
[0011] Preferably, the sensor signal is synchronized with the image frame to achieve time alignment, as follows: Let the timestamp of the photoelectric sensor trigger signal be... The timestamp of the camera image frame acquisition is The criteria for determining time alignment are: ; in, When the above conditions are met, the image frame is bound to the sensor signal and determined to be multimodal data of the same bottle cap target, thus achieving time alignment.
[0012] Preferably, in step S3, an optimized YOLOv8-S target detection model is used to infer the fused data; the model detection head outputs the target existence probability, category probability, and bounding box position parameters for each candidate detection box, and calculates the confidence level of the candidate detection box based on the target existence probability and the probability of each defect category, and finally outputs the defect category, location coordinates, and confidence level. For the The candidate detection box belongs to the first... Confidence level of class defects Calculate using the following formula: ; in, Indicates the first The probability that a bottle cap target or a bottle cap defect target exists in each candidate detection box; Indicates the first The candidate detection box belongs to the first... The category probability of a defect; Indicates the first The candidate detection box corresponds to the first The overall confidence level of the defect type; The confidence scores of each category are compared, and the category corresponding to the highest confidence score is selected as the defect category of the candidate detection box. ; ; When satisfied When this happens, candidate detection boxes are retained as valid detection results; among them, To preset the reliability threshold, the value range is: Then, non-maximum suppression is performed on the retained candidate detection boxes to remove duplicate boxes, and the defect category, location coordinates and confidence score are output.
[0013] Preferably, an optimized YOLOv8-S target detection model is used, with the fused multimodal data as input. The model, through an improved FPN feature pyramid, adds a small target detection branch to capture features of minute defects down to 0.5mm. Combined with a multi-task detection head, it achieves defect classification and localization, specifically including: Design a CPU-GPU collaborative inference architecture based on multi-core CPUs and GPUs in edge computing terminals: (1) The CPU is responsible for the segmentation, preprocessing and data fusion of the three images, and adopts multi-threading technology to achieve parallel processing; (2) The GPU is responsible for the inference of the defect detection model, and dynamic batch inference optimization is adopted; (3) At the same time, the computational load of the model is reduced by using model quantization and layer fusion techniques; Let the batch size of images processed in a single inference be . The number of pixels in each image is Inference time of TensorRT satisfy: ; in, The computational cost per image model; For INT8 computing power, This refers to the utilization rate of computing power.
[0014] Preferably, in step S4, a high-tilt cover determination rule is constructed, and an algorithm for calculating the height difference and the angle between the axis is built in. The candidate results of high-tilt covers output by the defect detection module are quantitatively determined, and the specific defect type is output. The specific process is as follows: Step S41: Based on historical defect data, establish a quantitative judgment model for high-misalignment covers, and set two judgment dimensions: First, height anomalies: If the pixel distance between the top of the bottle cap and the reference surface of the bottle opening, captured by the camera directly above, differs from the standard height by more than ±1mm after physical coordinate transformation, it is determined to be a high cap or a low cap; the formula for determining bottle cap height anomalies is: Let the pixel coordinates of the top edge of the bottle cap captured by the camera directly above be ( The pixel coordinates of the reference plane edge of the bottle mouth are ( ), converted to physical coordinates using spatial alignment formulas ( Actual height of the bottle cap for: ; Let the standard height of the bottle cap be... Height deviation for: ; Criteria for determining high anomalies: ,when When it is determined to be a high cover, when It was determined to be a low cover at that time; Second, tilt anomalies: In the fused left and right view images, if the angle between the axis of the bottle cap and the axis of the bottle body exceeds 3°, it is judged as a tilted cap; the formula for judging bottle cap tilt anomalies is: By fusing images from left and right perspectives, the pixel coordinates of the bottle cap axis and the bottle body axis are extracted; let the pixel coordinates of the endpoint of the bottle cap axis be ( ), ( The pixel coordinates of the endpoints of the bottle's axis are ( ), ( After converting to physical coordinates, the direction vectors of the two axes are calculated as follows: ; ; Calculate the included angle of the axes using the vector dot product formula. As shown below: ; Criteria for determining tilt anomalies: ,when exist When it is on the left, it is judged as leaning to the left. exist When on the right, it is judged as leaning to the right; Step S42: Extract the ROI from the fused three-view image, retaining only the bottle cap and bottle mouth area; extract the contours of the bottle cap and bottle mouth using an edge detection algorithm, and calculate the height difference and the angle between the axis; combine the above judgment rules, output the high tilted cap judgment result within 50ms, and distinguish four specific types: high cap, low cap, left tilt, and right tilt.
[0015] A rapid detection system for high-twist bottle cap defects in industrial settings is used to implement the aforementioned rapid detection method for high-twist bottle cap defects in industrial settings. The system includes an image acquisition module, a multimodal data fusion module, a defect detection module, a high-twist cap judgment module, an alarm and rejection control module, and a terminal display module. All modules work together to achieve fully automated detection. Image acquisition module: Composed of 3 industrial cameras, 1 ring LED light source, and several photoelectric sensors, responsible for acquiring three-view images and position signals of the bottle cap; Multimodal data fusion module: Receives image data from the image acquisition module and sensor signals, achieves data fusion through spatiotemporal alignment algorithm and image stitching technology, and outputs a target image with location markers; Defect detection module: Loads the optimized YOLOv8-S model, performs inference on the fused data, and outputs the defect category and location coordinates; High-tilted cover determination module: It has a built-in algorithm for calculating the height difference and the angle between the axis, which quantifies and determines the high-tilted cover candidate results output by the defect detection module and outputs the specific defect type; Alarm and rejection control module: Receives non-conforming signals from the defect detection module, triggers audible and visual alarms and automatic rejection devices; if the defect rate exceeds the standard, it sends a shutdown warning signal to the production line control unit. Terminal display module: The UI interface is developed based on PyQt6, which displays the production line running speed, number of defects, non-conforming product rejection records, and inspection logs in real time, and supports historical data query and export.
[0016] A rapid detection device for bottle cap misalignment defects in industrial settings includes a hardware main body and supporting software. The hardware main body consists of an edge computing terminal, an image acquisition component, an alarm and rejection component, and a terminal display component, to realize the rapid detection method for bottle cap misalignment defects in industrial settings. Edge computing terminal: It adopts NVIDIA Jetson AGX Orin, equipped with a 12-core Arm Cortex-A78AE CPU and a 64-core Tensor Core GPU, supports 8-channel camera input, runs the Ubuntu 20.04 operating system and Jetson SDKManager, and provides computing support for data processing and model inference; Image acquisition component: includes 3 industrial cameras, 1 ring LED light source, and several photoelectric sensors. The cameras are connected to the edge computing terminal via Gigabit Ethernet, and the sensors are connected to the terminal GPIO interface via signal lines. Alarm and rejection components: including one audible and visual alarm light and one automatic rejection device, which are linked with the edge computing terminal via GPIO interface; Terminal display component: 1 touch screen display, connected to the edge computing terminal via HDMI interface, used to display the detection interface and operation control; Supporting software includes image preprocessing software, multimodal data fusion software, YOLOv8-S defect detection software, high-twist cover judgment software, and UI display software. All of these are developed based on Python 3.10, support cross-platform operation on Windows / Linux, and have built-in model update interfaces to support online iterative upgrades.
[0017] Therefore, the present invention employs the above-mentioned rapid detection method, system, and equipment for bottle cap tilting defects in industrial scenarios, and the beneficial effects are as follows: 1. Significantly improved testing efficiency: Enables real-time testing at a production line speed of 300-500 bottles / minute, replacing 8-10 manual testers, increasing testing efficiency by 6-8 times, and supporting rapid switching between multiple bottle cap specifications without the need for downtime debugging.
[0018] 2. Significantly improved detection accuracy: The accuracy rate of detecting 0.5mm-level high-twisting cap defects reaches 99.2%, and the rate of missed detection and false detection is far lower than that of traditional template matching detection, ensuring the sealing of product packaging and reducing customer complaint rate.
[0019] 3. Comprehensive coverage of defect categories: It can detect 8 types of bottle cap defects at the same time without the need to deploy other testing equipment, reducing equipment investment costs and production line space occupation.
[0020] 4. Timely production line response: Automatic rejection response time after defect detection is no more than 100ms, with a 100% non-conforming product interception rate; Real-time shutdown warning is triggered when the defect rate exceeds the standard, reducing the generation of batch non-conforming products and expected to improve the overall pass rate of the production line by 1.5-2%.
[0021] 5. High scalability: Supports multi-camera expansion and can be adapted to multi-channel bottling production lines; built-in model update interface, which can add more defect category detection functions by adding new samples to iterate the model and adapt to future product upgrade needs.
[0022] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0023] Figure 1 This is an overall structural block diagram of the rapid detection system for bottle cap tilt defects in industrial scenarios according to the present invention; Figure 2 This is a schematic diagram of the installation layout of the hardware device of the present invention; Figure 3 This is a schematic diagram of the multi-view image preprocessing and data fusion process of the present invention; Figure 4 This is the algorithm logic diagram for high-tilt-out quantization determination in this invention; Figure 5 This is a schematic diagram of the terminal display interface of the present invention. Detailed Implementation
[0024] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0025] This invention provides a rapid detection method for bottle cap tilt defects in industrial settings, comprising the following steps: Step S1: Image Acquisition: Acquire three-view images and position signals of the bottle cap.
[0026] Step S11: First, deploy three industrial cameras above and on both sides of the conveyor channel of the bottling production line; one camera directly above covers the detection of bottle cap height and presence, and one camera on each side covers the detection of tilt, misalignment, and anti-theft rings.
[0027] Step S12: Then, with the help of a ring of LED light sources installed around the camera directly above, the brightness is adjustable, and image acquisition is achieved at a frame rate of 50 frames per second.
[0028] Step S13: Finally, install one photoelectric sensor in each channel to synchronously acquire the bottle cap position signal, forming multimodal data of three-view image data and position signal.
[0029] like Figure 3As shown, a step-by-step preprocessing pipeline is designed for multi-channel images input from three cameras. The specific process is as follows: The first step is to perform geometric correction using OpenCV (using the checkerboard calibration method to obtain camera intrinsic parameters and eliminate image shift caused by lens distortion).
[0030] The second step involves using a combination of bilateral filtering and Gaussian filtering algorithms for noise reduction, removing noise caused by light source fluctuations and bottle reflections.
[0031] The third step involves using a standard color chart and a white balance algorithm to unify the color space of the three-view images, perform color correction, and improve the accuracy of color deviation detection.
[0032] The fourth step is to extract the ROI by retaining only the image regions corresponding to the bottle cap and bottle opening, thereby reducing the amount of invalid data (the amount of data is reduced by about 60%).
[0033] Step S2, Multi-view data fusion: The collected multimodal data is fused using a spatiotemporal alignment algorithm and image stitching technology to output a target image with location markers.
[0034] The 2448×2048 resolution images acquired by three industrial cameras are spatiotemporally aligned with the position signals of the photoelectric sensor; the sensor trigger signal is precisely matched with the bottle cap area in the three-view images using a coordinate mapping algorithm to locate the target to be detected; the left and right view images are fused using image stitching technology to generate a panoramic image of the bottle cap side, eliminating invalid calculations for areas without targets and improving detection efficiency.
[0035] (1) Spatial alignment: mapping image coordinates to physical coordinates.
[0036] Let the intrinsic parameter matrix of the industrial camera be... Pixel coordinate system ) and camera coordinate system The mapping relationship between the two sides satisfies the perspective projection formula, as shown below: ; Among them, the intrinsic parameter matrix , ; The focal length of the lens; Pixel size; The coordinates of the camera principal point are obtained using the checkerboard calibration method. The calibration board uses a 12×9 grid with a grid size of 15mm.
[0037] Known camera installation height directly above (Fixed value), installation height of cameras on the left and right sides With the production line conveying direction as the X-axis, the perpendicular conveying direction as the Y-axis, and the vertical direction as the Z-axis, establish the physical coordinate system of the axes. The transformation relationship between this physical coordinate system and the camera coordinate system is as follows: Camera directly above: ; Left camera: ; Right-side camera: ; Combining the above formulas, we can derive the pixel coordinates. ) to physical coordinates ( The mapping formula for ) is: Camera directly above: ; Left camera: ; Right-side camera: ; in,( () represents the coordinates of the principal point of the camera directly above; )and( ) represents the coordinates of the principal points of the left and right cameras.
[0038] This formula converts the physical installation location of the photoelectric sensor into a Region of Interest (ROI) in a three-view image, achieving spatial alignment.
[0039] (2) Time alignment: The sensor signal is synchronized with the image frame.
[0040] Let the timestamp of the photoelectric sensor trigger signal be... The timestamp of the camera image frame acquisition is (Interval between frames) The time alignment criteria are as follows: ; in, (Based on a production line speed of 500 bottles / minute, the bottle cap moves ≤0.4mm within 5ms, so the positional offset can be ignored).
[0041] When the above conditions are met, the image frame is bound to the sensor signal and determined to be multimodal data of the same bottle cap target, thus achieving time alignment.
[0042] Step S3, Defect Detection Inference: The optimized YOLOv8-S target detection model is used to infer the fused data. The model detection head outputs the target existence probability, category probability, and bounding box position parameters for each candidate detection box, and calculates the confidence of the candidate detection box based on the target existence probability and the probability of each defect category. Finally, the defect category, location coordinates, and confidence are output.
[0043] For the The candidate detection box belongs to the first... Confidence level of class defects Calculate using the following formula: ; in, Indicates the first The probability that a bottle cap target or a bottle cap defect target exists in each candidate detection box; Indicates the first The candidate detection box belongs to the first... The category probability of a defect; Indicates the first The candidate detection box corresponds to the first The overall confidence level of the class of defects.
[0044] The confidence scores of each category are compared, and the category corresponding to the highest confidence score is selected as the defect category of the candidate detection box. ; ; When satisfied When this happens, the candidate detection box is retained as a valid detection result; where, To preset the reliability threshold, the value range is: Then, non-maximum suppression (NMS) is performed on the retained candidate detection boxes to remove duplicate boxes, and the defect category, location coordinates and confidence score are output.
[0045] An optimized YOLOv8-S target detection model is used as input, along with fused multimodal data. The model captures minute defect features down to 0.5mm through an improved FPN feature pyramid (with an added small target detection branch), and combines it with a multi-task detection head (with dedicated loss functions designed for different defects such as height anomalies, tilting, and color deviation) to achieve classification and localization of eight types of defects.
[0046] Based on the multi-core CPU and GPU of the edge computing terminal (Jetson AGX Orin), a CPU-GPU collaborative inference architecture is designed: (1) The CPU is responsible for the segmentation, preprocessing and data fusion of the three images. It uses multi-threading technology (allocating an independent thread to each camera) to achieve parallel processing. (2) The GPU is responsible for the inference of the defect detection model and adopts dynamic batch inference optimization (the batch size is automatically adjusted according to the production line speed, and the parallel computing capability of Tensor Core is used to improve the inference efficiency). (3) At the same time, by using model quantization (quantizing FP32 precision to INT8 precision) and layer fusion technology, the computational load of the model is reduced, the inference speed is increased by 2 times, and the detection delay is ensured to be ≤50ms / bottle.
[0047] The model inference speed is accelerated by GPU (based on Jetson AGX Orin's Tensor Core), ensuring real-time detection at a production line speed of 300-500 bottles / minute, with a recognition accuracy of over 99%.
[0048] Let the batch size of images processed in a single inference be . (Corresponding to a production line speed of 500 bottles / minute), the number of pixels per image is [number missing]. The computational cost of a single image model is: (After optimization by YOLOv8-S); TensorRT inference time satisfy: ; in, (INT8 computing power of Jetson AGX Orin). (Computing power utilization). Substituting the values, we get: ; It meets the speed requirement of single-bottle detection delay ≤50ms.
[0049] Step S4: Construction of High-Tilted Cover Judgment Rules: Construct high-tilted cover judgment rules, incorporating an algorithm for calculating the height difference and the angle between the height and the axis, to quantify and judge the high-tilted cover candidate results output by the defect detection module, and output the specific defect type, such as... Figure 4 As shown.
[0050] Step S41: Based on historical defect data, establish a quantitative judgment model for high-misalignment covers, and set two judgment dimensions: First, height anomaly: The pixel distance between the top of the bottle cap and the reference surface of the bottle opening, captured by the camera directly above, differs from the standard height by more than ±1mm after physical coordinate transformation (determined as a high or low cap); the formula for determining bottle cap height anomalies is: Let the pixel coordinates of the top edge of the bottle cap captured by the camera directly above be ( The pixel coordinates of the reference plane edge of the bottle mouth are ( ), converted to physical coordinates using spatial alignment formulas ( Actual height of the bottle cap for: ; Let the standard height of the bottle cap be... (Set according to bottle cap specifications, such as 10mm), height deviation for: ; Criteria for determining high anomalies: ,when When it is determined to be a high cover, when It was determined to be a low cover.
[0051] Second, tilt anomaly: In the fused left and right view images, the angle between the axis of the bottle cap and the axis of the bottle body exceeds 3° (indicating a tilted cap); the formula for determining bottle cap tilt anomaly is: By fusing images from left and right perspectives, the pixel coordinates of the bottle cap axis and the bottle body axis are extracted; let the pixel coordinates of the endpoint of the bottle cap axis be ( ), ( The pixel coordinates of the endpoints of the bottle's axis are ( ), ( After converting to physical coordinates, the direction vectors of the two axes are calculated as follows: ; ; Calculate the included angle of the axes using the vector dot product formula. As shown below: ; Criteria for determining tilt anomalies: ,when exist When it is on the left, it is judged as leaning to the left. exist When it is on the right side, it is judged as leaning to the right.
[0052] Step S42: Extract the ROI from the fused three-view image, retaining only the bottle cap and bottle mouth area; extract the contours of the bottle cap and bottle mouth using an edge detection algorithm, and calculate the height difference and the angle between the axis; combine the above judgment rules, output the high tilted cap judgment result within 50ms, and distinguish four specific types: high cap, low cap, left tilt, and right tilt.
[0053] Step S5: Automatic rejection and alarm linkage: Upon receiving a defect detection signal indicating non-compliance, trigger the audible and visual alarm and the automatic rejection device; if the defect rate exceeds the standard, send a shutdown warning signal to the production line control unit.
[0054] If a high-tilted cap or other defects are detected, the system immediately triggers an audible and visual alarm (flashing yellow LED light + 80dB buzzer) and sends a signal to the automatic rejection device on the production line (located 1m downstream of the detection area) via RS485 communication. The defective products are rejected within 100ms. If the defect rate exceeds 5% for 10 consecutive seconds, the system triggers a production line shutdown warning, prompting manual inspection of the equipment status.
[0055] like Figure 1As shown, the rapid detection system for high-crooked cap defects in industrial scenarios of the present invention includes an image acquisition module, a multimodal data fusion module, a defect detection module, a high-crooked cap judgment module, an alarm and rejection control module, and a terminal display module. The modules work together to achieve fully automated detection.
[0056] 1. Image acquisition module: It consists of 3 Hikvision 5-megapixel industrial cameras (model MV-CS050-10GC, resolution 2448×2048, frame rate 50fps), 1 ring LED light source (power 15W, color temperature 5500K), and several photoelectric sensors, which are responsible for acquiring three-view images and position signals of the bottle cap.
[0057] 2. Multimodal data fusion module: Receives image data from the image acquisition module and sensor signals, and achieves data fusion through spatiotemporal alignment algorithm and image stitching technology, outputting a target image with location markers.
[0058] 3. Defect Detection Module: Loads the optimized YOLOv8-S model, performs inference on the fused data, and outputs the defect category (8 categories such as misalignment and missing bottle cap), location coordinates, and confidence score (≥0.8 is a valid judgment).
[0059] 4. High-tilted cover judgment module: The built-in algorithm for calculating the height difference and the angle between the axis is used to quantitatively judge the high-tilted cover candidate results output by the defect detection module and output the specific defect type (high cover, low cover, left tilt, right tilt).
[0060] 5. Alarm and rejection control module: Receives non-conforming signals from the defect detection module, triggers audible and visual alarms and automatic rejection devices; if the defect rate exceeds the standard, it sends a shutdown warning signal to the production line control unit.
[0061] 6. Terminal Display Module: Developed using PyQt6, this UI displays real-time production line speed, defect count (by category), non-conforming product rejection records, and inspection logs (time, bottle number, defect type). It supports historical data querying and export, such as... Figure 5 As shown.
[0062] like Figure 2 As shown, the present invention provides a rapid detection device for bottle cap tilt defects in industrial scenarios, comprising a hardware main body and supporting software. The hardware main body consists of an edge computing terminal, an image acquisition component, an alarm and rejection component, and a terminal display component.
[0063] 1. Edge computing terminal: It adopts NVIDIA Jetson AGX Orin (32G version), equipped with a 12-core Arm Cortex-A78AE CPU and a 64-core Tensor Core GPU (200 TOPS computing power), supports 8-channel camera input, runs Ubuntu 20.04 operating system and Jetson SDK Manager, and provides computing support for data processing and model inference.
[0064] 2. Image acquisition components: Includes 3 industrial cameras (the top camera is equipped with a 12mm focal length lens, and the left and right cameras are equipped with 8mm focal length lenses, with field of view of 30° and 50° respectively), 1 ring LED light source, and several photoelectric sensors (response time ≤ 0.5ms). The cameras are connected to the edge computing terminal via Gigabit Ethernet, and the sensors are connected to the terminal GPIO interface via signal lines.
[0065] 3. Alarm and rejection components: Includes one audible and visual alarm light (yellow LED light + 80dB buzzer) and one automatic rejection device (pneumatic push rod type, response time ≤100ms), which is linked with the edge computing terminal through the GPIO interface.
[0066] 4. Terminal display component: One 12-inch touch screen display (1920×1080 resolution, capacitive 10-point touch), connected to the edge computing terminal via HDMI interface, used to display the detection interface and operation control.
[0067] 5. Supporting software: including image preprocessing software, multimodal data fusion software, YOLOv8-S defect detection software, high tilt cover judgment software, and UI display software, all developed based on Python 3.10, supporting cross-platform operation on Windows / Linux, and having a built-in model update interface to support online iterative upgrades.
[0068] Example I. Hardware Deployment.
[0069] 1. Camera and Light Source Installation: Fix one industrial camera 1.5m directly above the bottling production line with the lens pointing vertically downwards to ensure coverage of the top area of the bottle cap; fix one industrial camera 1m on each side of the production line with the lens at a 45° angle to the bottle axis to ensure coverage of the sides of the bottle cap and the anti-theft ring area; install a ring of LED light sources around the camera directly above, with the light source 20cm away from the camera to ensure that the light shines evenly on the bottle cap surface without shadow interference.
[0070] 2. Sensor and rejection device installation: Install one photoelectric sensor 5cm upstream of the detection area of each channel, with the sensor probe facing the bottle body and a detection distance of 5-10cm, to ensure that a signal is triggered when the bottle cap passes by; install an automatic rejection device 1m downstream of the detection area, with the pneumatic push rod facing the non-conforming product conveying path to ensure that non-conforming products can be accurately pushed into the waste bin.
[0071] 3. Edge computing terminal deployment: Install the Jetson AGX Orin edge computing terminal in the industrial control cabinet next to the production line. Connect 3 industrial cameras through a gigabit Ethernet switch and connect photoelectric sensors, audible and visual alarm lights, and automatic rejection devices through GPIO pins. Install a touch screen display in the industrial control cabinet and connect it to the terminal through an HDMI interface.
[0072] II. Software Configuration and Operation.
[0073] 1. Software Installation: Install the Ubuntu 20.04 operating system and Jetson SDKManager on the edge computing terminal, configure the Python 3.10 environment, and install dependent libraries such as OpenCV (version 4.8.0), PyTorch (adapted to the Jetson platform version), and PyQt6; deploy image preprocessing software, multimodal data fusion software, YOLOv8-S defect detection software, high-tilt cover judgment software, and UI display software.
[0074] 2. Model Training and Deployment: Collect 20,000 bottle cap sample images (containing 8 types of defects, with no less than 2,000 samples for each type of defect, and defect sizes covering 0.5-5mm). Use LabelStudio to annotate the data (annotate bounding boxes, defect categories, and quantization parameters, such as height difference and tilt angle). Train the YOLOv8-S model using a 4×Tesla V100 GPU server. During training, data augmentation (random rotation, flipping, brightness and contrast adjustment, and noise addition) is used to improve the model's generalization ability. After training, export the model to ONNX format, quantize it to INT8 precision using TensorRT, and deploy it to an edge computing terminal, increasing the inference speed to 100fps.
[0075] 3. System Operation: After the system starts, the image acquisition module acquires images at a frame rate of 50fps, and the photoelectric sensor outputs position signals synchronously; the multimodal data fusion module performs spatiotemporal alignment and image stitching on the data, and outputs the image of the target to be detected; the multi-view image preprocessing module processes three images in parallel to remove noise and invalid areas; the defect detection module performs batch inference on the preprocessed images and outputs defect results; the high-tilt-cover judgment module performs quantitative calculation on the high-tilt-cover candidate results to determine the specific defect type; the terminal display module displays the production line speed, defect statistics, and rejection records in real time. If a defect is detected, the alarm and rejection control module triggers the corresponding action (alarm / rejection).
[0076] III. Performance Verification.
[0077] 1. Detection speed: At a production line speed of 300-500 bottles / minute, the system has a single bottle detection delay of ≤50ms and can process 20-30 targets per second, meeting the real-time detection needs of the production line.
[0078] 2. Detection accuracy: The detection accuracy rate for 0.5mm level high misalignment, 0.8mm level color deviation, and 1mm level printing defects reaches 99.2%, with a false negative rate of ≤0.5% and a false positive rate of ≤0.3%, exceeding the accuracy target of 99%.
[0079] 3. Linked Response: After defect detection, the automatic rejection device has a response time of ≤100ms, and the rejection rate of non-conforming products reaches 100%; when the defect rate exceeds the standard, the shutdown warning trigger delay is ≤1s, which can effectively avoid the generation of batches of non-conforming products.
[0080] When the above conditions are met, the image frame is bound to the sensor signal and determined to be multimodal data of the same bottle cap target, thus achieving time alignment.
[0081] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0082] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0083] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0084] It is worth noting that all contents not described in detail in this invention are existing technologies and are well known to those skilled in the art.
[0085] Therefore, this invention employs a rapid detection method, system, and equipment for high-crooked cap defects in the aforementioned industrial scenarios. It achieves bottle cap defect detection at a bottling production line speed of 300-500 bottles / minute, covering eight types of defects: misalignment, missing caps, color deviation, printing defects, abnormal height, tilting, contamination, and broken tamper-evident rings. The detection accuracy reaches 0.5mm level, with a recognition accuracy rate ≥99%. Based on multi-view machine vision and AI algorithms, it achieves accurate judgment of irregular defects such as high-crooked caps and links with the production line's automatic rejection system and audible and visual alarms to ensure real-time interception of defective products. The invention also develops multi-view image preprocessing and model inference optimization technologies to improve data processing efficiency, ensure real-time detection, and support rapid switching between different cap sizes without manual parameter adjustment.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A rapid detection method for bottle cap misalignment defects in industrial settings, characterized in that, Includes the following steps: Step S1, Image Acquisition: Acquire three-view images and position signals of the bottle cap; Step S2, Multi-view Data Fusion: The acquired multimodal data is fused using a spatiotemporal alignment algorithm and image stitching technology to output a target image with location markers. The specific process is as follows: (1) Spatial alignment is achieved by mapping image coordinates to physical coordinates, as follows: Let the intrinsic parameter matrix of the industrial camera be... Pixel coordinate system ) and camera coordinate system The mapping relationship between the two sides satisfies the perspective projection formula, as shown below: ; Among them, the intrinsic parameter matrix , ; The focal length of the lens; Pixel size; The coordinates of the camera's principal point are obtained using the checkerboard calibration method. Known camera installation height directly above Installation height of cameras on the left and right sides With the production line conveying direction as the X-axis, the perpendicular conveying direction as the Y-axis, and the vertical direction as the Z-axis, establish the physical coordinate system of the axes. The transformation relationship between this physical coordinate system and the camera coordinate system is as follows: Camera directly above: ; Left camera: ; Right-side camera: ; Combining the above formulas, we can derive the pixel coordinates. ) to physical coordinates ( The mapping formula for ) is: Camera directly above: ; Left camera: ; Right-side camera: ; in,( () represents the coordinates of the principal point of the camera directly above; )and( () represents the coordinates of the principal points of the left and right cameras; This formula converts the physical installation location of the photoelectric sensor into a Region of Interest (ROI) in a three-view image, achieving spatial alignment. (2) Synchronize the sensor signal with the image frame to achieve time alignment, as follows: Let the timestamp of the photoelectric sensor trigger signal be... The timestamp of the camera image frame acquisition is The criteria for determining time alignment are: ; in, When the above conditions are met, the image frame is bound to the sensor signal and determined to be multimodal data of the same bottle cap target, thus achieving time alignment. Step S3, Defect Detection Inference: The optimized YOLOv8-S target detection model is used to infer the fused data and output high-misalignment candidate results, including defect category and location coordinates; Step S4: Construction of High-Tilted Cover Judgment Rules: Construct high-tilted cover judgment rules, with a built-in algorithm for calculating the height difference and the angle between the height and the axis. Quantitatively judge the high-tilted cover candidate results output from the defect detection reasoning step S3, and output the specific defect type. The specific process is as follows: Step S41: Based on historical defect data, establish a quantitative judgment model for high-misalignment covers, and set two judgment dimensions: First, height anomalies: If the pixel distance between the top of the bottle cap and the reference surface of the bottle opening, captured by the camera directly above, differs from the standard height by more than ±1mm after physical coordinate transformation, it is determined to be a high cap or a low cap; the formula for determining bottle cap height anomalies is: Let the pixel coordinates of the top edge of the bottle cap captured by the camera directly above be ( The pixel coordinates of the reference plane edge of the bottle mouth are ( ), converted to physical coordinates using spatial alignment formulas ( Actual height of the bottle cap for: ; Let the standard height of the bottle cap be... Height deviation for: ; Criteria for determining high anomalies: ,when When it is determined to be a high cover, when It was determined to be a low cover at that time; Second, tilt anomalies: In the fused left and right view images, if the angle between the axis of the bottle cap and the axis of the bottle body exceeds 3°, it is judged as a tilted cap; the formula for judging bottle cap tilt anomalies is: By fusing images from left and right perspectives, the pixel coordinates of the bottle cap axis and the bottle body axis are extracted; let the pixel coordinates of the endpoint of the bottle cap axis be ( ), ( The pixel coordinates of the endpoints of the bottle's axis are ( ), ( After converting to physical coordinates, the direction vectors of the two axes are calculated as follows: ; ; Calculate the included angle of the axes using the vector dot product formula. As shown below: ; Criteria for determining tilt anomalies: ,when exist When it is on the left, it is judged as leaning to the left. exist When on the right, it is judged as leaning to the right; Step S42: Extract the ROI from the fused three-view image, retaining only the bottle cap and bottle mouth area; extract the contours of the bottle cap and bottle mouth using an edge detection algorithm, and calculate the height difference and the angle between the axis; combine the above judgment rules, output the high tilted cap judgment result within 50ms, and distinguish four specific types: high cap, low cap, left tilt, and right tilt. Step S5: Automatic rejection and alarm linkage: Upon receiving a defect detection signal indicating non-compliance, trigger the audible and visual alarm and the automatic rejection device; if the defect rate exceeds the standard, send a shutdown warning signal to the production line control unit.
2. The rapid detection method for bottle cap tilting defects in industrial settings according to claim 1, characterized in that, In step S1, the three-view images and position signals of the bottle cap are acquired, and the specific process is as follows: Step S11: First, deploy 3 industrial cameras above and on both sides of the conveyor channel of the bottling production line; one camera directly above covers the detection of bottle cap height and presence, and one camera on each side covers the detection of tilt, misalignment and anti-theft ring. Step S12: Then, in conjunction with the ring-shaped LED light source installed around the camera directly above, image acquisition is achieved at a frame rate of 50 frames per second. Step S13: Finally, install one photoelectric sensor in each channel to synchronously acquire the bottle cap position signal, forming multimodal data of three-view image data and position signal; For multiple images input from three cameras, a step-by-step preprocessing pipeline is designed, and the specific process is as follows: The first step is to perform geometric correction using OpenCV, and use the checkerboard calibration method to obtain camera intrinsic parameters to eliminate image shift caused by lens distortion. The second step involves using a combination of bilateral filtering and Gaussian filtering algorithms for noise reduction, removing noise caused by light source fluctuations and bottle reflections. The third step is to perform color correction by unifying the color space of the three-view images based on the standard color chart and using a white balance algorithm. The fourth step is to extract the ROI by retaining only the image regions corresponding to the bottle cap and bottle opening, thereby reducing the amount of invalid data.
3. The rapid detection method for bottle cap tilting defects in industrial settings according to claim 1, characterized in that, In step S3, an optimized YOLOv8-S target detection model is used to infer the fused data. The model detection head outputs the target existence probability, category probability, and bounding box position parameters for each candidate detection box, and calculates the confidence of the candidate detection box based on the target existence probability and the probability of each defect category. Finally, high-scoring candidate results are output, including defect category, location coordinates, and confidence. For the The candidate detection box belongs to the first... Confidence level of class defects Calculate using the following formula: ; in, Indicates the first The probability that a bottle cap target or a bottle cap defect target exists in each candidate detection box; Indicates the first The candidate detection box belongs to the first... The category probability of a defect; Indicates the first The candidate detection box corresponds to the first The overall confidence level of the defect type; The confidence scores of each category are compared, and the category corresponding to the highest confidence score is selected as the defect category of the candidate detection box. ; ; When satisfied When this happens, candidate detection boxes are retained as valid detection results; among them, To preset the reliability threshold, the value range is: Then, non-maximum suppression is performed on the retained candidate detection boxes to remove duplicate boxes, and the defect category, location coordinates and confidence score are output.
4. The rapid detection method for bottle cap tilting defects in industrial settings according to claim 3, characterized in that, An optimized YOLOv8-S target detection model is used, with fused multimodal data as input. The model incorporates an improved FPN feature pyramid, adding a small target detection branch to capture features of minute defects down to 0.5mm. Combined with a multi-task detection head, it achieves defect classification and localization, specifically including: Design a CPU-GPU collaborative inference architecture based on multi-core CPUs and GPUs in edge computing terminals: (1) The CPU is responsible for the segmentation, preprocessing and data fusion of the three images, and adopts multi-threading technology to achieve parallel processing; (2) The GPU is responsible for the inference of the defect detection model, and dynamic batch inference optimization is adopted; (3) At the same time, the computational load of the model is reduced by using model quantization and layer fusion techniques; Let the batch size of images processed in a single inference be . The number of pixels in each image is Inference time of TensorRT satisfy: ; in, The computational cost per image model; For INT8 computing power, This refers to the utilization rate of computing power.
5. A rapid detection system for bottle cap misalignment defects in industrial settings, used to implement the rapid detection method for bottle cap misalignment defects in industrial settings according to any one of claims 1-4, characterized in that, The system includes an image acquisition module, a multimodal data fusion module, a defect detection module, a high-tilt-cover judgment module, an alarm and rejection control module, and a terminal display module. All modules work together to achieve fully automated detection. Image acquisition module: Composed of 3 industrial cameras, 1 ring LED light source, and several photoelectric sensors, responsible for acquiring three-view images and position signals of the bottle cap; Multimodal data fusion module: Receives image data from the image acquisition module and sensor signals, achieves data fusion through spatiotemporal alignment algorithm and image stitching technology, and outputs a target image with location markers; Defect detection module: Loads the optimized YOLOv8-S model, performs inference on the fused data, and outputs the defect category and location coordinates; High-tilted cover determination module: It has a built-in algorithm for calculating the height difference and the angle between the axis, which quantifies and determines the high-tilted cover candidate results output by the defect detection module and outputs the specific defect type; Alarm and rejection control module: Receives non-conforming signals from the defect detection module and triggers audible and visual alarms and automatic rejection devices; If the defect rate exceeds the standard, a shutdown warning signal is sent to the production line control unit. Terminal display module: The UI interface is developed based on PyQt6, which displays the production line running speed, number of defects, non-conforming product rejection records, and inspection logs in real time, and supports historical data query and export.
6. A rapid detection device for bottle cap misalignment defects in industrial settings, characterized in that, The system includes a hardware component and supporting software. The hardware component consists of an edge computing terminal, an image acquisition component, an alarm and rejection component, and a terminal display component, and implements the rapid detection method for high-crooked cap defects in industrial scenarios as described in any one of claims 1-4. Edge computing terminal: It adopts NVIDIA Jetson AGX Orin, equipped with a 12-core Arm Cortex-A78AE CPU and a 64-core Tensor Core GPU, supports 8-channel camera input, runs the Ubuntu 20.04 operating system and Jetson SDKManager, and provides computing support for data processing and model inference; Image acquisition component: includes 3 industrial cameras, 1 ring LED light source, and several photoelectric sensors. The cameras are connected to the edge computing terminal via Gigabit Ethernet, and the sensors are connected to the terminal GPIO interface via signal lines. Alarm and rejection components: including one audible and visual alarm light and one automatic rejection device, which are linked with the edge computing terminal via GPIO interface; Terminal display component: 1 touch screen display, connected to the edge computing terminal via HDMI interface, used to display the detection interface and operation control; Supporting software includes image preprocessing software, multimodal data fusion software, YOLOv8-S defect detection software, high-twist cover judgment software, and UI display software. All of these are developed based on Python 3.10, support cross-platform operation on Windows / Linux, and have built-in model update interfaces to support online iterative upgrades.
Citation Information
Patent Citations
AI-based bottle cap 360-degree full-view-angle defect high-speed detection method and system
CN120451176A
Glass bottle bottom defect detection method and device
CN121582218A