Wood defect detection system based on image processing
Feature extraction of wood images through artificial intelligence technology based on machine vision solves the problem of time-consuming and subjectiveness of manual inspection, and achieves the efficiency and accuracy of wood automated defect detection.
Patent Information
- Application Number
- CN202311668936.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2043-12-07
AI Technical Summary
Existing wood defect detection mainly relies on manual inspection, which is time-consuming and subjective, making it difficult to ensure the accuracy and consistency of the test results.
Using artificial intelligence detection technology based on machine vision, a comprehensive feature matrix is generated by extracting wood images by using direction gradient histograms and depth-separable convolutional neural network models to evaluate whether wood has defects.
It realizes automated defect detection of wood, improves detection efficiency and objectivity of results, and ensures the accuracy and consistency of detection.
Smart Images

Figure CN117636045B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent detection, and more specifically, to a wood defect detection system based on image processing. Background Art
[0002] In the past few decades, with the continuous development of the global economy and the acceleration of the industrialization process, the manufacturing industry has received unprecedented impetus. Among them, the wood industry, as an important part of the manufacturing industry, has also prospered accordingly. As a key resource industry, the economic value of the wood industry is closely related to the quality of wood. However, wood defects, such as cracks, knots, insect eyes and bends, will seriously affect the quality and use value of wood.
[0003] Cracks and knots are the most common defects in wood. These defects will reduce the strength of wood and affect its durability and appearance quality. Cracks are caused by the stress that the wood is subjected to during growth or processing that exceeds its bearing capacity; while knots are formed when the tree is damaged or diseased during its growth. These defects not only affect the appearance of the wood, but also reduce its use value. Insect holes and bends are also defects in wood. Insect holes are formed when the wood is eaten by insects inside, while bends are formed when the wood is affected by environmental factors during its growth. These defects will affect the quality and use value of the wood.
[0004] Currently, the detection and identification of these wood defects still mostly rely on visual inspection by professional workers. However, this manual inspection method is not only labor-intensive but also very time-consuming. In addition, due to the strong subjectivity of manual judgment, the accuracy and consistency of the test results are difficult to guarantee.
[0005] Therefore, an optimized image processing-based wood defect detection scheme is needed. Summary of the invention
[0006] The purpose of this application is to provide a wood defect detection system based on image processing, which adopts artificial intelligence detection technology based on machine vision, and extracts features from wood images to determine whether the wood to be detected has defects. In this way, automatic defect detection of wood can be achieved, which is conducive to improving the efficiency of detection and ensuring the objectivity of detection results.
[0007] According to one aspect of the present application, a wood defect detection system based on image processing is provided, which comprises:
[0008] A wood image data acquisition module is used to acquire the image of the wood to be detected from a camera;
[0009] An image preprocessing module, used for preprocessing the image of the wood to be detected to obtain a preprocessed wood image;
[0010] A wood image feature encoding module, used for performing image feature encoding on the pre-processed wood image to obtain a wood comprehensive feature matrix;
[0011] The defect result generating module is used to evaluate whether the wood to be inspected has defects based on the wood comprehensive feature matrix.
[0012] In the above-mentioned wood defect detection system based on image processing, the wood image feature encoding module includes: a texture feature extraction unit, which is used to extract texture features from the pre-processed wood image to obtain a wood directional gradient histogram feature matrix; a wood original feature extraction unit, which is used to pass the pre-processed wood image through a deep separable convolutional neural network model to obtain a wood original feature matrix; and a feature fusion unit, which is used to fuse the wood directional gradient histogram feature matrix and the wood original feature matrix to obtain the wood comprehensive feature matrix.
[0013] In the above-mentioned wood defect detection system based on image processing, the texture feature extraction unit includes: a directional gradient histogram extraction subunit, used to extract the directional gradient histogram of wood from the preprocessed wood image; a spatial attention feature encoding subunit, used to pass the directional gradient histogram of the wood through a feature extractor including a spatial attention mechanism to obtain the feature matrix of the directional gradient histogram of the wood.
[0014] In the above-mentioned wood defect detection system based on image processing, the feature extractor including the spatial attention mechanism is a first convolutional neural network model using the spatial attention mechanism, and the depthwise separable convolutional neural network model is a second convolutional neural network model serving as a feature extractor.
[0015] In the above-mentioned wood defect detection system based on image processing, the feature fusion unit is used to fuse the wood directional gradient histogram feature matrix and the wood original feature matrix using the following fusion formula to obtain the wood comprehensive feature matrix; wherein the fusion formula is:
[0016]
[0017] Among them, M c is the comprehensive characteristic matrix of wood, M a is the wood directional gradient histogram feature matrix, M b is the original characteristic matrix of the wood, It represents the addition of the elements at corresponding positions of the wood directional gradient histogram feature matrix and the wood original feature matrix, and α and β are weighted parameters for controlling the balance between the wood directional gradient histogram feature matrix and the wood original feature matrix in the wood comprehensive feature matrix.
[0018] In the above-mentioned wood defect detection system based on image processing, the defect result generation module is used to: pass the wood comprehensive feature matrix through a classifier to obtain a classification result, and the classification result is used to indicate whether the wood to be detected has defects.
[0019] In the above-mentioned wood defect detection system based on image processing, it also includes a training module for training the feature extractor including the spatial attention mechanism, the deep separable convolutional neural network model and the classifier.
[0020] In the above-mentioned wood defect detection system based on image processing, the training module includes: a training wood image data acquisition unit, which is used to acquire an image of the training wood to be detected from a camera, and a true value of whether the training wood to be detected has defects; a training image preprocessing unit, which is used to preprocess the image of the training wood to be detected to obtain a training preprocessed wood image; a training directional gradient histogram extraction unit, which is used to extract a directional extraction histogram of the training wood from the training preprocessed wood image; a training spatial attention feature encoding unit, which is used to pass the directional gradient histogram of the training wood through the feature extractor containing the spatial attention mechanism to obtain a training wood directional gradient histogram feature matrix; a training wood original feature extraction unit, which is used to pass the training preprocessed wood image through the depth separable convolution A convolution neural network model is used to obtain the original feature matrix of the training wood; a training feature fusion unit is used to fuse the feature matrix of the training wood directional gradient histogram and the original feature matrix of the training wood to obtain a comprehensive feature matrix of the training wood; a feature engineering transition factor calculation unit is used to calculate the feature engineering transition factor based on a priori between the feature matrix of the training wood directional gradient histogram and the original feature matrix of the training wood; a classification loss unit is used to pass the comprehensive feature matrix of the training wood through the classifier to obtain a classification loss function value; a model training unit is used to train the feature extractor including the spatial attention mechanism, the deep separable convolution neural network model and the classifier using the weighted sum between the classification loss function value and the feature engineering transition factor based on a priori as the loss function value.
[0021] In the above-mentioned wood defect detection system based on image processing, the feature engineering transition factor calculation unit includes: calculating the feature engineering transition factor based on a priori between the training wood directional gradient histogram feature matrix and the training wood original feature matrix by the following calculation formula; wherein the calculation formula is:
[0022]
[0023] Wherein, M1 represents the feature matrix of the directional gradient histogram of the training wood, M2 represents the original feature matrix of the training wood, represents the positional addition of the feature matrix, represents the positional subtraction of the feature matrix, represents the square of the Frobenius norm of the feature matrix, exp(·) represents the exponential operation of the matrix, α and λ represent hyperparameters, and F loss represents the prior-based feature engineering transition factor.
[0024] According to another aspect of the present application, a wood defect detection method based on image processing is provided, which comprises:
[0025] Acquire an image of the wood to be inspected from a camera;
[0026] Preprocessing the image of the wood to be detected to obtain a preprocessed wood image;
[0027] Performing image feature encoding on the pre-processed wood image to obtain a wood comprehensive feature matrix;
[0028] Based on the comprehensive wood feature matrix, it is used to evaluate whether the wood to be inspected has defects.
[0029] Compared with the prior art, the wood defect detection system based on image processing provided by the present application adopts artificial intelligence detection technology based on machine vision, and judges whether the wood to be inspected has defects by extracting features from the wood image. In this way, automatic defect detection of wood can be realized, which is beneficial to improving the efficiency of detection and ensuring the objectivity of detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0031] Figure 14 is a system block diagram of a wood defect detection system based on image processing according to an embodiment of the present application.
[0032] Figure 2 4 is an architecture diagram of a wood defect detection system based on image processing according to an embodiment of the present application.
[0033] Figure 3 4 is a block diagram of a wood image feature encoding module in a wood defect detection system based on image processing according to an embodiment of the present application.
[0034] Figure 4 4 is a block diagram of a texture feature extraction unit in a wood defect detection system based on image processing according to an embodiment of the present application.
[0035] Figure 5 4 is a block diagram of a training module in a wood defect detection system based on image processing according to an embodiment of the present application.
[0036] Figure 6 Flow chart of a wood defect detection method based on image processing according to an embodiment of the present application.
[0037] Figure 7 A block diagram of a computing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. These embodiments are provided to make the present application comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. Here, the illustrative embodiments of the present application and their description are used to explain the present application, but are not intended to limit the present application.
[0039] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0040] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0041] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0042] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" and similar terms include all combinations of any, multiple, and all of the associated listed items.
[0043] As mentioned in the above background technology, the wood industry has been in a prosperous state during the process of economic development and industrialization. As an important building and manufacturing material, wood is widely used in the fields of construction, furniture, shipbuilding, pulp and paper. However, wood often has some defects during growth and processing, such as cracks, knots, wormholes and bends, which will reduce the quality and value of wood. There are many reasons for the formation of these defects. First, the wood may be affected by stress exceeding its bearing capacity during growth, resulting in cracks or bends inside the wood. Secondly, trees may suffer external damage or lesions during growth, such as storms, insect pests or diseases, which can also cause defects in wood. In addition, insect infestation and environmental factors (such as humidity, temperature changes, etc.) can also affect the quality of wood. At present, manual inspection is the main method for detecting and identifying wood defects. This method requires a lot of manpower input, is time-consuming and easily affected by subjective factors, and it is difficult to ensure the accuracy and consistency of the test results. Therefore, a wood defect detection solution based on image processing is expected, which can quickly identify wood defects and accurately identify them while ensuring high efficiency.
[0044] In recent years, deep learning and neural networks have been widely used in computer vision, natural language processing, text signal processing and other fields. In addition, deep learning and neural networks have also shown a level close to or even beyond that of humans in image classification, object detection, semantic segmentation, text translation and other fields. The development of deep learning and neural networks has provided new solutions and solutions for wood defect detection based on image processing.
[0045] The presence of defects in wood will cause obvious changes on the wood surface, so the technical concept of the present application is to capture the surface image of the wood to be inspected by a camera, perform some processing on the surface image to obtain the characteristics of the wood surface, and then judge whether there are defects based on these characteristics.
[0046] Figure 1 4 is a system block diagram of a wood defect detection system based on image processing according to an embodiment of the present application. Figure 2 FIG. 1 is an architecture diagram of a wood defect detection system based on image processing according to an embodiment of the present application. Figure 1 and Figure 2 As shown, in the wood defect detection system 100 based on image processing, it includes: a wood image data acquisition module 110, which is used to acquire the image of the wood to be detected from the camera; an image preprocessing module 120, which is used to preprocess the image of the wood to be detected to obtain a preprocessed wood image; a wood image feature encoding module 130, which is used to encode the image features of the preprocessed wood image to obtain a comprehensive wood feature matrix; and a defect result generation module 140, which is used to evaluate whether the wood to be detected has defects based on the comprehensive wood feature matrix.
[0047] Specifically, in the technical solution of the present application, first, an image of the wood to be detected is obtained from a camera. It should be understood that obtaining wood image data is the first step of the technical solution of the present application, and its role is to convert the visual information of the wood surface into digital image data, laying the foundation for subsequent data processing steps. By obtaining the wood image through the camera, non-contact data collection can be achieved, without direct contact with the wood surface, reducing interference and damage to the wood. At the same time, the camera can quickly obtain images, which is suitable for large-scale wood detection scenarios and improves the efficiency of detection. The image of the wood to be detected is taken by a camera. The camera can be deployed above the conveyor belt and can be taken when the wood passes through the conveyor belt. This deployment position can ensure that the image of the wood during transportation is captured, and the detection process is seamlessly connected with the production process. Note that the camera referred to in this application is preferably a high-resolution camera to ensure that subtle defects on the wood surface can be captured. It is not difficult to understand that high-resolution images can provide more detailed information, which helps to accurately identify and classify wood defects.
[0048] It is not difficult to understand that the image of the wood to be detected obtained by the camera may be blurred and dim. Therefore, it is necessary to preprocess the image of the wood to be detected to obtain a preprocessed wood image. Preprocessing is a series of operations on the image of the wood to be detected, aiming to remove noise in the image, enhance the contrast and details of the image, and adjust the brightness and color of the image. The goal of preprocessing is to optimize the quality of the image, make the key information in the image more obvious and distinguishable, and help the subsequent feature extraction and classification process.
[0049] Specifically, a preprocessing method for the wood image to be detected can include: 1. Remove noise in the image, reduce interference, and improve the clarity of the image by applying filters and other technologies; 2. Adjust the pixel value range of the image so that the brightness difference of different parts of the image is more obvious, which is conducive to the subsequent feature extraction; 3. Sharpening and smoothing: The edge and detail information of the image can be enhanced by sharpening operations, while the noise and details in the image can be reduced by smoothing operations, making the image clearer and easier to process; 4. Correct the color deviation of the image to make the color of the image more realistic and accurate. Through these preprocessing operations, the image of the wood to be detected can be more suitable for the subsequent feature extraction and classification algorithm.
[0050] In wood defect detection, the texture and structural information of the wood is crucial to determine whether there are defects. In the technical solution of the present application, a direction extraction histogram of the wood is extracted from the preprocessed wood image. It should be understood that the orientation gradient histogram is a feature representation method for describing image texture and edge information. It can reflect the gradient changes in different directions in the image, thereby revealing the texture and structural features in the image. By extracting the orientation gradient histogram of the wood image, the characteristics of the wood texture and structure can be obtained, which can be used for subsequent classification and detection tasks.
[0051] Specifically, an implementable method for extracting a direction extraction histogram of wood from the pre-processed wood image includes the following steps: 1. Calculating gradients: performing gradient calculations on the pre-processed wood image by applying a gradient operator (such as a Sobel operator) to obtain the gradient amplitude and direction of each pixel in the image; 2. Dividing direction intervals: dividing the 360-degree direction range into a number of direction intervals, usually evenly divided, for example, into 8 direction intervals; 3. Statistical histogram: performing statistics on the gradient direction of each pixel, assigning it to a corresponding direction interval, and accumulating the counts; 4. Normalization: performing normalization processing on the histogram to eliminate the influence of different image sizes and brightness.
[0052] Those skilled in the art should know that convolutional neural networks excel in image feature extraction. By inputting the histogram of oriented gradients into the convolutional neural network model, feature extraction can be performed on the histogram of oriented gradients. There may be defects at different locations on the wood. The spatial attention mechanism is introduced in a certain layer of the convolutional neural network. The mechanism can automatically learn and generate an attention map based on the input image to guide the model to extract features at different spatial locations, multiply the attention with the feature map, and weight the original image so that the model pays more attention to areas with important information when extracting features. That is, the histogram of oriented gradients of the wood is passed through the first convolutional neural network model using the spatial attention mechanism to obtain a feature matrix of the histogram of oriented gradients of the wood.
[0053] In an embodiment of the present application, a possible implementation method of obtaining a wood directional gradient histogram feature matrix by using the first convolutional neural network model using a spatial attention mechanism may be as follows: using each layer of the first convolutional neural network model to perform the following on the input data in the forward pass of the layer: performing convolution processing based on a convolution kernel on the input data to obtain a convolution feature map; passing the convolution feature map through a spatial attention unit to obtain a spatial attention map; calculating the point-by-point multiplication of the convolution feature map and the spatial attention map to obtain a spatial attention feature map; inputting the spatial attention feature map into a nonlinear activation unit to obtain an activation feature map; wherein the input of the first layer of the first convolutional neural network model is the wood directional gradient histogram, and the output of the last layer of the first convolutional neural network model is the wood directional gradient histogram feature matrix.
[0054] The preprocessed wood image itself contains relevant information about wood defects, which is also helpful for detecting wood defects. Therefore, the preprocessed wood image is passed through a deep separable convolutional neural network model to obtain the original wood feature matrix. It should be understood that the deep separable convolutional neural network model is a lightweight convolutional neural network structure with fewer parameters and computational complexity, which is suitable for processing image data. It achieves parameter sharing and efficient feature extraction by decomposing the standard convolution operation into two steps: deep convolution and point-by-point convolution. In wood defect detection, the preprocessed wood image can obtain the original feature matrix of the wood after passing through the deep separable convolutional neural network model. These original feature matrices contain low-level and high-level features in the image. By learning these original features, the model can better understand the content of the wood image and capture information related to the defects.
[0055] In an embodiment of the present application, a possible implementation method of passing the preprocessed wood image through a deep separable convolutional neural network model to obtain the original feature matrix of the wood can be: each layer of the deep separable convolutional neural network model performs the following on the input data during the forward transfer process of the layer: convolution processing on the input data based on the convolution kernel to obtain a convolution feature map; mean pooling processing on the convolution feature map along the channel dimension to obtain a pooling feature map; nonlinear activation on the pooling feature map to obtain an activation feature map; wherein the convolution kernel of the deep separable convolutional neural network model is The output of the last layer of the deep separable convolutional neural network model is the original wood feature matrix, and the input of the first layer of the deep separable convolutional neural network model is the preprocessed wood image.
[0056] It should be understood that the wood directional gradient histogram feature matrix is a texture and structural feature extracted from the wood image, which can capture the texture direction and gradient information of the wood. This information is very useful for distinguishing normal wood from defective wood, because defects usually cause changes in texture and gradient. The wood original feature matrix is a rich feature extracted from the preprocessed wood image by the deep separable convolutional neural network model. These features contain low-level and high-level features in the image and can capture more comprehensive wood information. By fusing the wood directional gradient histogram feature matrix and the wood original feature matrix, their advantages can be combined to obtain a more comprehensive and representative feature representation, that is, the generated wood comprehensive feature matrix. The fusion method can be simple element-level addition or concatenation, or feature fusion through convolution or other operations. The fused wood comprehensive feature matrix will integrate texture, structure and other related features, and can better reflect the overall characteristics of wood. This helps to improve the performance of the wood defect detection method, so that the model can more accurately identify and classify normal wood and defective wood.
[0057] Figure 3 FIG. 1 is a block diagram of a wood image feature encoding module in a wood defect detection system based on image processing according to an embodiment of the present application. Figure 3 As shown, the wood image feature encoding module 130 includes: a texture feature extraction unit 131, used to extract texture features from the pre-processed wood image to obtain a wood directional gradient histogram feature matrix; a wood original feature extraction unit 132, used to pass the pre-processed wood image through a deep separable convolutional neural network model to obtain a wood original feature matrix; a feature fusion unit 133, used to fuse the wood directional gradient histogram feature matrix and the wood original feature matrix to obtain the wood comprehensive feature matrix.
[0058] Figure 4FIG. 1 is a block diagram of a texture feature extraction unit in a wood defect detection system based on image processing according to an embodiment of the present application. Figure 4 As shown, the texture feature extraction unit 131 includes: a directional gradient histogram extraction subunit 1311, used to extract the directional gradient histogram of wood from the preprocessed wood image; a spatial attention feature encoding subunit 1312, used to pass the directional gradient histogram of the wood through a feature extractor including a spatial attention mechanism to obtain the directional gradient histogram feature matrix of the wood.
[0059] Specifically, in the above-mentioned image processing-based wood defect detection system 100, the feature extractor including the spatial attention mechanism is a first convolutional neural network model using the spatial attention mechanism, and the deep separable convolutional neural network model is a second convolutional neural network model serving as a feature extractor.
[0060] Specifically, the feature fusion unit 133 is used to fuse the wood directional gradient histogram feature matrix and the wood original feature matrix using the following fusion formula to obtain the wood comprehensive feature matrix; wherein the fusion formula is:
[0061]
[0062] Among them, M c is the comprehensive characteristic matrix of wood, M a is the wood directional gradient histogram feature matrix, M b is the original characteristic matrix of the wood, It represents the addition of the elements at corresponding positions of the wood directional gradient histogram feature matrix and the wood original feature matrix, and α and β are weighted parameters for controlling the balance between the wood directional gradient histogram feature matrix and the wood original feature matrix in the wood comprehensive feature matrix.
[0063] Finally, the wood comprehensive feature matrix is passed through a classifier to obtain a classification result, and the classification result is used to indicate whether the wood to be detected has defects. The classifier can classify the wood according to the learned features and the label information in the training data, and divide it into normal wood or defective wood. By inputting the wood comprehensive feature matrix into the classifier, defect detection of the wood to be detected can be achieved, and a classification result indicating whether there are defects can be obtained. This method can automatically and efficiently perform wood defect detection, improve production efficiency and quality control level.
[0064] In the embodiment of the present application, the wood comprehensive feature matrix is passed through a classifier to obtain a classification result, and the classification result is used to indicate whether the wood to be inspected has defects. One possible implementation method may be: using the classifier to process the wood comprehensive feature matrix using the following classification formula to generate the classification result; wherein the classification formula is:
[0065] O=softmax{(W n ,B n ):…:(W1,B1)|Project(M c )}
[0066] Where O is the classification result, Project(M c ) represents the projection of the wood comprehensive feature matrix into a vector, W1 to W n is the weight matrix of each fully connected layer, B1 to B n Represents the bias vector of each fully connected layer, and softmax is a normalized exponential function.
[0067] Specifically, the defect result generating module 140 is used to evaluate whether the wood to be inspected has defects based on the wood comprehensive feature matrix.
[0068] In the above-mentioned wood defect detection system 100 based on image processing, it also includes a training module 200 for training the feature extractor including the spatial attention mechanism, the deep separable convolutional neural network model and the classifier.
[0069] Further, considering that first, the training wood directional gradient histogram feature matrix is constructed by extracting directional information from the wood image. The directional gradient histogram is a commonly used feature representation method that counts the gradient directions in the image and represents it in the form of a histogram. By extracting the directional gradient histogram features, information such as texture, edge and shape in the wood image can be captured. These features are often meaningful for wood defect detection because defects usually cause changes in texture, edge or shape. On the other hand, the training wood original feature matrix is extracted by a deep separable convolutional neural network. The convolutional neural network is a powerful image feature extractor that can automatically learn abstract representations of images. Through deep separable convolution, the network can effectively capture local and global features in the wood image, including texture, shape, color, etc. These original features are also useful for wood defect detection because they can provide a more comprehensive and rich image description. Since the features captured by the training wood directional gradient histogram feature matrix and the training wood original feature matrix have different information expressions, simply superimposing or connecting them together may lead to spatial convergence problems of semantic features in high-dimensional feature space. This means that the information of the two features may interfere with or overlap each other, resulting in increased feature redundancy or information loss. To solve this problem, it is necessary to match the feature matrix at the feature level.
[0070] Figure 5 FIG. 1 is a block diagram of a training module in a wood defect detection system based on image processing according to an embodiment of the present application. Figure 5As shown, the training module 200 includes: a training wood image data acquisition unit 210, which is used to acquire an image of the training wood to be detected from a camera, and a true value of whether the training wood to be detected has defects; a training image preprocessing unit 220, which is used to preprocess the image of the training wood to be detected to obtain a training preprocessed wood image; a training directional gradient histogram extraction unit 230, which is used to extract a directional extraction histogram of the training wood from the training preprocessed wood image; a training spatial attention feature encoding unit 240, which is used to pass the directional gradient histogram of the training wood through the feature extractor containing the spatial attention mechanism to obtain a training wood directional gradient histogram feature matrix; a training wood original feature extraction unit 250, which is used to pass the training preprocessed wood image through the deep separable convolutional neural network model to obtain the original feature matrix of training wood; a training feature fusion unit 260, used to fuse the training wood directional gradient histogram feature matrix and the training wood original feature matrix to obtain the training wood comprehensive feature matrix; a feature engineering transition factor calculation unit 270, used to calculate the feature engineering transition factor based on a priori between the training wood directional gradient histogram feature matrix and the training wood original feature matrix; a classification loss unit 280, used to pass the training wood comprehensive feature matrix through the classifier to obtain a classification loss function value; a model training unit 290, used to train the feature extractor including the spatial attention mechanism, the deep separable convolutional neural network model and the classifier using the weighted sum between the classification loss function value and the feature engineering transition factor based on a priori as the loss function value.
[0071] Specifically, the feature engineering transition factor calculation unit 270 includes: calculating the feature engineering transition factor based on the prior between the training wood directional gradient histogram feature matrix and the training wood original feature matrix according to the following calculation formula; wherein the calculation formula is:
[0072]
[0073] Wherein, M1 represents the feature matrix of the directional gradient histogram of the training wood, M2 represents the original feature matrix of the training wood, represents the positional addition of the feature matrix, represents the positional subtraction of the feature matrix, represents the square of the Frobenius norm of the feature matrix, exp(·) represents the exponential operation of the matrix, α and λ represent hyperparameters, and F loss represents the prior-based feature engineering transition factor.
[0074] It should be understood that the weight or scaling factor between the training wood directional gradient histogram feature matrix and the training wood original feature matrix can be calculated by a priori feature engineering transition factor. This transition factor can be learned or adjusted according to the actual data set and task requirements to ensure that the two features are more consistent and balanced in the feature space. By matching at the feature level, the two features can be effectively fused and the redundancy between the features can be reduced, thereby improving the accuracy and robustness of wood defect detection.
[0075] That is, due to the feature differences between the feature matrix of the directional gradient histogram of the training wood and the original feature matrix of the training wood, the spatial convergence of the high-dimensional feature space mapped to the semantic features brought by the superimposed convolutional coding requires the feature matrix to be matched at the feature level. Based on this, in the technical solution of the present application, a priori-based feature engineering transition factor is used to transform the matching problem between feature matrices into a training strategy optimization problem, thereby adopting an optimization technology to improve the matching and fusion degree between feature matrices.
[0076] Specifically, firstly, according to the structure and properties of the training wood directional gradient histogram feature matrix and the training wood original feature matrix, a priori-based feature engineering transition factor strategy is designed to weight and adjust the feature values of different categories and dimensions according to certain prior rules, thereby reducing the information loss and error accumulation in the process of superposition convolution coding. Furthermore, the priori-based feature engineering transition factor is used as the loss function to train the model parameters, and the matching degree between matrices can be constrained by interpolating the displacement matrix based on the prior approximate knowledge of the low-rank matrix without accurate manifold geometric relationship. In this way, the similarity and difference between different matrices are calculated based on the priori feature engineering transition strategy, and the matching between feature matrices is improved to improve the degree of fusion by optimizing and correcting according to a certain threshold value.
[0077] In summary, the wood defect detection system 100 based on image processing according to the embodiment of the present application is explained, which adopts artificial intelligence detection technology based on machine vision, and judges whether the wood to be inspected has defects by extracting features from the wood image. In this way, automatic defect detection of wood can be realized, which is beneficial to improving the efficiency of detection and ensuring the objectivity of the detection results.
[0078] As described above, the wood defect detection system 100 based on image processing according to the embodiment of the present application can be implemented in various terminal devices, such as a server for wood defect detection based on image processing, etc. In one example, the wood defect detection system 100 based on image processing according to the embodiment of the present application can be integrated into the terminal device as a software module and / or a hardware module. For example, the wood defect detection system 100 based on image processing can be a software module in the operating system of the terminal device, or can be an application developed for the terminal device; of course, the wood defect detection system 100 based on image processing can also be one of the many hardware modules of the terminal device.
[0079] Alternatively, in another example, the image processing based wood defect detection system 100 and the terminal device may also be separate devices, and the image processing based wood defect detection system 100 may be connected to the terminal device via a wired and / or wireless network, and transmit interactive information in accordance with an agreed data format.
[0080] Figure 6 FIG. 1 is a flow chart of a wood defect detection method based on image processing according to an embodiment of the present application. Figure 6 As shown, in the wood defect detection method based on image processing, it includes: S110, acquiring an image of the wood to be detected from a camera; S120, preprocessing the image of the wood to be detected to obtain a preprocessed wood image; S130, encoding the image features of the preprocessed wood image to obtain a comprehensive wood feature matrix; S140, based on the comprehensive wood feature matrix, evaluating whether the wood to be detected has defects.
[0081] Here, those skilled in the art will appreciate that the specific operations of each step in the above-mentioned wood defect detection method based on image processing have been described in detail in the above reference. Figures 1 to 5 The description of the image processing based wood defect detection system has been introduced in detail, and therefore, its repeated description will be omitted.
[0082] In summary, the wood defect detection method based on image processing based on the embodiment of the present application is explained, which adopts artificial intelligence detection technology based on machine vision, and judges whether the wood to be inspected has defects by extracting features from the wood image. In this way, automatic defect detection of wood can be realized, which is conducive to improving the efficiency of detection and ensuring the objectivity of the detection results.
[0083] Below, reference Figure 7 To describe a computing device according to an embodiment of the present application. Figure 7 is a block diagram of a computing device according to an embodiment of the present application.
[0084] like Figure 7 As shown, the computing device 10 includes a processing system 11, one or more computer-readable media 12, and one or more I / O interfaces 13 that are communicatively coupled to each other. The computing device 10 also includes a bus system and / or other forms of connection mechanisms (not shown).
[0085] Processing system 11 represents the functionality of performing one or more operations using hardware. Thus, processing system 11 is illustrated as including hardware elements 14 that may be configured as processors, functional blocks, etc. Hardware elements 14 are not limited by the materials from which they are formed or the processing mechanisms employed therein. For example, a processor may be composed of (multiple) semiconductors and / or transistors (e.g., electronic integrated circuits (ICs)). The processor may control other components in computing device 10 to perform desired functions.
[0086] The computer-readable medium 12 is illustrated as including a memory 15. The memory 15 represents a memory associated with one or more computer-readable media. The memory 15 may include volatile media (such as random access memory (RAM)) and / or non-volatile media (such as read-only memory (ROM), flash memory, optical disk, magnetic disk, etc.). The memory 15 may include fixed media (e.g., RAM, ROM, fixed hard disk drive, etc.) and removable media (e.g., flash memory, removable hard disk drive, optical disk, etc.). The computer-readable medium 12 may store one or more computer program instructions to implement the above-described wood defect detection method based on image processing of various embodiments of the present application and / or other desired functions. Various contents such as images of wood to be detected may also be stored in the computer-readable storage medium.
[0087] One or more I / O interfaces 13 represent functions that allow a user to input commands and information to the computing device 10 and optionally also allow information to be presented to the user and / or other components or devices using various input / output devices. Examples of input devices include a keyboard, a cursor control device (e.g., a mouse), a microphone (e.g., for voice input), a scanner, a touch function (e.g., a capacitive or other sensor configured to detect physical touch), a camera (e.g., a visible or invisible wavelength (such as infrared frequency) can be used to detect motion that does not involve touch as a gesture), etc. Examples of output devices include a display device (e.g., a monitor or projector), a speaker, a printer, a network card, a tactile response device, etc. The output device can output various information to the outside, including the result of determining whether the wood to be inspected has defects, etc.
[0088] Of course, to simplify, Figure 7Only some of the components related to the present application in the computing device 10 are shown, and components such as buses, etc. are omitted. In addition, according to specific application situations, the computing device 10 may also include any other appropriate components.
[0089] In addition to the above methods and devices, embodiments of the present application may also be computer-readable media. Computer-readable media may include various media that can be accessed by computing device 10. As an example and not limitation, computer-readable media may include "computer-readable storage media" and "computer-readable signal media".
[0090] In contrast to a simple signal transmission, carrier wave, or signal itself, "computer-readable storage medium" refers to a medium and / or device capable of persistently storing information, and / or a tangible storage device. Therefore, a computer-readable storage medium refers to a non-signal-bearing medium. Computer-readable storage media include hardware such as volatile and non-volatile, removable and non-removable media and / or storage devices implemented in a method or technology suitable for storing information (such as computer-readable instructions, data structures, program modules, logic elements / circuits, or other data). Examples of computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage device, hard disk, cassette, magnetic tape, magnetic disk storage device or other magnetic storage device, or other storage device, tangible medium, or article of manufacture suitable for storing desired information and accessible by a computer.
[0091] "Computer-readable signal media" refers to signal-bearing media that is configured to send instructions to the hardware of computing device 10, such as via a network. Signal media typically can embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, data signal, or other transport mechanism. Signal media also include any information transfer media. The term "modulated data signal" refers to a signal that has one or more of its characteristics set or changed so as to encode information into the signal. By way of example and not limitation, communication media include wired media such as a wired network or direct connection and wireless media such as acoustic, RF, infrared, and other wireless media.
[0092] As previously described, hardware elements 14 and computer-readable media 12 represent instructions, modules, programmable device logic, and / or fixed device logic implemented in hardware form, which in some embodiments can be used to implement at least some aspects of the technology described in this application. Hardware elements can include integrated circuits or systems on a chip, application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), complex programmable logic devices (CPLDs), and other implementations in silicon or components of other hardware devices. In this context, hardware elements can be used as processing devices that perform program tasks defined by instructions, modules, and / or logic embodied by hardware elements, as well as hardware devices for storing instructions for execution, such as the computer-readable storage media described previously.
[0093] The aforementioned combination may also be used to implement the various techniques and modules described herein. Therefore, software, hardware or program modules and other program modules may be implemented as one or more instructions and / or logic embodied on some form of computer-readable storage medium and / or by one or more hardware elements 14. The computing device 10 may be configured to implement specific instructions and / or functions corresponding to the software and / or hardware modules. Therefore, for example, by using a computer-readable storage medium and / or hardware element 14 of a processing system, the module may be implemented as a module executable by the computing device 10 as software, at least in part, in hardware. Instructions and / or functions may be executable / operable by one or more articles (e.g., one or more computing devices 10 and / or processing systems 11) to implement the techniques, modules and examples described herein.
[0094] The above is only a preferred embodiment of the present application and does not constitute any form of limitation to the present application. Although the present application has been disclosed as a preferred embodiment as above, it is not intended to limit the present application. Any technician familiar with the profession can make some changes or modifications to equivalent embodiments of the technical contents disclosed above without departing from the scope of the technical solution of the present application. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application still falls within the scope of the technical solution of the present application.
Claims
1. A wood defect detection system based on image processing, characterized in that: include: A wood image data acquisition module is used to acquire the image of the wood to be detected from a camera; An image preprocessing module, used for preprocessing the image of the wood to be detected to obtain a preprocessed wood image; A wood image feature encoding module, used for performing image feature encoding on the pre-processed wood image to obtain a wood comprehensive feature matrix; A defect result generating module, used for evaluating whether the wood to be inspected has defects based on the wood comprehensive feature matrix; Wherein, the wood image feature encoding module includes: A texture feature extraction unit, used for extracting texture features from the pre-processed wood image to obtain a wood directional gradient histogram feature matrix; A wood original feature extraction unit, used for passing the pre-processed wood image through a deep separable convolutional neural network model to obtain a wood original feature matrix; A feature fusion unit, used for fusing the wood directional gradient histogram feature matrix and the wood original feature matrix to obtain the wood comprehensive feature matrix; Wherein, the texture feature extraction unit comprises: A directional gradient histogram extraction subunit, used for extracting a directional gradient histogram of wood from the pre-processed wood image; A spatial attention feature encoding subunit, used for passing the wood directional gradient histogram through a feature extractor including a spatial attention mechanism to obtain a feature matrix of the wood directional gradient histogram; The feature extractor including the spatial attention mechanism is a first convolutional neural network model using the spatial attention mechanism, and the depth-separable convolutional neural network model is a second convolutional neural network model as a feature extractor; Wherein, the defect result generating module is used to: Passing the wood comprehensive feature matrix through a classifier to obtain a classification result, wherein the classification result is used to indicate whether the wood to be inspected has defects; Among them, it also includes a training module for training the feature extractor including the spatial attention mechanism, the deep separable convolutional neural network model and the classifier; Wherein, the training module includes: A training wood image data acquisition unit is used to acquire an image of the training wood to be inspected from a camera, as well as a true value of whether the training wood to be inspected has defects; A training image preprocessing unit, used for preprocessing the training image of the wood to be detected to obtain a training preprocessed wood image; A training directional gradient histogram extraction unit, used to extract a directional extraction histogram of training wood from the training pre-processed wood image; A training spatial attention feature encoding unit, used for passing the directional gradient histogram of the training wood through the feature extractor including the spatial attention mechanism to obtain a feature matrix of the directional gradient histogram of the training wood; A training wood original feature extraction unit, used for passing the training preprocessed wood image through the deep separable convolutional neural network model to obtain a training wood original feature matrix; A training feature fusion unit, used for fusing the training wood directional gradient histogram feature matrix and the training wood original feature matrix to obtain a training wood comprehensive feature matrix; A feature engineering transition factor calculation unit, used for calculating a priori-based feature engineering transition factors between the training wood directional gradient histogram feature matrix and the training wood original feature matrix; A classification loss unit, used for passing the training wood comprehensive feature matrix through the classifier to obtain a classification loss function value; A model training unit, configured to train the feature extractor including the spatial attention mechanism, the deep separable convolutional neural network model and the classifier by taking the weighted sum of the classification loss function value and the feature engineering transition factor based on the prior as the loss function value; Wherein, the feature engineering transition factor calculation unit includes: calculating the feature engineering transition factor based on a priori between the training wood directional gradient histogram feature matrix and the training wood original feature matrix by the following calculation formula; Wherein, the calculation formula is: Wherein, M1 represents the feature matrix of the directional gradient histogram of the training wood, M2 represents the original feature matrix of the training wood, represents the positional addition of the feature matrix, represents the positional subtraction of the feature matrix, represents the square of the Frobenius norm of the feature matrix, exp(·) represents the exponential operation of the matrix, α and λ represent hyperparameters, and F loss represents the prior-based feature engineering transition factor.
2. The wood defect detection system based on image processing according to claim 1 is characterized in that: The feature fusion unit is used to fuse the wood directional gradient histogram feature matrix and the wood original feature matrix using the following fusion formula to obtain the wood comprehensive feature matrix; Among them, the fusion formula is: Among them, M c is the comprehensive characteristic matrix of wood, M a is the wood directional gradient histogram feature matrix, M b is the original characteristic matrix of the wood, It represents the addition of the elements at corresponding positions of the wood directional gradient histogram feature matrix and the wood original feature matrix, and α and β are weighted parameters for controlling the balance between the wood directional gradient histogram feature matrix and the wood original feature matrix in the wood comprehensive feature matrix.
3. A wood defect detection method based on image processing, applied to the wood defect detection system based on image processing according to claim 1, characterized in that: include: Acquire an image of the wood to be inspected from a camera; Preprocessing the image of the wood to be detected to obtain a preprocessed wood image; Performing image feature encoding on the pre-processed wood image to obtain a wood comprehensive feature matrix; Based on the comprehensive wood feature matrix, it is used to evaluate whether the wood to be inspected has defects.
Citation Information
Patent Citations
Intelligent detection method for wood optimizing cut-off saw based on deep learning
CN109557104A
Face tracking method and system based on multi-feature fusion
CN112215155A
Facial expression recognition method based on deep learning feature fusion
CN113516047A
Flaw detection method, system and device for furniture plates
CN114743102A
Ship image detection method and device and storage medium
CN115082781A