Wood board defect online detection method based on yov8 binocular vision

By using the method of combining YOLOv8 with binocular vision in wooden board detection, the performance bottlenecks and single camera system limitations of YOLO series algorithms in wooden board defect detection are solved, and fast and accurate wooden board defect detection is achieved, improving the integrity of the detection and reliability.

CN119067920APending Publication Date: 2024-12-03HEFEI UNIV OF TECH

Patent Information

Application Number
CN202411065090.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing YOLO series algorithms have performance bottlenecks, insufficient accuracy, and limited field of view coverage and depth perception capabilities in the detection of wooden board defects, resulting in low detection efficiency, poor accuracy and missed detection problems.

Method used

Using a binocular vision detection method based on YOLOv8, obtain depth information through a binocular camera, combined with the precise positioning ability of YOLOv8, a deep learning framework such as TensorFlow or PyTorch trains the model to perform dual-thread online detection to achieve fast and accurate wooden board defects. Identify.

Benefits of technology

Significantly improve the accuracy and efficiency of detection, reduce the labor intensity and time cost of manual inspection, avoid missed inspection problems caused by perspective limitation or insufficient coverage, and can cover the surface of the wooden board more comprehensively, improving the integrity and reliability of the inspection. sex.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067920A_ABST
    Figure CN119067920A_ABST
Patent Text Reader

Abstract

The invention discloses a wood board defect online detection method based on yolov8 binocular vision, which comprises the following steps: S1, acquiring a defect data set of a furniture wood board, S2, carrying out data labeling on defect pictures of the furniture wood board, S3, carrying out training to obtain a weight applied to wood board defect detection, S4, constructing an online detection software interface system through pyside6, S5, loading a YOLOv8 online detection model, and S5, carrying out online detection. S6, a binocular vision hardware system is built; and S7, dual-thread online detection is realized. The method provided by the invention has wider visual field coverage and depth perception capability, can effectively avoid the problem of missing detection caused by visual angle limitation or insufficient coverage, and can improve the integrity and reliability of detection. Meanwhile, the method has the advantages of high detection speed, high detection precision, high stability, low cost and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of deep learning and detection methods, and specifically to an online detection method for wood board defects based on yolov8 binocular vision. Background Art

[0002] The furniture manufacturing industry is highly dependent on fine processing. As the main raw material for furniture manufacturing, the quality of wood boards directly affects the quality and appearance of the finished products. Traditional wood board defect detection mostly relies on manual vision, which is not only inefficient, but also the detection results are easily affected by factors such as operator fatigue and subjective judgment, making it difficult to ensure the consistency and accuracy of detection.

[0003] With the development of computer vision and deep learning technology, it has become a trend to use these technologies to detect wood board defects. As an efficient real-time target detection system, the YOLO (You Only Look Once) series of algorithms have been widely used in various scenarios.

[0004] At present, in the field of computer vision and deep learning, although the YOLO (You Only Look Once) series of algorithms, such as YOLOv4, YOLOv5, YOLOv6, etc., have excellent real-time performance and relatively high accuracy, they have occupied an important position in target detection tasks, especially being widely used in video surveillance, autonomous driving, industrial automation and other scenarios. However, when faced with specific needs such as wood board defect detection, these algorithms and their common single-camera configurations still show certain limitations. The specific ones are as follows:

[0005] 1. Insufficient performance and detection speed:

[0006] First, although the YOLO series algorithms before YOLOV8 have excellent performance, they may still face performance bottlenecks when processing complex scenes or high-resolution images. This is mainly reflected in the detection speed. When it is necessary to process a large amount of data at the same time or perform refined defect identification, previous YOLO versions may not meet the real-time requirements. For subtle and diverse targets such as wood board defects, the algorithm often needs to make a trade-off between computational complexity and model parameter quantity while maintaining high accuracy, which further limits its performance improvement.

[0007] 2. Accuracy issues:

[0008] In wood board defect detection, due to the variety of defect types (such as cracks, holes, etc.), and the possibility of being affected by multiple factors such as lighting changes, surface texture, material properties, etc., the YOLO series of algorithms may not be able to achieve the ideal level of accuracy. Especially when dealing with wood boards with irregular shapes or large size differences, the algorithm's generalization ability faces challenges, and it is easy to have false detections or missed detections.

[0009] 3. Limitations of a single camera:

[0010] The main problem with single-camera systems is the limited field of view and depth perception. For large wooden boards or complex scenes, a single camera often cannot fully capture all the details, resulting in some areas becoming blind spots. In addition, the lack of depth information obtained by a single camera also limits its ability to accurately locate in two-dimensional space, which is particularly important for application scenarios that require accurate measurement of defect size or location. Summary of the invention

[0011] The purpose of the present invention is to provide an online detection method for wood board defects based on yolov8 binocular vision to solve the above defects.

[0012] In order to achieve the above object, the present invention provides the following technical solutions:

[0013] A method for online detection of wood board defects based on yolov8 binocular vision, comprising the following steps:

[0014] S1, obtain the defect dataset of furniture wood boards;

[0015] S2. Data annotation of defective pictures of furniture wood boards;

[0016] S3, training the labeled defect data set to obtain weights for wood board defect detection;

[0017] S4, build online detection software interface system through pyside6;

[0018] S5. Load the YOLOv8 online detection model;

[0019] First, you need to integrate the YOLOv8 model and use the deep learning framework of TensorFlow or PyTorch to train the YOLOv8 model;

[0020] S6. Construction of binocular vision hardware system;

[0021] Two MV-CU120-10GM / GC 12-megapixel CMOS Gigabit Ethernet industrial area array cameras are used. The cameras are equipped with Sony IMX226 rolling shutter chips, which can provide high-quality images and fast frame rates to build a binocular vision hardware system. The binocular vision hardware system is connected to the computer via a Gigabit Ethernet cable;

[0022] S7, realize dual-thread online detection;

[0023] The inference model is loaded through the trained YOLOv8 model. The inference model is controlled based on the online detection software interface system and a dual-thread method is used to process the data from the binocular camera, thereby realizing online detection.

[0024] Preferably, in step S3, the labeled defect data set is trained, and its quality evaluation indicators are mainly Average Percision and Mean Average Percision, as follows:

[0025]

[0026] Recalls(n)=0, Precisions(n)=1,

[0027] n = Number of thresholds.

[0028] In the formula, Rcalls(k) refers to the recall rate of the K-th category data, Precisions refers to the detection accuracy of the k-th category, when the recall rate is 0, the accuracy rate is 1; n refers to the number of data categories;

[0029]

[0030] AP k =the AP of class k,

[0031] n = the number of classes

[0032] Where AP k It refers to the average accuracy of the binary classification of this category and other categories in the k-th category data, and n refers to the number of categories of the data;

[0033] After multiple trainings, the weights with the largest AP and MAP values ​​are obtained and applied to the subsequent online detection of wood board defects.

[0034] Preferably, in step S2, data annotation is performed on the defective picture of the furniture wood board, and the specific steps are:

[0035] S21. Classification and labeling: Use the Label Studio model to classify 500 defective images of furniture wood boards into five types of defects: surface defects, surface scratches, surface peeling, surface bubbles, unsealed edges, and black punctuation marks; label each type of defective image with data, including the type and location of the object;

[0036] S22, Normalization: Image data is usually normalized to between 0 and 1 for better processing by the network;

[0037] S23. Data enhancement: In order to improve the generalization ability of the model, various data enhancement techniques such as rotation, scaling, cropping, and color transformation are usually applied to process defective images of furniture wood boards.

[0038] Preferably, in step S5, the YOLOv8 adopts a deep convolutional network, which is responsible for directly predicting bounding boxes and category probabilities from input images; the output of the network is a high-dimensional tensor, usually including multiple prediction layers, each layer corresponding to a different scale.

[0039] Preferably, in step S5, the loss function of the YOLOv8 includes three parts: coordinate loss, confidence loss and classification loss; the coordinate loss is used to penalize the difference between the predicted bounding box and the true box; the confidence loss evaluates the accuracy of the model's prediction of whether there is an object; the classification loss is used to evaluate the accuracy of the predicted category label.

[0040] Preferably, in step S5, the principle of YOLOv8 is:

[0041] The total loss function is the weighted sum of the coordinate loss, confidence loss and classification loss, and its formula is expressed as:

[0042] total loss =λ coord ×coordinate loss +λ conf ×confidence loss +

[0043] λ cls ×classification loss ,

[0044] In the formula, λ coord , conf , cls is the weight coefficient of each part of the loss, which is used to balance the importance of different loss items; coord is the weight coefficient of coordinate loss, coordinate loss is the coordinate loss; λ confis the weight coefficient of confidence loss, loss is the confidence loss; λ cls Refers to the weight coefficient of classification loss, classification loss refers to the classification loss;

[0045] Coordinate loss and total loss: Coordinate loss is an important part of the total loss function, which directly affects the model's prediction accuracy of the target object's location. By minimizing the coordinate loss, the model can learn how to locate the target object more accurately.

[0046] Confidence loss and total loss: Confidence loss also contributes significantly to the total loss, helping the model distinguish which bounding boxes are real and which are not. By minimizing the confidence loss, the model can improve the accuracy of predicting the presence or absence of an object.

[0047] Classification loss and total loss: Classification loss is a key indicator for evaluating the accuracy of the model's prediction of the target object category. When the model successfully locates the target, the classification loss ensures that the model can correctly identify the target category. Classification loss also occupies an important position in the total loss function.

[0048] Coordinate loss, confidence loss, and classification loss together constitute the total loss function of YOLOv8. They are related to each other through weighted summation and jointly affect the training process and final performance of the model.

[0049] Preferably, in step S3, the labeled defect data set is trained, and the training process is specifically as follows: using a large amount of labeled image data for forward propagation and calculating the loss function; adjusting the network parameters through optimization algorithms such as back propagation and gradient descent to minimize the loss function; repeating this process until the network performance reaches a satisfactory level or reaches a preset number of iterations.

[0050] Preferably, in step S7, the reasoning model, its reasoning process includes the following steps:

[0051] (1) Load the weight file obtained by training the YOLOv8 model data. The weight file may contain the following types of information:

[0052] Network structure parameters: These parameters define the architecture of the model, including the weights and biases of the convolutional layers, pooling layers, and fully connected layers, which directly determine how the model processes input data and generates output;

[0053] Feature extraction capability: Through training, the model learns how to extract useful features from the input image. These features are crucial for subsequent tasks such as target detection and classification. The weight file contains the feature extraction parameters that the model continuously optimizes and adjusts during the training process.

[0054] Object detection parameters: For the YOLOv8 object detection model, the weight file also contains parameters for detecting objects, which enable the model to accurately locate and identify objects in the image;

[0055] Hyperparameters: Although the hyperparameters themselves are not directly stored in the weights file, the model training process is significantly affected by these hyperparameters; therefore, the weights file can be considered to indirectly reflect the impact of the hyperparameter settings used during training on the model performance.

[0056] (2) Convert the bbox integral form to 4d bbox format:

[0057] Apply the Softmax function to determine the probability of classification, and use the convolution layer to accurately calculate the position of the bounding box, thereby converting the bbox output by the neural network into a more intuitive and commonly used four-dimensional bounding box format, such as x1, y1, x2, y2;

[0058] (3) Dimension transformation:

[0059] When processing feature maps of different scales, the outputs of multiple feature maps of different scales are concatenated together and the dimensions of the data are adjusted to form a unified format; the outputs of category prediction and bounding box prediction are merged and rearranged so that each element corresponds to a specific area in the original image;

[0060] (4) Decoding and restoring to the original image scale:

[0061] The output coordinates of the image processed in the neural network need to be converted back to the scale of the original image through decoding, the classification prediction is converted into probability through the Sigmoid function, and the bbox prediction needs to be converted back to the actual coordinates in the original image through the algorithm;

[0062] (5)Threshold filtering:

[0063] After obtaining the preliminary prediction results, a threshold is set to remove low-probability predictions and retain predictions with confidence levels higher than the threshold;

[0064] (6) Restore to original image scale and NMS:

[0065] The filtered detection box coordinates are converted back to the original image scale, and non-maximum suppression (NMS) is applied to remove overlapping detection boxes to ensure that each object is detected only once.

[0066] NMS is a commonly used technique to reduce duplicate detections in detection tasks. Ultimately, the number of detection boxes in each image should not exceed a set maximum value.

[0067] The beneficial effects of the present invention are:

[0068] The present invention discloses an online detection method for wooden board defects based on YOLOv8 binocular vision. The depth information provided by the binocular camera is crucial for understanding the two-dimensional features of the defects. Combined with the precise positioning capability of YOLOv8, various subtle surface defects such as cracks, scratches, dents, etc. can be better identified and classified. By utilizing the efficient processing capability of the YOLOv8 algorithm and the depth perception function of the binocular camera, fast and accurate detection of furniture wooden board defects can be achieved. The application of this technology can significantly reduce the labor intensity and time cost of manual detection, while improving the automation level of the detection process. The present invention discloses an online detection method for wooden board defects based on YOLOv8 binocular vision, which has a wider field of view coverage and depth perception capability, can effectively avoid the problem of missed detection caused by viewing angle limitation or insufficient coverage, and can more comprehensively cover the entire wooden board surface even when the wooden board is large or irregular in shape, thereby improving the integrity and reliability of the detection. At the same time, compared with manual visual inspection, it has the advantages of fast detection speed, high detection efficiency, strong stability and low cost; compared with traditional machine vision algorithm models such as YOLO and YOLOv5, it has higher performance and can achieve the goals of fast detection speed and high detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 : Confusion matrix diagram of different categories in the present invention;

[0070] Figure 2 : Different categories of AP values ​​and MAP values ​​of the present invention;

[0071] Figure 3 : Schematic diagram of the interface of the prior detection software of the present invention;

[0072] Figure 4 : Schematic diagram of positioning loss box_loss, confidence loss obj_loss and classification loss cls_loss of the present invention;

[0073] Figure 5 : The reasoning flow chart of the reasoning model of the present invention;

[0074] Figure 6 : Detection result diagram of some wooden boards achieved by the method of the present invention. DETAILED DESCRIPTION

[0075] The present invention is further described below in conjunction with the embodiments. It should be noted that these are merely examples and illustrations of the concept of the present invention. Those skilled in the art may make various modifications or additions to the described specific embodiments or replace them in a similar manner. As long as they do not deviate from the concept of the invention or exceed the scope defined by the claims, they should be deemed to fall within the protection scope of the present invention.

[0076] Embodiment 1:

[0077] like Figure 1-6 As shown, a method for online detection of wood board defects based on yolov8 binocular vision includes the following steps:

[0078] S1. Obtain a dataset of furniture wood board defects. Use an industrial camera to collect the defects of furniture wood boards. The photos must be clear enough for subsequent model detection training.

[0079] S2. Data labeling of defective pictures of furniture wood boards. The specific steps are as follows:

[0080] S21. Classification and labeling: Use the Label Studio model to classify 500 defective images of furniture wood boards into five types of defects: surface defects, surface scratches, surface peeling, surface bubbles, unsealed edges, and black punctuation marks; label each type of defective image with data, including the category and location of the object (usually the bounding box coordinates);

[0081] S22, Normalization: Image data is usually normalized to between 0 and 1 for better processing by the network;

[0082] S23. Data enhancement: In order to improve the generalization ability of the model, various data enhancement techniques such as rotation, scaling, cropping, and color transformation are usually applied to process defective images of furniture wood boards.

[0083] S3. Train the labeled defect data set to obtain weights for wood board defect detection.

[0084] The labeled defect data set is trained, and the training process is as follows: use a large amount of labeled image data for forward propagation and calculate the loss function; adjust the network parameters through optimization algorithms such as back propagation and gradient descent to minimize the loss function; repeat this process until the network performance reaches a satisfactory level or reaches a preset number of iterations.

[0085] The quality evaluation indicators for training the labeled defect data set are mainly Average Percision and Mean Average Percision, as follows:

[0086]

[0087] Recalls(n)=0, Precisions(n)=1,

[0088] n=Number of thresholds.

[0089] In the formula, Rcalls(k) refers to the recall rate of the K-th category data, Precisions refers to the detection accuracy of the k-th category, when the recall rate is 0, the accuracy rate is 1; n refers to the number of data categories;

[0090]

[0091] AP k =the AP of class k,

[0092] n = the number of classes

[0093] Where AP k It refers to the average accuracy of the binary classification of this category and other categories in the k-th category data, and n refers to the number of categories of the data;

[0094] Object detection models are usually described by the speed and precision (mAP) indicator. The higher the mAP value, the better the detection effect of the object detection model on the given dataset. AP: AP (Average Precision) is a core indicator used to measure the comprehensive performance of the model under different recall rates. The higher the AP value, the better the detection effect of the object detection model on the given dataset.

[0095] After multiple trainings, the weights with the largest AP and MAP values ​​are obtained and applied to the subsequent online detection of wood board defects.

[0096] Figure 1 As shown, most of the confusion matrix values ​​are close to 1.00, and good defect detection results are achieved in actual detection.

[0097] Figure 2 are different types of AP values ​​and MAP values ​​of the present invention, such as Figure 2 As shown, the MAP value obtained by the embodiment of the present invention is 0.962, and the accuracy of each category is relatively high, most of which are greater than 99%, and have good results in practical applications.

[0098] S4, build online detection software interface system through pyside6;

[0099] Use pyside6 to create a fixed-size interface with a setting window initial size of 1500x800 pixels and controls for controlling the camera, saving files, displaying detection results, and starting detection. Figure 3 As shown in the figure, pyside6 is used to build a visualization interface, and slot functions are used to bind the model inference results and corresponding buttons. At the same time, functions such as file saving, detection pause, camera recognition, result display, and weight selection are realized.

[0100] S5. Load the YOLOv8 online detection model;

[0101] In order to achieve online detection, we first need to integrate the YOLOv8 model, which is an efficient target detection model suitable for real-time detection tasks; we can use deep learning frameworks such as TensorFlow or PyTorch to train the YOLOv8 model.

[0102] Build a network: YOLOv8, which uses a deep convolutional network that is responsible for directly predicting bounding boxes and category probabilities from the input image; the output of the network is a high-dimensional tensor that usually contains multiple prediction layers, each corresponding to a different scale.

[0103] Define the loss function: The loss function of YOLOv8 usually includes three main parts: coordinate loss, confidence loss and classification loss; the coordinate loss (usually using MSE or IOU-derived loss) is used to penalize the difference between the predicted bounding box and the true box; the confidence loss evaluates the accuracy of the model's prediction of whether there is an object; the classification loss (such as cross entropy loss) is used to evaluate the accuracy of the predicted category label.

[0104] Figure 4 This is a schematic diagram of the positioning loss box_loss, confidence loss obj_loss and classification loss cls_loss of the present invention, as shown in Figure 4 As shown in the figure, the positioning loss box_loss, confidence loss obj_loss and classification loss cls_loss are Figure 4 With the increase of training times, the map and ap values ​​show a decreasing trend, and the final positioning loss box_loss, confidence loss obj_loss and classification loss cls_loss have extremely small values ​​and change slowly after a certain number of training times.

[0105] YOLOv8, its basic principles are:

[0106] The total loss function is the weighted sum of the coordinate loss, confidence loss and classification loss, and its formula can be roughly expressed as:

[0107] totalloss =λ coord ×coordinate loss +λ conf ×confidence loss +

[0108] λ cls ×classification loss ,

[0109] In the formula, λ coord , conf , cls is the weight coefficient of each part of the loss, which is used to balance the importance of different loss items; coord is the weight coefficient of coordinate loss, coordinate loss is the coordinate loss; λ conf is the weight coefficient of confidence loss, loss is the confidence loss; λ cls Refers to the weight coefficient of classification loss, classification loss refers to the classification loss;

[0110] Coordinate loss and total loss: Coordinate loss is an important part of the total loss function, which directly affects the model's prediction accuracy of the target object's location. By minimizing the coordinate loss, the model can learn how to locate the target object more accurately.

[0111] Confidence loss and total loss: Confidence loss also contributes significantly to the total loss, helping the model distinguish which bounding boxes are real (i.e. contain the target) and which are not (i.e. do not contain the target). By minimizing the confidence loss, the model can improve the accuracy of predicting the presence or absence of the target.

[0112] Classification loss and total loss: Classification loss is a key indicator for evaluating the accuracy of the model's prediction of the target object category. When the model successfully locates the target, the classification loss ensures that the model can correctly identify the target category. Classification loss also occupies an important position in the total loss function.

[0113] In summary, coordinate loss, confidence loss, and classification loss together constitute the total loss function of YOLOv8. They are related to each other through weighted summation and jointly affect the training process and final performance of the model.

[0114] S6. Construction of binocular vision hardware system;

[0115] In terms of hardware selection, we use two MV-CU120-10GM / GC 12-megapixel CMOS Gigabit Ethernet industrial array cameras, which are equipped with Sony IMX226 rolling shutter chips, to provide high-quality images and fast frame rates (up to 9.7fps) to build a binocular vision hardware system. The constructed binocular vision hardware system is connected to the computer via a Gigabit Ethernet cable, which is very suitable for real-time detection systems. The Gigabit Ethernet interface ensures fast data transmission, which is crucial for real-time detection systems.

[0116] S7, realize dual-thread online detection;

[0117] The inference model is loaded through the trained YOLOv8 model. The inference model is controlled based on the online detection software interface system and a dual-thread method is used to process the data from the binocular camera to achieve online detection.

[0118] By clicking the button of the camera icon in the online detection software interface system, the connected binocular vision system camera is turned on for shooting. The binocular vision system displays the real-time shooting screen data collected on the two boxes on the left of the online detection software interface system. At the same time, the collected data is used as the input of the YOLOv8 model. After the YOLOv8 model real-time detection output is output on the two boxes on the right of the online detection software interface system, by checking whether the online detection software interface system is saved, the detection results are saved as video avi format, and the YOLOv8 model detection confidence can be adjusted by sliding the slider in the online detection software interface system, and different YOLOv8 model weight files can also be selected. The binocular vision hardware system is connected to the computer via a gigabit network cable.

[0119] Figure 5 is the inference flow chart of the inference model of the present invention, such as Figure 5 As shown, the reasoning process of the reasoning model includes the following steps:

[0120] (1) Load the weight file obtained by training the YOLOv8 model data. The weight file may contain the following types of information:

[0121] Network structure parameters: These parameters define the architecture of the model, including the weights and biases of network layers such as convolutional layers, pooling layers, and fully connected layers. They directly determine how the model processes input data and generates output;

[0122] Feature extraction capability: Through training, the model learns how to extract useful features from the input image. These features are crucial for subsequent tasks such as target detection and classification. The weight file contains the feature extraction parameters that the model continuously optimizes and adjusts during the training process.

[0123] Object detection parameters: For the YOLOv8 object detection model, the weight file also contains parameters for detecting objects, such as the coordinates, size, confidence of the bounding box, and the class probability of the object in each bounding box. These parameters enable the model to accurately locate and identify objects in the image;

[0124] Hyperparameters: Although hyperparameters (such as learning rate, batch size, number of iterations, etc.) themselves are not directly stored in the weight files, the model training process is significantly affected by these hyperparameters; therefore, it can be considered that the weight files indirectly reflect the impact of the hyperparameter settings used in the training process on the model performance.

[0125] (2) Convert the bbox integral form to 4d bbox format:

[0126] Apply the Softmax function to determine the probability of classification, and use the convolutional layer (Conv) to accurately calculate the position of the bounding box, thereby converting the bbox output by the neural network into a more intuitive and commonly used four-dimensional bounding box format, such as x1, y1, x2, y2;

[0127] (3) Dimension transformation:

[0128] When processing feature maps of different scales, the outputs of multiple feature maps of different scales are concatenated together and the dimensions of the data are adjusted to form a unified format; the outputs of category prediction and bounding box prediction are merged and rearranged so that each element corresponds to a specific area in the original image;

[0129] (4) Decoding and restoring to the original image scale:

[0130] The output coordinates of the image processed in the neural network need to be converted back to the scale of the original image through decoding, the classification prediction is converted into probability through the Sigmoid function, and the bbox prediction needs to be converted back to the actual coordinates in the original image through the algorithm;

[0131] (5)Threshold filtering:

[0132] After obtaining the preliminary prediction results, a threshold is set to remove low-probability predictions and retain predictions with confidence levels higher than the threshold;

[0133] (6) Restore to original image scale and NMS:

[0134] The filtered detection box coordinates are converted back to the original image scale, and non-maximum suppression (NMS) is applied to remove overlapping detection boxes to ensure that each object is detected only once.

[0135] NMS is a commonly used technique to reduce duplicate detections in detection tasks. Ultimately, the number of detection boxes in each image should not exceed the set maximum value (max_per_img).

[0136] This entire process ensures accurate conversion from raw network output to detection results available to end users and is an indispensable part of modern object detection systems.

[0137] In order to make full use of computing resources and improve detection efficiency, we will use a dual-threaded method to process data from the binocular cameras. The data processing of each camera will be performed in an independent thread, so that the data of two perspectives can be processed in parallel at the same time, improving the response speed and processing capacity of the system.

[0138] The dual-threaded loading inference model is used to detect the content collected by two cameras at the same time. Its principle is mainly based on multi-threaded processing technology, which allows the system to perform multiple tasks at the same time, thereby improving processing efficiency and response speed. The following is the basic principle of realizing this function:

[0139] (1) Multithreaded parallel processing: In computers, a thread is the smallest unit that the operating system can schedule operations on. By creating two threads, each thread is responsible for collecting and processing data from one camera, the data from two cameras can be processed simultaneously without waiting for the other to complete processing.

[0140] (2) Loading and application of inference model: The inference model uses the trained YOLOv8 model to analyze and make decisions on the input data. In a dual-threaded system, each thread can independently load the same or different models to process the data from its own camera. This means that the loading and execution of the model are parallel, and each thread processes its own data stream.

[0141] (3) Resource allocation and synchronization: When executing multiple threads, it is necessary to consider resource sharing and synchronization between threads to ensure that no data conflicts or resource contention occur. Therefore, additional synchronization mechanisms (such as mutex locks) are used to avoid conflicts.

[0142] Figure 6 The detection result diagram of some wooden boards implemented by the method of the present invention is as follows: Figure 6 As shown, defects in the wood boards such as black spots, no edge banding, scratches, etc. have been accurately marked.

[0143] The present invention provides an online detection method for wood board defects based on yolov8 binocular vision, which has the following advantages over the prior art:

[0144] (1) Higher detection accuracy and speed: As the latest generation of real-time object detection system, YOLOv8 has significant improvements in network structure and algorithm optimization compared to previous versions such as YOLOv5 and YOLOv7, and can identify and locate defects in images more quickly and accurately.

[0145] (2) Effective use of depth information: The binocular vision system can capture the depth information of the scene by using two cameras simultaneously to simulate human binocular vision. When combined with YOLOv8, it can not only perform traditional plane detection, but also perform more complex spatial defect detection based on the depth information of the object.

[0146] (3) Real-time performance: YOLOv8 optimizes computational efficiency, especially when accelerated by GPU, and can achieve real-time detection at a high frame rate. This is particularly important for defect detection online or on production lines, as it can provide instant feedback on detection results and quickly eliminate production defects.

[0147] (4) Powerful generalization capability: Through large-scale data training, YOLOv8 has good generalization capability and can adapt to defect detection in various environments, reducing detection errors caused by environmental changes.

[0148] (5) Easy to integrate and expand: YOLOv8 supports multiple programming languages ​​and platforms, making it easy to integrate into existing industrial vision systems. At the same time, its model structure allows flexible modification and expansion to adapt to specific application requirements.

[0149] (6) Low cost: Compared with other advanced deep learning models, YOLOv8 has relatively low hardware requirements while maintaining high performance, which can significantly reduce deployment costs.

[0150] The present invention discloses an online detection method for wood board defects based on yolov8 binocular vision. By using two cameras to simulate human binocular vision, the depth information of the object can be obtained, which is of great significance for accurately identifying and locating object defects. In the detection of furniture wood board defects, the application of binocular cameras can not only improve the accuracy of defect detection, but also expand the detection range. Compared with a single camera system, the binocular camera has a wider field of view coverage and depth perception ability, which can effectively avoid the problem of missed detection caused by viewing angle limitation or insufficient coverage. This means that even when the wood board is large or irregular in shape, the binocular camera system can more comprehensively cover the entire wood board surface, thereby improving the integrity and reliability of the detection. In addition, the depth information obtained by the binocular camera system can also help determine the type and severity of the defect. For example, some surface defects such as scratches or dents may not be easily distinguished in a plane image, but by analyzing the depth information, the specific features of these defects, such as depth, shape and size, can be more clearly identified, so as to more accurately classify and evaluate the defect type. This precise defect recognition and evaluation provides important decision support for subsequent quality control and repair work, and helps to improve the quality of the final product.

[0151] The present invention discloses an online detection method for wood board defects based on YOLOv8 binocular vision. Compared with manual visual detection, the method has the advantages of fast detection speed, high detection efficiency, strong stability, and low cost. Compared with traditional machine vision algorithm models such as YOLO and YOLOv5, the method has higher performance and can achieve the purpose of fast detection speed and high detection accuracy. Combining the YOLOv8 algorithm and binocular camera for online detection of furniture wood boards can not only realize efficient and automated detection process, but also significantly improve the accuracy and reliability of detection. This has important research and application value for improving production efficiency, reducing costs, and ensuring product quality.

[0152] The above is an exemplary description of the invention. Obviously, the specific implementation of the present invention is not limited to the above-mentioned method. As long as such non-substantial improvements are made by adopting the method concept and technical solution of the present invention, or the concept and technical solution of the invention are directly applied to other occasions without improvement, they are all within the protection scope of the present invention.

Claims

1. A method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that The following steps are involved: S1, obtain the defect dataset of furniture wood boards; S2. Data annotation of defective pictures of furniture wood boards; S3, training the labeled defect data set to obtain weights for wood board defect detection; S4, build online detection software interface system through pyside6; S5. Load the YOLOv8 online detection model; First, you need to integrate the YOLOv8 model and use the deep learning framework of TensorFlow or PyTorch to train the YOLOv8 model; S6. Construction of binocular vision hardware system; Two MV-CU120-10GM / GC 12-megapixel CMOS Gigabit Ethernet industrial area array cameras are used. The cameras are equipped with Sony IMX226 rolling shutter chips, which can provide high-quality images and fast frame rates to build a binocular vision hardware system. The binocular vision hardware system is connected to the computer via a Gigabit Ethernet cable; S7, realize dual-thread online detection; The inference model is loaded through the trained YOLOv8 model. The inference model is controlled based on the online detection software interface system and a dual-thread method is used to process the data from the binocular camera, thereby realizing online detection.

2. According to claim 1, a method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that In step S3, the labeled defect data set is trained, and its quality evaluation indicators are mainly AveragePercision and Mean AveragePercision, as follows: In the formula, Rcalls(k) refers to the recall rate of the K-th category data, Precisions refers to the detection accuracy of the k-th category, when the recall rate is 0, the accuracy rate is 1; n refers to the number of categories of data; Where AP k It refers to the average accuracy of the two-category classification of this category and other categories in the k-th category data, and n refers to the number of categories of the data; After multiple trainings, the weights with the largest AP and MAP values ​​are obtained and applied to the subsequent online detection of wood board defects.

3. According to claim 1, a method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that In step S2, data annotation is performed on the defective images of furniture wood boards. The specific steps are as follows: S21. Classification and labeling: Use the Label Studio model to classify 500 defect images of furniture wood boards into five types of defects: surface defects, surface scratches, surface peeling, surface bubbles, no edge sealing, and black punctuation. Data annotation is performed for each type of defect image, including the category and location of the object; S22, Normalization: Image data is usually normalized to between 0 and 1 for better processing by the network; S23. Data enhancement: In order to improve the generalization ability of the model, various data enhancement techniques such as rotation, scaling, cropping, and color transformation are usually applied to process defective images of furniture wood boards.

4. According to claim 1, a method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that In step S5, the YOLOv8 adopts a deep convolutional network, which is responsible for directly predicting bounding boxes and category probabilities from input images; the output of the network is a high-dimensional tensor, usually containing multiple prediction layers, each layer corresponding to a different scale.

5. According to claim 1, a method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that In step S5, the loss function of the YOLOv8 includes three parts: coordinate loss, confidence loss and classification loss; the coordinate loss is used to penalize the difference between the predicted bounding box and the true box; the confidence loss evaluates the accuracy of the model's prediction of whether there is an object; the classification loss is used to evaluate the accuracy of the predicted category label.

6. According to claim 5, a method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that In step S5, the principle of YOLOv8 is as follows: The total loss function is the weighted sum of the coordinate loss, confidence loss and classification loss, and its formula is expressed as: total loss =λ coord ×coordinate loss +λ conf ×confidence loss + l cls ×classification loss , In the formula, λ coord , conf , cls is the weight coefficient of each part of the loss, which is used to balance the importance of different loss items; coord is the weight coefficient of coordinate loss, coordinate loss is the coordinate loss; λ conf is the weight coefficient of confidence loss, loss is the confidence loss; λ cls Refers to the weight coefficient of classification loss, classification loss refers to the classification loss; Coordinate loss and total loss: Coordinate loss is an important part of the total loss function, which directly affects the model's prediction accuracy of the target object's location. By minimizing the coordinate loss, the model can learn how to locate the target object more accurately. Confidence loss and total loss: Confidence loss also contributes significantly to the total loss, helping the model distinguish which bounding boxes are real and which are not. By minimizing the confidence loss, the model can improve the accuracy of predicting the presence or absence of an object. Classification loss and total loss: Classification loss is a key indicator for evaluating the accuracy of the model's prediction of the target object category. When the model successfully locates the target, the classification loss ensures that the model can correctly identify the target category. Classification loss also occupies an important position in the total loss function. Coordinate loss, confidence loss, and classification loss together constitute the total loss function of YOLOv8. They are related to each other through weighted summation and jointly affect the training process and final performance of the model.

7. According to claim 1, a method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that In step S3, the labeled defect data set is trained, and the training process is specifically as follows: a large amount of labeled image data is used for forward propagation to calculate the loss function; the network parameters are adjusted through optimization algorithms such as back propagation and gradient descent to minimize the loss function; this process is repeated until the network performance reaches a satisfactory level or the preset number of iterations is reached.

8. According to claim 1, a method for online detection of wood board defects based on yolov8 binocular vision, It is characterized in that In step S7, the reasoning model, its reasoning process includes the following steps: (1) Load the weight file obtained by training the YOLOv8 model data. The weight file may contain the following types of information: Network structure parameters: These parameters define the architecture of the model, including the weights and biases of the convolutional layers, pooling layers, and fully connected layers, which directly determine how the model processes input data and generates output; Feature extraction capability: Through training, the model learns how to extract useful features from the input image. These features are crucial for subsequent tasks such as target detection and classification. The weight file contains the feature extraction parameters that the model continuously optimizes and adjusts during the training process. Object detection parameters: For the YOLOv8 object detection model, the weight file also contains parameters for detecting objects, which enable the model to accurately locate and identify objects in the image; Hyperparameters: Although the hyperparameters themselves are not directly stored in the weights file, the model training process is significantly affected by these hyperparameters; therefore, the weights file can be considered to indirectly reflect the impact of the hyperparameter settings used during training on the model performance. (2) Convert the bbox integral form to 4d bbox format: Apply the Softmax function to determine the probability of classification, and use the convolution layer to accurately calculate the position of the bounding box, thereby converting the bbox output by the neural network into a more intuitive and commonly used four-dimensional bounding box format, such as x1, y1, x2, y2; (3) Dimension transformation: When processing feature maps of different scales, the outputs of multiple feature maps of different scales are concatenated together and the dimensions of the data are adjusted to form a unified format; the outputs of category prediction and bounding box prediction are merged and rearranged so that each element corresponds to a specific area in the original image; (4) Decoding and restoring to the original image scale: The output coordinates of the image processed in the neural network need to be converted back to the scale of the original image through decoding, the classification prediction is converted into probability through the Sigmoid function, and the bbox prediction needs to be converted back to the actual coordinates in the original image through the algorithm; (5)Threshold filtering: After obtaining the preliminary prediction results, a threshold is set to remove low-probability predictions and retain predictions with confidence levels higher than the threshold; (6) Restore to original image scale and NMS: The filtered detection box coordinates are converted back to the original image scale, and non-maximum suppression (NMS) is applied to remove overlapping detection boxes to ensure that each object is detected only once. NMS is a commonly used technique to reduce duplicate detections in detection tasks. Ultimately, the number of detection boxes in each image should not exceed a set maximum value.

Citation Information

Patent Citations

  • Pipeline defect identification and positioning method based on target detection and binocular vision

    CN114067197A

  • Target detection method for stereoscopic vision depth perception learning

    CN116883990A

  • Wood defect detection method and system based on deep neural network

    CN117876663A

  • Roadblock detection and distance measurement method

    CN118351513A

Cited By

  • Method for identifying and counting multiphase flow bubbles based on improved YOLOv8

    CN119274043A

  • A method for identifying and counting bubbles in multiphase flow based on improved YOLOv8

    CN119274043B

  • Quality detection method, device and equipment based on metal ingot and storage medium

    CN119887768A

  • Composite material plate pit and dirt detection method based on machine vision

    CN119901747A

  • Plate edge sealing defect online detection method and device based on machine vision

    CN120219294A