Wood defect automatic detection method, system and storage medium thereof

The automatic detection of wood defects through deep learning models solves the problem of manual detection of wood in the existing technology, achieves fast and accurate defect identification and positioning, and improves the automation and utilization rate of wood processing.

CN113066079BActive Publication Date: 2024-09-20BEIJING DIPU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110416096.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-19
Publication Date
2024-09-20
Estimated Expiration
2041-04-19

AI Technical Summary

Technical Problem

The detection of wood defects in the existing technology relies on manual vision, which is inefficient and unsuitable for large-scale automated production, affecting the processing, utilization and economic value of wood.

Method used

The automatic detection method of wood defects based on deep learning is used to obtain the original scanned image of the wooden board, perform background difference processing and image size adjustment, and input the detection and analysis deep learning model to identify and locate defects to achieve automated detection.

Benefits of technology

It realizes the rapid and accurate identification and location of wood defects, improves the automation level and utilization rate of wood processing, and reduces the dependence on manual inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113066079B
    Figure CN113066079B
Patent Text Reader

Abstract

The present invention relates to the field of image detection technology, and specifically to a method, device, system and storage medium for automatic detection of wood defects, the method comprising: obtaining an original scanned image of a wooden board; performing background difference processing on the original scanned image, removing the background area from the original scanned image, and obtaining a wooden board area image; adjusting the image size of the wooden board area image according to a predetermined size to obtain an image to be detected; after performing adaptive brightness enhancement on the image to be detected, inputting the image to be detected into a detection and analysis deep learning model to obtain detected defect information; locating the position coordinates of each defect in the wooden board area image according to the defect information, and integrating the defect information and outputting it. The present invention can complete the classification and screening of wood without relying on human eye observation; it has high recognition efficiency and is conducive to promotion in large-scale production automation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image detection, and in particular to an automatic detection method for wood defects, an automatic detection system for wood defects and a readable storage medium storing the method. Background Art

[0002] As a basic material, wood is widely used in the fields of construction and home furnishing due to its natural and renewable characteristics. With the development of social economy, the market demand for wood products is also increasing rapidly, so the requirements for automated wood processing are also higher. Wood often has defects such as dead knots, loose knots, cracks and blue discoloration. These defects will destroy the uniformity and integrity of the wood, affect the mechanical properties of the wood and the appearance of the finished product, and are not conducive to the subsequent processing and utilization of the wood, thereby affecting the use value and economic value of the wood.

[0003] Therefore, before processing wood in the market today, people need to classify wood boards according to the surface defects of the wood. In the existing technology, it is generally done by manual visual sorting and marking of log surface defects. This method uses human eyes to observe specific information such as wood surface texture, structure and color to complete the classification and screening of wood. It is more dependent on personal production practice experience, and is greatly limited by personal subjective cognition and individual energy, which is not conducive to the promotion of large-scale production automation. Summary of the invention

[0004] In order to overcome the above-mentioned defects, the purpose of the present invention is to provide a method and system for automatic detection of wood defects based on deep learning, and a readable storage medium storing the method.

[0005] The objective of the present invention is achieved through the following technical solutions:

[0006] The present invention is a method for automatically detecting wood defects, which comprises:

[0007] Get the original scanned image of the wooden board;

[0008] Performing background difference processing on the original scanned image, removing the background area from the original scanned image, and obtaining a wooden board area image;

[0009] Adjusting the image size of the wooden board area image according to a predetermined size to obtain an image to be detected;

[0010] After adaptively enhancing the brightness of the image to be detected, the image to be detected is input into a detection and analysis deep learning model to obtain detected defect information;

[0011] The position coordinates of each defect in the wooden board area image are located according to the defect information, and the defect information is integrated and outputted.

[0012] In the present invention, the step of inputting the image to be detected into the detection and analysis deep learning model to obtain the detected defect information includes:

[0013] The image to be inspected is input into a first inspection model to determine whether a first result is output; if a first result is output, the first result is obtained and used as defect information.

[0014] In the present invention, the image size of the wooden board area image is adjusted according to a predetermined size to obtain the image to be detected, including:

[0015] The length and width parameters of the wooden board area image are obtained, and the wooden board area image is segmented according to the length and width parameters of the wooden board area image to obtain images to be detected with two or more non-overlapping areas.

[0016] In the present invention, the step of inputting the image to be detected into the detection and analysis deep learning model to obtain the detected defect information includes:

[0017] The image to be inspected is input into a second inspection model to determine whether a second result is output; if a second result is output, the second result is obtained and used as defect information.

[0018] In the present invention, the image size of the wooden board area image is adjusted according to a predetermined size to obtain the image to be detected, including:

[0019] The length and width parameters of the wooden board area image are obtained, and the wooden board area image is segmented according to the length and width parameters of the wooden board area image and a preset overlapping area length to obtain more than two images to be detected with overlapping areas.

[0020] In the present invention, performing background difference processing on the original scanned image to remove the background area from the original scanned image to obtain the wooden board area image includes:

[0021] Cutting out an image area of ​​a predetermined height from the original scanned image to obtain a comparison image;

[0022] stretching the contrast image so that the height of the stretched contrast image is consistent with that of the original scanned image;

[0023] Grayscale the original scanned image and the stretched comparison image respectively, and then subtract the areas with the same content in the two images to obtain the difference areas;

[0024] Calculate the mean of the surrounding area of ​​each pixel in the difference area, determine the threshold according to the mean, and perform adaptive threshold binarization processing on the difference area; then perform morphological closing operation to obtain multiple pixel areas, and then select the pixel area with the largest area as the foreground contour;

[0025] The original scanned image is extracted according to the foreground contour to obtain a wooden board area image.

[0026] In the present invention, the step of adaptively enhancing the brightness of the image to be detected includes:

[0027] Obtain the mean values ​​of the three channels R, G, and B in the image to be detected, and calculate the overall brightness of the image based on the mean values ​​of the three channels R, G, and B;

[0028] The brightness value is divided by the preset value as the Gamma coefficient, and Gamma correction is performed based on the Gamma coefficient.

[0029] In the present invention, locating the position coordinates of each defect in the wooden board area image according to the defect information includes:

[0030] Obtaining the position coordinates of each defect in the image to be detected according to the defect information, and obtaining the positional relationship between each of the images to be detected;

[0031] According to the position coordinates of each defect in the image to be detected and the positional relationship between each of the images to be detected, the position coordinates of each defect are mapped to the wooden board area image.

[0032] Based on the same concept, the present invention also provides a wood defect automatic detection system, which comprises:

[0033] An original image acquisition module, wherein the original image acquisition module is used to acquire an original scanned image of the wooden board;

[0034] A background area removal module, which is connected to the original image acquisition module and is used to perform background difference processing on the original scanned image, remove the background area from the original scanned image, and obtain a wooden board area image;

[0035] An image size adjustment module, which is connected to the background area removal module and is used to adjust the image size of the wooden board area image according to a predetermined size to obtain an image to be detected;

[0036] A deep learning analysis module, which is connected to the image size adjustment module and is used to input the image to be detected into a detection and analysis deep learning model after adaptively enhancing the brightness of the image to be detected, so as to obtain the detected defect information;

[0037] A defect marking output module is connected to the deep learning analysis module and is used to locate the position coordinates of each defect in the wooden board area image according to the defect information, and integrate the defect information and output it.

[0038] Based on the same concept, the present invention also provides a computer-readable program storage medium storing computer program instructions. When the computer program instructions are executed by a computer, the computer executes the method as described above.

[0039] In the automatic detection method for wood defects of the present invention, an image of the wood is acquired, and after removing the background image, the size of the image is adjusted, and then the image is input into a preset detection and analysis deep learning model, and the type of defect and the position of the defect are identified through the detection and analysis deep learning model; therefore, the present invention does not need to rely on human eye observation to complete the classification and screening of wood; it has high recognition efficiency, which is conducive to promotion in large-scale production automation. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] For ease of explanation, the present invention is described in detail with reference to the following preferred embodiments and the accompanying drawings.

[0041] Figure 1 A schematic diagram of the working process of an embodiment of the method for automatically detecting wood defects of the present invention;

[0042] Figure 2 A schematic diagram of the working process of another embodiment of the method for automatically detecting wood defects of the present invention;

[0043] Figure 3 Schematic diagram of the workflow of step S202 in the method for automatically detecting wood defects of the present invention;

[0044] Figure 4 is a schematic diagram of an original scanned image in the automatic detection method for wood defects of the present invention;

[0045] Figure 5 Schematic diagram of the working principle of step S203 in the method for automatically detecting wood defects of the present invention;

[0046] Figure 6 Schematic diagram of the working principle of step S206 in the method for automatically detecting wood defects of the present invention;

[0047] Figure 7It is a schematic diagram of the result diagram of step S209 in the method for automatic detection of wood defects of the present invention;

[0048] Figure 8 The figure is a schematic diagram of the logical structure of the automatic wood defect detection system of the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0050] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0051] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection. It can be a mechanical connection or an electrical connection. It can be directly connected or indirectly connected through an intermediate medium. It can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0052] The following is a specific description of an automatic wood defect detection method of the present invention using an embodiment. Figure 1 , which includes:

[0053] S101. Obtain the original scanned image of the wooden board

[0054] The wooden board is scanned or an image of a scanned wooden board is imported from a database to obtain an original scanned image of the wooden board; wherein the original scanned image of the wooden board includes a wooden board area image and a background image;

[0055] S102. Removing background area from the original scanned image

[0056] Background difference processing is performed on the original scanned image, and the background area is removed from the original scanned image to obtain a wooden board area image; because the wooden board is generally in the middle of the field of view when the image of the wooden board is collected, the original scanned image of the wooden board contains more background, which affects subsequent processing and therefore needs to be removed.

[0057] S103. Adjust the image size of the wooden board area image

[0058] The image size of the wooden board area image is adjusted according to a predetermined size to obtain the image to be detected; because in the existing deep learning model, the predicted image needs to be square, and in the existing environment, the wooden board is generally rectangular, so it is necessary to adjust the image size of the wooden board area image to meet the requirements of the deep learning model.

[0059] S104. Adaptively enhance the brightness of the image

[0060] The brightness of the image to be detected is adaptively enhanced to increase the brightness of the image, so as to facilitate subsequent deep learning of the image.

[0061] S105. Obtaining defect information through deep learning model

[0062] The image to be detected is input into the detection and analysis deep learning model to obtain the detected defect information; the detection and analysis deep learning model includes: a blue discoloration defect classification model, a dead knot, slipknot and crack defect detection model, and the blue discoloration defect classification model is used to detect whether there is blue discoloration in the wooden board, wherein the blue discoloration refers to the phenomenon that due to excessive moisture content, carbohydrate content, etc. in the wood, Diplococcidioides cocosus multiplies in the wood tracheids or vessels, the discoloration bacteria invade the interior of the wood, and the blue discoloration fungal hyphae secrete coloring substances to dye the cell wall, causing the wood to turn blue. The dead knot, slipknot and crack defect detection model is used to detect whether there are dead knots, slipknots or cracks in the wooden board.

[0063] S106. Integrate and output defect information

[0064] The position coordinates of each defect in the wooden board area image are located according to the defect information, and the defect information is integrated and then output. Specifically, when a defect is detected in the wooden board, the position coordinates of all defects in the image to be detected are obtained, and then the position coordinates of each defect in the wooden board area image are located according to the mapping relationship between the image to be detected and the wooden board area image, and the result image is drawn by integrating all the information such as the type, quantity and position of the detected defects, and the result image is output.

[0065] The following is a detailed description of an automatic wood defect detection method of the present invention using another embodiment. Figures 2 to 7 , which includes:

[0066] S201. Obtaining the original scanned image of the wooden board

[0067] The wooden board is scanned or an image of a scanned wooden board is imported from a database to obtain an original scanned image of the wooden board; wherein the original scanned image of the wooden board includes a wooden board area image and a background image;

[0068] S202. Removing background area from the original scanned image

[0069] Perform background difference processing on the original scanned image, remove the background area from the original scanned image, and obtain a wooden board area image; since the wooden board is generally in the middle of the field of view when the wooden board image is collected, the original scanned image of the wooden board contains a lot of background, which affects subsequent processing, so it needs to be removed;

[0070] Please see Figure 4 , which specifically includes in this embodiment:

[0071] S2021. Obtain a comparison image from the original scanned image

[0072] An image area of ​​a predetermined height is captured from the original scanned image to obtain a contrast image; and the contrast image is stretched so that the stretched contrast image is consistent with the height of the original scanned image; specifically: a small image with a bottom height of 20 pixels and a width of the original image is captured as a contrast image, and the captured contrast image with a height of 20 is longitudinally stretched so that the height of the captured contrast image is consistent with the original scanned image, and a contrast image with the same size as the original image can be obtained by stretching.

[0073] S2022. Subtract the areas with the same content in the two images

[0074] The original scanned image and the stretched contrast image are respectively grayed, and then the areas with the same content in the two images are subtracted to obtain the difference areas; wherein the areas with the same content in the two images are the background areas in the images.

[0075] S2023. Filter out the foreground contour

[0076] Calculate the mean of the surrounding area of ​​each pixel in the difference area, determine the threshold value based on the mean value, and perform adaptive threshold binarization on the difference area; then perform morphological closing operation to obtain multiple pixel areas, and then select the pixel area with the largest area as the foreground contour; specifically: obtain the mean of the 11x11 area around the target pixel in the difference area by translation and sliding in the x and y directions, and determine the local threshold value based on the mean value. Among them, image morphology, namely mathematical morphology, is an image analysis discipline based on Glenn and topology, and is the basic theory of mathematical morphological image processing; the closing operation can eliminate narrow discontinuities and small holes; the operation of first dilation and then corrosion is called the closing operation; it has the function of filling small holes in objects, connecting adjacent objects and smoothing boundaries.

[0077] S2024. Extract the wooden board area image

[0078] The original scanned image is extracted according to the foreground contour to obtain a wooden board area image.

[0079] S203. Non-overlapping images of cut wood board areas

[0080] After removing the background area from the original scanned image, the length and width parameters of the wooden board area image are obtained, and the wooden board area image is cut according to the length and width parameters of the wooden board area image to obtain an image to be detected with two or more non-overlapping areas. In this embodiment, since the original scanned image is a large-size image of a long and thin strip, the wooden board area image needs to be scaled, the short side is scaled to M pixels, and the long side is adaptively and dynamically scaled according to the scaling factor of the short side; then the scaled image is non-overlappingly sliding the window to intercept the sub-area of ​​M×M size to obtain multiple images to be detected; if the image size of the last sliding window does not meet the M×M size, the missing part is filled with a black background. Since in the existing deep learning model, the predicted image needs to be square, and in the existing environment, the wooden board is generally rectangular, so it is necessary to cut the wooden board area image into multiple M×M square images to meet the requirements of the deep learning model. Since the blue change is a manifestation of a large-scale gradient, in this embodiment, even if a non-overlapping cutting method is adopted, the cut blue change is distributed in two images, and it will not affect the subsequent recognition of the image.

[0081] S204. Adaptively enhance the brightness of the image

[0082] The image to be detected is adaptively enhanced in brightness to improve the brightness of the image, which is convenient for subsequent deep learning of the image. Specifically, the mean of the three channels R, G, and B in the image to be detected is obtained, and the overall brightness of the image is calculated based on the mean of the three channels R, G, and B; wherein the brightness calculation formula is:

[0083] Brightness = 0.299 × R + 0.587 × G + 0.114 × B

[0084] Then divide the brightness value by the preset value 255 as the Gamma coefficient, and perform Gamma correction based on the Gamma coefficient.

[0085] S205. Obtaining a first result through a first detection model

[0086] The image to be detected is input into the first detection model to determine whether a first result is output. If a first result is output, the first result is obtained and used as defect information. In this embodiment, the first detection model is: a blue change defect classification model, wherein the blue change defect classification model first obtains a large number of images to be detected, and then manually classifies the images into two types of images: blue change and non-blue change; and finally is constructed through deep learning. Then the image to be detected is input into the blue change defect classification model to obtain a first result of whether there is blue change. Among them, the blue change refers to the phenomenon that due to excessive moisture content, carbohydrate content, etc. in the wood, Diplococcidioides cocosus multiplies in large numbers in the wood tracheids or vessels, the discoloration bacteria invade the interior of the wood, and the hyphae of the blue change fungus secrete coloring substances to dye the cell wall, causing the wood to turn blue.

[0087] S206. Cutting into images to be detected with overlapping areas

[0088] After removing the background area from the original scanned image, the length and width parameters of the wooden board area image are obtained, and the wooden board area image is cut according to the length and width parameters of the wooden board area image and the preset overlapping area length, so as to obtain two or more images to be detected with overlapping areas. Specifically, the short side of the wooden board area image is set to M pixels, and a sliding window of M size is performed along the long side of the image, and the overlapping Overlap pixels of the long side are taken by the latter sliding window and the previous sliding window; then the bottom and right side of the synthetic large image are filled with a black background to make its size conform to the M×M size, and the image is captured. In practical applications, since the size of a defect may be large or small, it is easy to be cut in half at the cutting position, so an overlapping cutting method is adopted in this embodiment to avoid this problem.

[0089] S207. Adaptively enhance the brightness of the image

[0090] The image to be detected is adaptively enhanced in brightness to improve the brightness of the image, which is convenient for subsequent deep learning of the image. Specifically, the mean of the three channels R, G, and B in the image to be detected is obtained, and the overall brightness of the image is calculated based on the mean of the three channels R, G, and B; wherein the brightness calculation formula is:

[0091] Brightness = 0.299 × R + 0.587 × G + 0.114 × B

[0092] Then divide the brightness value by the preset value 255 as the Gamma coefficient, and perform Gamma correction based on the Gamma coefficient.

[0093] S208. Obtaining a second result through a second detection model

[0094] The image to be detected is input into the second detection model to determine whether a second result is output. If a second result is output, the second result is obtained and used as defect information. In this embodiment, the second detection model is: a dead knot, slipknot and crack defect detection model; wherein the dead knot, slipknot and crack defect detection model is first constructed by obtaining a large number of sub-images; and then manually marking defects on the image to be detected, marking the external rectangular coordinates of the dead knot, slipknot and crack defects and their corresponding defect categories. Then the image to be detected is input into the dead knot, slipknot and crack defect detection model to obtain the second result of whether there is a dead knot, slipknot and / or crack defect detection model. Among them, the network structure of the dead knot, slipknot and crack defect detection model adopts YOLOv5s.

[0095] S209. Integrate and output defect information

[0096] The defect information including the first result and the second result is obtained respectively; then the position coordinates of each defect in the image to be detected are obtained according to the defect information, and the positional relationship between each image to be detected is obtained; according to the position coordinates of each defect in the image to be detected and the positional relationship between each image to be detected, the position coordinates of each defect are mapped to the wooden board area image. Specifically, when a defect is detected in the wooden board, the position coordinates of all defects in the image to be detected are obtained, and then the mapping relationship between the position of the defect and the wooden board area image is determined according to the order of the images to be detected, and the position coordinates of each defect in the wooden board area image are located, and the result image is drawn in the wooden board area image based on the information such as the type, quantity and position of all detected defects, and the result image is output. Therefore, in the result image, it can directly mark defects such as blue discoloration, dead knots, loose knots, cracks, etc. in the wooden board area image, and the result image is very intuitive.

[0097] In order to verify the actual effect of a solid wood defect detection method provided in this embodiment, 141 samples containing blue discoloration, 302 samples containing dead knots and slipknots, and 129 samples containing cracks were collected. Among them, there may be a combination of multiple different defects in any image sample. The statistical data is shown in Table 1 below. The measured results show that the accuracy rates of blue discoloration, dead knots, slipknots and cracks are 92.6%, 96.8%, 94.5% and 91.3% respectively. The blue discoloration detection takes 80ms, and the dead knot, slipknot and crack detection takes a total of 90ms. According to the two indicators of detection accuracy and detection processing time consumption, it is shown that the present invention application has higher recognition accuracy and recognition speed. Therefore, this method is of great significance to improving the effect and efficiency of automated defect detection in solid wood, optimizing wood processing grade sorting, improving wood utilization and promoting the level of automation in wood processing.

[0098] Table 1

[0099]

[0100] The present invention includes a computer-readable storage medium on which a program product capable of implementing the above method of this specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to cause the terminal device to perform the steps according to various exemplary implementations of the present invention described in the above "Exemplary Method" section of this specification.

[0101] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0102] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0103] The program code contained in the above readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0104] The following is a detailed description of an automatic wood defect detection system of the present invention using an embodiment. Figure 8 , which includes:

[0105] The original image acquisition module 101 is used to acquire the original scanned image of the wooden board; specifically, it acquires the original scanned image of the wooden board by scanning the wooden board or importing the image of the scanned wooden board from the database; wherein the original scanned image of the wooden board includes the wooden board area image and the background image.

[0106] The background area removal module 102 is connected to the original image acquisition module 101, and is used to perform background difference processing on the original scanned image, remove the background area from the original scanned image, and obtain a wooden board area image; because the wooden board is generally in the middle of the field of view when the image of the wooden board is collected, the original scanned image of the wooden board contains more background, which affects subsequent processing, so it needs to be removed.

[0107] The image size adjustment module 103 is connected to the background area removal module 102, and is used to adjust the image size of the wooden board area image according to a predetermined size to obtain an image to be detected; the image size adjustment module 103 has two adjustment modes. When it is subsequently required to be input into a blue discoloration defect classification model, the scaled image is subjected to non-overlapping sliding window interception of sub-areas of size M×M to obtain multiple images to be detected; when it is subsequently required to be input into a dead knot, live knot and crack defect detection model, the scaled image is subjected to overlapping interception to obtain multiple images to be detected.

[0108] A deep learning analysis module 104, which is connected to the image size adjustment module 103, is used to input the image to be detected into a detection analysis deep learning model after adaptively enhancing the brightness of the image to be detected, so as to obtain the detected defect information; the detection analysis deep learning model includes: a blue discoloration defect classification model, and a dead knot, slipknot and crack defect detection model;

[0109] Among them, the blue change defect classification model consists of an input layer, a 3×3 convolution layer, a 3×3 depth-separable convolution module, two 3×3 mobile flip bottleneck convolution modules, two 5×5 mobile flip bottleneck convolution modules, three 3×3 mobile flip bottleneck convolution modules, three 5×5 mobile flip bottleneck convolution modules, four 5×5 mobile flip bottleneck convolution modules, a 3×3 mobile flip bottleneck convolution module, a 1×1 convolution layer, a global average pooling layer, a fully connected layer, and a Softmax activation layer, and each layer is connected in sequence. The depth-separable convolution module consists of a 3×3 depth-separable convolution layer, a batch normalization layer, a Swish activation layer, a 1×1 convolution layer, and a batch normalization layer, and each layer is connected in sequence. The mobile flip bottleneck convolution module consists of a 1×1 convolution layer, a batch normalization layer, a Swish activation layer, a k×k depthwise separable convolution layer, a batch normalization layer, a Swish activation layer, a compression and excitation module, a 1×1 convolution layer, a batch normalization layer, and a DropConnect layer. Each layer is connected in sequence and accumulated with the module input to obtain the module output. Among them, k is given by the mobile flip bottleneck convolution module parameters. The compression and excitation module consists of a global average pooling layer, a 1×1 convolution layer, a Swish activation layer, a 1×1 convolution layer, and a Sigmoid activation layer. Each layer is connected in sequence and multiplied with the module input to obtain the module output.

[0110] The network structure of the dead knot, live knot and crack defect detection model adopts YOLOv5s. YOLO is an object detection algorithm that applies a single convolutional neural network (CNN) to the entire image, divides the image into grids, and predicts the class probability and bounding box of each grid.

[0111] The blue discoloration defect detection model and the dead knot, live knot, and crack defect detection models only need to be trained once before implementation to learn the characteristic information of the corresponding defect type, and an indefinite number of reasoning services can be realized.

[0112] Defect marking output module 105, the defect marking output module 105 is connected to the deep learning analysis module 104, and is used to locate the position coordinates of each defect in the wooden board area image according to the defect information, and integrate the defect information and output it. Specifically, when defects such as blue discoloration, dead knots, loose knots and / or cracks are detected in the wooden board, the position coordinates of all defects in the image to be detected are obtained, and then the mapping relationship between the position of the defect and the wooden board area image is determined according to the order of the images to be detected, and the position coordinates of each defect in the wooden board area image are located, and the result image is drawn in the wooden board area image based on all the information such as the type, quantity and position of the detected defects, and the result image is output.

[0113] The present invention adopts graphic image recognition technology to automatically detect solid wood boards, which can quickly, accurately and non-destructively indicate the type, location and degree of board defects, provide processing guidance for board production and processing, improve board utilization efficiency, and enhance the automation and intelligence level of log board optimization grading.

[0114] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0115] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for automatic detection of wood defects, characterized in that: include: Get the original scanned image of the wooden board; Performing background difference processing on the original scanned image, removing the background area from the original scanned image, and obtaining a wooden board area image; Adjusting the image size of the wooden board area image according to a predetermined size to obtain an image to be detected; After adaptively enhancing the brightness of the image to be detected, the image to be detected is input into a detection and analysis deep learning model to obtain detected defect information; The position coordinates of each defect in the wooden board area image are located according to the defect information, and the defect information is integrated and outputted. The image to be detected is input into the detection and analysis deep learning model to obtain the detected defect information, including: inputting the image to be detected into the first detection model to determine whether a first result is outputted. If a first result is outputted, the first result is obtained and used as the defect information. The image size of the wooden board area image is adjusted according to a predetermined size to obtain the image to be detected, including: obtaining the length and width parameters of the wooden board area image, and cutting the wooden board area image according to the length and width parameters of the wooden board area image to obtain two or more non-overlapping areas of the image to be detected. The image input detection and analysis deep learning model is used to obtain the detected defect information, including: inputting the image to be detected into a second detection model to determine whether a second result is output, and if a second result is output, obtaining the second result and using it as defect information, adjusting the image size of the wooden board area image according to a predetermined size to obtain the image to be detected, including: obtaining the length and width parameters of the wooden board area image, and cutting the wooden board area image according to the length and width parameters of the wooden board area image and the preset overlapping area length to obtain two or more images to be detected with overlapping areas, performing background difference processing on the original scanned image, removing the background area from the original scanned image, and obtaining the wooden board area image includes: The image area of ​​a predetermined height is intercepted from the original scanned image to obtain a contrast image; the contrast image is stretched so that the stretched contrast image is consistent with the height of the original scanned image; the original scanned image and the stretched contrast image are respectively grayed, and then the areas with the same content in the two images are subtracted to obtain the difference area; the mean of the surrounding area of ​​each pixel point in the difference area is calculated, and the threshold is determined according to the mean, and the difference area is subjected to adaptive threshold binarization processing; a morphological closing operation is performed to obtain multiple pixel areas, and then the pixel area with the largest area is screened out as the foreground contour; the original scanned image is extracted according to the foreground contour to obtain the wooden board area image, and the foreground contour is extracted. The adaptive brightness enhancement of the image to be detected includes: obtaining the mean of the three channels R, G, and B in the image to be detected, and calculating the overall brightness of the image based on the mean of the three channels R, G, and B; dividing the brightness value by a preset value as a Gamma coefficient, and performing Gamma correction based on the Gamma coefficient. The positioning of the position coordinates of each defect in the wooden board area image based on the defect information includes: obtaining the position coordinates of each defect in the image to be detected based on the defect information, and obtaining the position relationship between each of the images to be detected; mapping the position coordinates of each defect to the wooden board area image based on the position coordinates of each defect in the image to be detected and the position relationship between each of the images to be detected.

2. A wood defect automatic detection system, characterized in that: include: An original image acquisition module, wherein the original image acquisition module is used to acquire an original scanned image of the wooden board; A background area removal module, which is connected to the original image acquisition module and is used to perform background difference processing on the original scanned image, remove the background area from the original scanned image, and obtain a wooden board area image; An image size adjustment module, which is connected to the background area removal module and is used to adjust the image size of the wooden board area image according to a predetermined size to obtain an image to be detected; A deep learning analysis module, which is connected to the image size adjustment module and is used to input the image to be detected into a detection and analysis deep learning model after adaptively enhancing the brightness of the image to be detected, so as to obtain the detected defect information; A defect marking output module is connected to the deep learning analysis module and is used to locate the position coordinates of each defect in the wooden board area image according to the defect information, and integrate the defect information and output it.

3. A computer-readable program storage medium, characterized in that: The computer program instructions are stored therein, and when the computer program instructions are executed by a computer, the computer is caused to execute the method according to claim 1 .