An eucalyptus veneer defect detection method for optimizing a target detection model
By improving the YOLOv7 model and combining it with the ASPP and SE modules, the eucalyptus veneer images are preprocessed and labeled, solving the problem that existing technologies cannot accurately identify the size and location of wood defects, and achieving efficient and accurate eucalyptus veneer defect detection.
Patent Information
- Application Number
- CN202310555961.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-17
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-05-17
AI Technical Summary
Existing technologies struggle to accurately identify the size and location of defects in wood defect detection, and their accuracy in industrial applications suffers from significant errors, failing to meet the demands of industrial production.
An improved YOLOv7 target detection algorithm model was used to preprocess and label eucalyptus veneer image data. By increasing the model depth and width and combining ASPP and SE modules, the model was trained to improve its detection capability and identify the type, size and location of defects in eucalyptus veneer.
It significantly improves the accuracy and robustness of eucalyptus veneer defect detection, enabling rapid and accurate identification of the size, location, and type of defects, thus meeting the needs of industrialized production.
Smart Images

Figure CN116630261B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of intelligent wood processing, and relates to an eucalyptus veneer defect detection method for optimizing a target detection model. BACKGROUND
[0002] Wood has been used as furniture and building structure material for a long time due to its natural renewable, heat preservation, electrical insulation, high strength-to-weight ratio and other characteristics. Before wood products are processed, wood veneer needs to be detected for defects. Traditional manual detection is affected by objective factors such as visual fatigue, surrounding environment and subjective judgment, and is not efficient. Therefore, wood defect detection is gradually replaced by machines and changes to intelligentization. Since the 1990s, computer technology has been increasingly valued with the in-depth study of modern science and automation, and artificial intelligence has gradually emerged and rapidly developed. Artificial intelligence is a technology that simulates human thinking for computer intelligence by combining multiple algorithms and statistical theory. Artificial intelligence takes machine learning as the core, continuously learns from algorithms, finds potential relationships from massive data, and builds models.
[0003] Most of the wood defect recognition at home and abroad currently adopts a traditional digital image processing method. First, the image is preprocessed by using grayscale transformation, histogram equalization, spatial domain or frequency domain filtering and the like. Then, wood defect segmentation and wood defect feature extraction are performed on the wood defect image. Finally, the image is recognized by using a traditional machine learning algorithm. Scholars have made a lot of research on the feature-based method for rapid detection of wood defects. However, the traditional digital image processing method for wood defect recognition can only detect the type of wood defect, and cannot recognize the size and position of the wood defect, so it cannot meet the needs of industrial production.
[0004] The common feature of the above method is that the color, shape and size of the wood defect need to be manually designed. With the development of machine vision technology from feature engineering method to deep learning method, the wood defect detection based on deep learning image target detection and image segmentation task is upgraded from traditional machine learning based digital image processing. The feature of deep learning technology is that it does not need human design, and the network learns by itself. Meanwhile, it has great advantage in detecting big data. Deep learning combined with wood defect detection theory has great potential in the field of wood defect detection. Liu et al. proposed a CNN based on split-shuffle residual module, with an accuracy of 94.86% in wood color and texture classification; Gao et al. used transfer learning and ResNet34 to classify seven types of knots; Yang et al. used deep extreme learning to classify dead knot, live knot and rotten knot with an accuracy of 96.72%. The above methods can only classify defects, cannot identify the size and position of wood defects, and have certain limitations. On the other hand, the recognition accuracy still has a large recognition error rate when applied to the field of industrialized wood processing, which increases the processing cost. SUMMARY
[0005] In view of the problems in the prior art, the present application provides an eucalyptus veneer defect detection method for optimizing target detection model, and constructs an efficient and high-precision eucalyptus veneer defect intelligent detection system. By using the target detection algorithm to detect the defects of the classified defectable veneer, the defect area can be automatically detected, and different types of defects can also be identified. In digital form, the output is convenient for subsequent repair processing.
[0006] To achieve the above purpose, the present application is realized by the following technical measures.
[0007] The present application provides an eucalyptus veneer defect detection method for optimizing target detection model, mainly including the following steps:
[0008] SⅠ, collecting eucalyptus veneer original image data set;
[0009] SⅡ, preprocessing the original image data according to the color and defect characteristics of eucalyptus veneer;
[0010] SⅢ, labeling the eucalyptus veneer defects in the preprocessed original image data, generating image data with defect label file, and taking it as training set;
[0011] SⅣ, training based on improved YOLOv7 model for training set, getting trained and optimized target detection model model;
[0012] The improved YOLOv7 model has the following specific improvement methods:
[0013] IV-1, on the basis of the original YOLOv7 model, 1-5 convolution layers and 1-5 pooling layers are added respectively, thereby increasing the depth of the model; the convolution kernel size is modified from 3*3 to 1*1 to 9*9 to expand the width of the model;
[0014] IV-2, add the ASPP module code to the end of the common file, add the class name in the yolo file, and add [-1, 1, ASPP,
[1024] ] to the convolution layer of the backbone module in the yolov7_ASPP.yaml file;
[0015] IV-3, first add the SE module code to the end of the yolov7.models file and add the SE class name, add [-1, 1, SE,
[1024] ] to the layer before SPPF, the subsequent number of this layer network will change, so the from parameter of Detect in the Head part needs to be modified to [18, 21, 24]; Similarly, because the SE is added to the 9th layer, the numbers after the 9th layer are all increased by 1, so the from coefficients of Concat in the Head part need to be modified to [-1, 15] and [-1, 11]; In the train.py file, add the SE module file path after the default parameter of --cfg;
[0016] SⅤ, input the eucalyptus veneer image data to be detected into the optimized target detection model model, and the optimized target detection model model outputs the eucalyptus veneer image data with defect marking file.
[0017] In this paper, the improved YOLOv7 model is improved based on the original YOLOv7 target detection algorithm model, which is derived from the network open source platform.
[0018] In this paper, the collection of eucalyptus veneer original image data set in step SⅠ is in accordance with the conventional image data collection method in this technical field, for example, through conventional photography or industrial imaging.
[0019] In one of the technical solutions, the collection of eucalyptus veneer original image data set in step SⅠ can be achieved by shooting the eucalyptus veneer with a size of 1.27m*0.63m through an industrial camera, and the resolution of the obtained original image data is not less than 1920*1080, and the image bit depth is not less than 8. The obtained original image data contains a certain number of conventional eucalyptus veneer defects such as live knot, dead knot, missing knot and burr.
[0020] In this paper, the original image data is preprocessed according to the color and defect characteristics of the eucalyptus veneer in step SII. The purpose is to expand the data set, increase the generalization ability and robustness of the model, and improve the training efficiency and speed. The preprocessing method can refer to the conventional preprocessing method in the technical field or the conventional image preprocessing method based on deep convolutional neural network image recognition algorithm. The technical personnel can directly query the relevant literature to obtain it.
[0021] In one of the technical solutions, the original image data is preprocessed according to the color and defect characteristics of the eucalyptus veneer in step SII. The preprocessing method is to preprocess the original image data by using any one or more of gamma transformation, Laplace transformation, random cropping, random horizontal flipping, Gaussian blur, Gaussian noise and salt and pepper noise.
[0022] In this paper, the original image data is preprocessed according to the color and defect characteristics of the eucalyptus veneer in step SII. The purpose is to expand the data set, increase the generalization ability and robustness of the model, and improve the training efficiency and speed. The preprocessing method can refer to the conventional preprocessing method in the technical field or the conventional image preprocessing method based on deep convolutional neural network image recognition algorithm. The technical personnel can directly query the relevant literature to obtain it.
[0023] In one of the technical solutions, the original image data is preprocessed according to the color and defect characteristics of the eucalyptus veneer in step SII. The preprocessing method is to preprocess the original image data by using any one or more of gamma transformation, Laplace transformation, random cropping, random horizontal flipping, Gaussian blur, Gaussian noise and salt and pepper noise.
[0024] In one of the technical solutions, the original image data is preprocessed according to the color and defect characteristics of the eucalyptus veneer in step SII. The preprocessing method is to preprocess the original image data by using any one or more of gamma transformation, Laplace transformation, random cropping, random horizontal flipping, Gaussian blur, Gaussian noise and salt and pepper noise.
[0025] In one preferred technical solution, the improved YOLOv7 model in step SIV is trained for the training set. The inventors have also found in the experimental process that, when aiming at a single technical purpose of eucalyptus veneer defect detection, the accuracy and efficiency of training can be significantly improved by setting special hyperparameters and learning rates, specifically, setting the batch size of the hyperparameters to 24, and the learning rate to 0.001. In addition, in order to prevent model overfitting, L1 and L2 regularization is also included. L1 regularization reduces model complexity by increasing the sum of absolute values of model parameters, and L2 regularization reduces model complexity by increasing the sum of squares of model parameters. Both of these regularization techniques can effectively avoid model overfitting, but L1 regularization can also be used for feature selection because it tends to make the weights of some features zero, thereby achieving the purpose of feature selection. Regularization processing can improve the generalization ability of the model, so that the model not only fits the training data well, but also adapts to new unseen data.
[0026] It should be noted that the ASPP (Atrous Spatial Pyramid Pooling) module code used in the present application is preferably modified from the original ASPP module code, and the specific code is as follows:
[0027]
[0028]
[0029] It should be noted that the SE (Squeeze-and Excitation) module code used in the present application is preferably modified from the original SE module code, and the specific code is as follows:
[0030]
[0031]
[0032] The present application has the following beneficial effects:
[0033] 1. The eucalyptus veneer defect detection method provided by the technical scheme of the present application improves the original YOLOv7 model, first adjusts the model structure, increases the model depth and width, improves the representation ability and learning ability of the model, thereby improving the detection accuracy and robustness of the model; secondly, a more detailed feature pyramid structure is adopted to extract more and richer feature information of the defect, and attention mechanism multi-scale fusion and other technical means are introduced to strengthen the attention and recognition ability of the model to the defect area; finally, data enhancement, multi-task learning and other methods are combined to comprehensively improve the detection ability and accuracy of the model. Through the above improvement method, the recognition accuracy of the final model is further significantly enhanced.
[0034] 2. The technical scheme of the present application is based on the deep eucalyptus veneer defect detection field, further improves the original YOLOv7 model to further adapt to eucalyptus veneer defect detection, and through comparison, it is found that the selection and setting position of the ASPP module and the SE module will greatly affect the recognition accuracy of the final model.
[0035] 3. The eucalyptus veneer defects (such as dead knots, live knots and burrs) targeted by the technical scheme of the present application have randomness and contingency in size, position and quantity, and different veneer styles are different. Without prior knowledge of size, position and quantity, the optimized target detection model can still accurately and quickly frame the defects on different veneers. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 The structure diagram of the improved YOLOv7 model in the specific embodiment of the present application.
[0037] Figure 2 The flowchart of the eucalyptus veneer defect detection method of an optimized target detection model in the specific embodiment of the present application.
[0038] Figure 3 The visual diagram of the eucalyptus veneer image data output with the defect label file in embodiment 1 of the present application. The upper image is the eucalyptus veneer image that needs to be detected, and the lower image is the visual diagram of the eucalyptus veneer image data output with the defect label file. DETAILED DESCRIPTION
[0039] For a further understanding of the present application, preferred embodiments thereof will be described in conjunction with examples, it being understood, however, that this description is made only by way of further illustration and is not intended to limit the scope of the claimed application. Those skilled in the art can adapt the process parameters to the specific needs of the process. It is specifically noted that all such stylistic departures are intended to be within the scope of the present application. The methods and applications of the present application have been described by preferred embodiments, and those skilled in the art can obviously make changes or appropriate changes and combinations to the methods and applications described herein without departing from the content, spirit and scope of the present application, to realize and apply the present application. Although it is believed that the following terms are well understood by those skilled in the art, the following definitions are set forth to facilitate the understanding of the subject matter disclosed herein.
[0040] The present application provides an eucalyptus veneer defect detection method for optimizing a target detection model, mainly comprising the following steps:
[0041] SⅠ, collecting eucalyptus veneer original image data set;
[0042] SⅡ, preprocessing the original image data according to the color and defect characteristics of eucalyptus veneer;
[0043] SⅢ, labeling the eucalyptus veneer defects in the preprocessed original image data, generating image data with defect label file, and taking it as training set;
[0044] SⅣ, training based on improved YOLOv7 model for training set, getting trained optimized target detection model model;
[0045] Among them, the specific improvement method of the improved YOLOv7 model is as follows:
[0046] Ⅳ-1, on the basis of original YOLOv7 model, 1-5 convolution layers and 1-5 pooling layers are added respectively, so as to increase the depth of the model; the convolution kernel size is modified from 3*3 to 1*1 to 9*9, so as to expand the width of the model;
[0047] Ⅳ-2, add ASPP module code to the end of common file, add class name in yolo file, and add [-1, 1, ASPP,
[1024] ] to the convolution layer of backbone module in yolov7_ASPP.yaml file;
[0048] IV-3, first add the SE module code to the end of the yolov7.models file and add the SE class name, add [-1, 1, SE,
[1024] ] to the layer before SPPF, the subsequent number of the layer network will change, so the from parameter of Detect in the Head part needs to be modified to [18, 21, 24]; Similarly, because the SE is added to the 9th layer, the numbers after the 9th layer are all increased by 1, so the from coefficients of Concat in the Head part need to be modified to [-1, 15] and [-1, 11]; In the train.py file, add the SE module file path after the default parameter of --cfg;
[0049] SⅤ, input the eucalyptus veneer image data to be detected into the optimized target detection model model, and the optimized target detection model model outputs the eucalyptus veneer image data with a defect label file.
[0050] In this paper, the improved YOLOv7 model is based on the original YOLOv7 target detection algorithm model, which is derived from the network open source platform.
[0051] In this paper, the collection of eucalyptus veneer original image data set in step SⅠ is in accordance with the conventional image data collection method in the technical field, and in one embodiment, the conventional photography method or the industrial imaging method is selected for collection.
[0052] In one embodiment, the collection of eucalyptus veneer original image data set in step SⅠ can be achieved by shooting the eucalyptus veneer with a size of 1.27m x 0.63m using an industrial camera, and the resolution of the obtained original image data is not less than 1920x1080, and the image bit depth is not less than 8. The obtained original image data contains a certain number of conventional eucalyptus veneer defects such as knots, dead knots, missing knots and burrs.
[0053] In this paper, the original image data is preprocessed according to the color and defect characteristics of eucalyptus veneer in step SⅡ, which aims to expand the data set, increase the generalization ability and robustness of the model, and thus improve the training efficiency and speed. The pre-processing method can refer to the conventional pre-processing method in the technical field, or the conventional image pre-processing method based on deep convolutional neural network image recognition algorithm, which can be directly obtained by referring to relevant literature.
[0054] In one embodiment, the preprocessing of the original image data in step SII is based on the color and defect characteristics of the eucalyptus veneer, and the preprocessing specifically includes any one or more of gamma transformation, Laplace transformation, random cropping, random horizontal flipping, Gaussian blur, Gaussian noise, and salt and pepper noise.
[0055] In this context, the labeling of the eucalyptus veneer defects in the preprocessed original image data in step SIII generates image data with defect label files, which serves as the training set. The labeling methods include, but are not limited to, manual labeling and software-assisted labeling. In one embodiment, the labeled content includes the eucalyptus veneer defect type (such as common eucalyptus veneer defects such as knots, dead knots, missing knots, and burrs), the eucalyptus veneer defect size (such as the size calculated by the defect contour area), and the eucalyptus veneer defect position (such as the defect center point or contour point coordinate value).
[0056] In one embodiment, the labeling of the eucalyptus veneer defects in the preprocessed original image data in step SIII generates image data with defect label files, which serves as the training set. The labeling methods include, but are not limited to, manual labeling and software-assisted labeling. In one embodiment, the labeled content includes the eucalyptus veneer defect type (such as common eucalyptus veneer defects such as knots, dead knots, missing knots, and burrs), the eucalyptus veneer defect size (such as the size calculated by the defect contour area), and the eucalyptus veneer defect position (such as the defect center point or contour point coordinate value).
[0057] In one embodiment, step SIII further includes screening the preprocessed original image data to improve the accuracy and efficiency of the training. The specific screening method is to classify the eucalyptus veneer defects so that the number of each type of eucalyptus veneer defect in the preprocessed original image data set tends to be consistent. In one preferred embodiment, the number of labeled eucalyptus veneer defects in step SIII is such that the number of knot labels = the number of dead knot labels = the number of burr labels. The imbalance in the number of defects of each type can reduce the learning effect of the model. When the number of labels for a certain type of defect is too large and the number of labels for another type of defect is too small, the model will show better learning rate for the features with more labels, i.e., better recognition effect, and vice versa, which will result in a decrease in the overall recognition accuracy.
[0058] In one preferred embodiment, the improved YOLOv7 model in step SIV is trained on the training set. The inventors have also found that, when detecting eucalyptus veneer defects for a single technical purpose, setting special hyperparameters and learning rates can significantly improve the accuracy and efficiency of training. Specifically, the batch size is set to 24, and the learning rate is set to 0.001. In addition, to prevent model overfitting, L1 and L2 regularization are also used. L1 regularization reduces model complexity by increasing the sum of the absolute values of model parameters, while L2 regularization reduces model complexity by increasing the sum of the squares of model parameters. Both of these regularization techniques can effectively prevent model overfitting, but L1 regularization can also be used for feature selection because it tends to make the weights of some features zero, thereby achieving the purpose of feature selection. Regularization can improve the generalization ability of the model, so that the model not only fits the training data well, but also adapts to new unseen data.
[0059] In one embodiment, the ASPP (Atrous Spatial Pyramid Pooling) module code used in the present application is modified based on the original ASPP module code, and the specific code is as follows:
[0060]
[0061]
[0062] In one embodiment, the SE (Squeeze-and Excitation) module code used in the present application is modified based on the original SE module code, and the specific code is as follows:
[0063]
[0064] The present application will be further explained in detail with reference to the following examples. However, those skilled in the art will understand that these examples are provided only for illustrative purposes and are not intended to limit the scope of the present application.
[0065] Examples
[0066] The embodiments of the present application will be described in detail below with reference to the examples, but those skilled in the art will understand that the following examples are provided only for illustrative purposes and should not be considered as limiting the scope of the present application. If no specific conditions are specified in the examples, the conventional conditions or the conditions recommended by the manufacturer are used. If no manufacturer of the reagent or instrument is specified, it is a conventional product that can be obtained by purchase. The present application should not be interpreted as being limited to the specific examples described.
[0067] Embodiment 1
[0068] The eucalyptus veneer defect detection method of the embodiment for optimizing the target detection model comprises the following steps:
[0069] S I, collect eucalyptus veneer original image data set;
[0070] Through a 2000 million pixel CMOS industrial camera matched with a 1 inch 8 mm lens, set the shooting distance to 0.8 m, and shoot the eucalyptus veneer with a width of 1.27 m x 0.63 m. The resolution of the obtained original image data is 5472 x 3648, the image bit depth is 24, and the color space is RGB. The original image data obtained by shooting contains different numbers of conventional eucalyptus veneer defects such as knots, dead knots, missing knots, burrs, etc.
[0071] S II, preprocess the original image data according to the color and defect characteristics of eucalyptus veneer;
[0072] S III, mark the eucalyptus veneer defects in the preprocessed original image data, generate image data with defect mark files, and filter the image data according to the eucalyptus veneer defect classification, so that the total number of each eucalyptus veneer defect mark tends to be consistent, which is used as a training set;
[0073] Wherein, the marking is specifically artificial marking of the preprocessed original image data using labelme software, and generating image data with defect mark files using the software, wherein the content of the defect mark file includes defect type, defect size and defect position;
[0074] S IV, train the improved YOLOv7 model based on the training set to obtain the trained optimized target detection model model;
[0075] Wherein, the specific improvement method of the improved YOLOv7 model is as follows:
[0076] IV-1, on the basis of the original YOLOv7 model, 5 convolution layers and 5 pooling layers are added respectively, so as to increase the depth of the model; the convolution kernel size is modified from 3*3 to 1*1 to 9*9, so as to expand the width of the model;
[0077] IV-2, add the ASPP module code to the end of the common file, add the class name in the yolo file, and add [-1, 1, ASPP,
[1024] ] to the convolution layer of the backbone module in the yolov7_ASPP.yaml file;
[0078] IV-3, first add the SE module code to the end of the yolov7.models file and add the SE class name, add [-1, 1, SE,
[1024] ] to the layer before SPPF, the subsequent number of the network will change, so modify the from parameter of Detect in the Head part to [18, 21, 24]; Similarly, because the SE is added to the 9th layer, the numbers after the 9th layer are all increased by 1, so the from coefficients of Concat in the Head part are modified to [-1, 15] and [-1, 11]; In the train.py file, add the SE module file path after the default parameter of --cfg;
[0079] The batch size of the hyperparameters is set to 24, the learning rate is 0.001, and L1 and L2 regularization is used;
[0080] SⅤ, input the eucalyptus veneer image data to be detected into the optimized target detection model model, and the optimized target detection model model outputs the eucalyptus veneer image data with a defect label file.
[0081] Comparative Example 1
[0082] Comparative Example 1 uses the original YOLOv7 model without any modification, and the remaining steps are consistent with Example 1.
[0083] Comparative Example 2
[0084] Comparative Example 2 is improved based on the original YOLOv7 model and the step IV-1 in Example 1, and the remaining steps are consistent with Example 1.
[0085] Comparative Example 3
[0086] Comparative Example 3 is improved based on the original YOLOv7 model and the step IV-Ⅱ in Example 1, and the remaining steps are consistent with Example 1.
[0087] Comparative Example 4
[0088] Comparative Example 4 is based on Example 1, but the ASPP module code addition position is modified, and the remaining steps are consistent with Example 1.
[0089] Comparative Example 5
[0090] Comparative Example 5 is improved based on the original YOLOv7 model and the step IV-Ⅲ in Example 1, and the remaining steps are consistent with Example 1.
[0091] Comparative Example 6
[0092] Comparative Example 6 is based on Example 1, but the SE module code is added at a modified position, and the remaining steps are consistent with Example 1.
[0093] A test set is prepared based on the consistent S1-S3 steps of Example 1, and the test set is input into the target detection models obtained in Example 1, Comparative Examples 1-6, respectively, in the original image data set in the S1 step, and the eucalyptus veneer image data with the defect label file is output, and the data is compared with the test set to evaluate the identification accuracy and other technical effects, and the specific data is shown in the following table:
[0094]
[0095] From the above comparison, it is obvious that the addition of the ASPP module and the SE module is beneficial to the improvement of the identification accuracy, the identification rate, the recall rate, and the precision rate, and reduces the identification error, but similarly, the addition position of the ASPP module and the SE module will significantly affect the above effects, and even cause negative effects.
[0096] The embodiments of the present application also provide an electronic device which can perform the eucalyptus veneer defect detection method based on the optimized target detection model.
[0097] The embodiments of the present application also provide a computer readable storage medium for storing program codes, and the program codes are used to execute the eucalyptus veneer defect detection method based on the optimized target detection model of each of the above embodiments.
[0098] The embodiments of the present application also disclose a computer program product or a computer program, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device can read the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to make the computer device execute the method shown in the embodiments. Figure 2
[0099] In some alternative embodiments, the functions / operations mentioned in the block diagram can not occur in the order mentioned in the operation diagram. For example, depending on the functions / operations involved, two blocks shown in succession can actually be executed substantially simultaneously or the blocks can sometimes be executed in reverse order. In addition, the embodiments presented and described in the flowcharts of the present application are provided by way of example, and the purpose is to provide a more comprehensive understanding of the technology. The disclosed method is not limited to the operations and logical flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and in which sub-operations described as part of larger operations are independently executed.
[0100] Furthermore, although the present application is described in the context of functional modules, it is to be understood that one or more of the described functions and / or features can be integrated in a single physical device and / or software module, or one or more functions and / or features can be implemented in separate physical devices or software modules. It will also be appreciated that detailed discussion of the actual implementation of each module is not necessary to an understanding of the application. Rather, the actual implementation of the modules, in combination with their attributes, functions, and internal relationships, are to be understood within the context of the devices disclosed herein. Thus, those skilled in the art with access to patents, scientific journals, and other public sources known by those skilled in the art will be able, using ordinary skill, to practice the application as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative and that the scope of the present application is to be determined by the entire scope of the claims, along with all equivalents of the claims and their equivalents.
[0101] If the functions are implemented in software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the parts of the present application that make essential contributions to the prior art or the parts of the technical solutions can be embodied in the form of software products. The computer software products are stored in a storage medium and include a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0102] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a list of executable instructions for implementing logic functions, and can be specifically embodied in any computer readable medium for use by an instruction execution system, device or apparatus, such as a computer-based system, a system including a processor, or other system that can fetch and execute instructions from the instruction execution system, device or apparatus, or in conjunction with these instructions. For the purpose of this specification, "computer readable medium" can be any device that can contain, store, communicate, propagate or transport programs for use by an instruction execution system, device or apparatus, or in conjunction with these instructions.
[0103] More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection (electronic) having one or more wires, a portable computer diskette (magnetic), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer readable medium can be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, for example via an optical scanner, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, to generate an electronically readable version of the program, which can be stored in the computer memory.
[0104] It should be understood that aspects of the application can be implemented in hardware, software, firmware or combinations thereof. In the embodiments described above, various steps or methods can be implemented, for example, in software or firmware that is stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, and in another embodiment, any of the following techniques, which are well known in the art of hardware implementation, can be used: a combination of logic gates in an application-specific integrated circuit, a combination of programmable gate arrays (PGA), a combination of a
[0105] The above embodiments are preferred embodiments of the present application, but the embodiments of the present application are not limited to the above embodiments, and any changes, modifications, substitutions, combinations, simplifications, which are not deviated from the spirit and principles of the present application, are equivalent replacement manners, and are included in the protection scope of the present application.
Claims
1. A method for detecting defects in eucalyptus veneer by optimizing a target detection model, characterized by Mainly include the following steps: SⅠ, collecting eucalyptus veneer original image data set; SⅡ, the original image data is pretreated according to the color and defect characteristics of eucalyptus veneer; SⅢ, the defects of eucalyptus veneer in the pretreated original image data are marked, the image data with defect marking file is generated, and is used as training set; SⅣ, based on the improved YOLOv7 model, the training set is trained, and the trained optimization target detection model model is obtained; Wherein, the specific improvement method of the improved YOLOv7 model is as follows: Ⅳ-1, on the basis of the original YOLOv7 model, 1-5 convolution layers and 1-5 pooling layers are added respectively, so as to increase the depth of the model; The convolution kernel size is modified from 3*3 to 1*1 to 9*9, so as to expand the width of the model; Ⅳ-2, add ASPP module code to the end of common file, add class name in yolo file, and add [-1, 1, ASPP, [1024]] to the convolution layer of backbone module in yolov7_ASPP.yaml file; Ⅳ-3, first, add SE module code to the end of yolov7.models file and add SE class name, add [-1, 1, SE, [1024]] to the layer before SPPF, the subsequent number of this layer network will change, so the from parameter of Detect in Head part is modified to [18, 21, 24]; Similarly, because SE is added to the 9th layer, the numbers after the 9th layer are all increased by 1, so the from coefficients of Concat in Head part are modified to [-1, 15] and [-1, 11]; In train.py file, add SE module file path after default in --cfg default parameter; SⅤ, the eucalyptus veneer image data to be detected is input into the optimization target detection model model, and the eucalyptus veneer image data with defect marking file is output by the optimization target detection model model.
2. The method of claim 1, wherein: In step SⅠ, the eucalyptus veneer original image data set is collected, which can be obtained by shooting the eucalyptus veneer with a size of 1.27m*0.63m by an industrial camera, and the resolution of the obtained original image data is not less than 1920*1080, and the image bit depth is not less than 8.
3. The method of claim 1, wherein: In step SⅡ, the original image data is pretreated according to the color and defect characteristics of eucalyptus veneer, wherein the pretreatment is specifically pretreated by using gamma transformation, laplace transformation, random cropping, random horizontal flip, gaussian blur, gaussian noise and salt and pepper noise.
4. The method of claim 1, wherein: In step SIII, the eucalyptus veneer defects in the preprocessed original image data are marked to generate image data with defect mark files, and the image data with defect mark files are used as a training set. The marking is performed by using software-assisted marking, specifically, the preprocessed original image data are manually labeled by using labelme software, and the image data with defect mark files are generated by using the software. The content of the defect mark files includes defect type, defect size and defect position.
5. The method of claim 1, wherein: In step SIII, the preprocessed original image data are screened to improve the accuracy and efficiency of training. The screening is performed according to eucalyptus veneer defect classification, so that the number of each eucalyptus veneer defect in the preprocessed original image data tends to be consistent.
6. The method of claim 1, wherein: In step SIV, the improved YOLOv7 model is trained based on the training set, and the hyperparameters are set as batch size 24 and learning rate 0.
001.
7. The method of claim 1, wherein: In step SIV, the improved YOLOv7 model is trained based on the training set, and L1 and L2 regularizations are used.
8. The method of claim 1, wherein: The specific code of the ASPP module is as follows:
9. The method of claim 1, wherein: The specific code of the SE module is as follows:
10. The method of claim 1, wherein the method of detecting defects in eucalyptus veneer using an optimized target detection model is characterized by The above steps are applied to the field of eucalyptus veneer processing.
Citation Information
Patent Citations
Wood knot defect detection method based on improved YOLOv3 algorithm
CN110310259A
Wood defect detection method based on improved YOLOX model
CN115222685A