Wood board sorting method and system based on machine learning
By establishing a multi-scale wooden board image database and machine learning model, segmenting wooden board images and calculating defect index, the problems of low efficiency and inaccurate grading in the existing technology are solved, and more scientific wooden board grading and resource utilization are achieved.
Patent Information
- Application Number
- CN202510587333.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-08
AI Technical Summary
The existing wood board sorting technology mainly relies on manual visual inspection, is inefficient and subjective, and cannot accurately consider the location and continuity of defects, resulting in the grading results that are inconsistent with the actual use value.
Establish a multi-scale normal wood plank image database, train a multi-scale wood grain deviation detection model, divide the wood plank image into sub-images through machine learning methods, calculate the defect index and continuous index, comprehensively evaluate the quality of the wood plank and sort it.
A more scientific grading of wood boards has been achieved, accurately reflecting the actual use value of wood boards, and improving the scientific nature of sorting and the efficiency of wood resource utilization.
Smart Images

Figure CN120510429A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and more specifically, to a wood board sorting method and system based on machine learning. Background Art
[0002] With the increasing automation of industrial production, the wood processing industry is placing higher demands on the accuracy and efficiency of wood panel quality inspection and sorting. As a critical industrial raw material, the quality of wood panels directly impacts the quality and value of downstream products. Traditional wood panel sorting relies primarily on manual visual inspection, a method that is not only inefficient but also subjective, inconsistent, and susceptible to fatigue, making it difficult to meet the demands of modern production.
[0003] In recent years, machine vision technology has been widely used in the field of wood board quality inspection. Existing machine vision inspection systems can automatically identify visible defects such as knots, cracks, and wormholes on wood board surfaces through image acquisition, processing, and analysis, significantly improving inspection efficiency and consistency. However, these systems primarily focus on defect identification—determining the presence or absence of defects on the board surface—when analyzing and grading wood boards. They lack in-depth analysis of the distribution characteristics of defects. In reality, the location of defects has a significant impact on the usability of a board. For example, defects located in the center of a board typically have a greater impact on the product's appearance and structural strength than those located near the edges. However, existing systems often overlook this fact, relying solely on the presence or absence of defects or a simple count of their number as criteria. Furthermore, existing technologies fail to adequately consider the size and continuity of defects. In practice, the impact of multiple small defects distributed dispersedly on the usability of a board differs significantly from that of a single, large, concentrated defect. Existing systems, which typically only consider the overall defect area or number, fail to distinguish between these different scenarios, resulting in grading results that are inconsistent with the actual usability of the board. Summary of the Invention
[0004] In order to overcome the problem that the grading results of the existing technology are inconsistent with the actual use value, the present invention proposes a wood board sorting method and system based on machine learning to solve the above problem.
[0005] The present invention provides the following technical solutions: A wood board sorting method based on machine learning, comprising: Establishing a multi-scale normal wood board image database, wherein the multi-scale normal wood board image database is used to store normal wood board images of different sizes; Based on a multi-scale normal wood board image database, we train corresponding detection models for different sizes to determine whether a wood board image is normal, thus forming a multi-scale wood grain deviation detection model set. Acquire an image of a wood board to be sorted, and acquire segmentation sizes corresponding to different size scales according to the size of the image of the wood board to be sorted and different size scales in the multi-scale normal wood board image database; The wooden board image is divided into multiple sub-images according to the segmentation size, and the spatial position information of each sub-image is recorded; Select a wood grain deviation detection model corresponding to the sub-image size, make a judgment on each sub-image, and mark the sub-image with an abnormal judgment result as a defective image; Determining the grade of the wood board to be sorted based on all defect images and the image of the wood board to be sorted; The wood boards to be sorted are sorted according to the divided grades.
[0006] Preferably, the multi-scale normal wood board image database includes at least two preset different size specifications, and each size specification includes at least 100 normal wood board images, and the normal wood board images are pre-marked defect-free standard wood board images.
[0007] Preferably, forming a multi-scale wood grain deviation detection model set includes: Extract normal wood board images from a multi-scale normal wood board image database according to different size specifications; Preprocess the normal wood board images of each size specification; Extracting a feature vector of each preprocessed image, wherein the feature vector includes texture features, color features, and structural features; Build a feature sample library and group feature vectors according to size specifications; For each size specification feature sample group, a single-class classification algorithm is used to construct the feature space discrimination boundary, and the inside of the boundary is defined as the normal area; Set model training parameters, including algorithm core parameters and optimization variables; Optimize training parameters through cross-validation method and select the optimal parameter combination; The trained models and their parameters for each size specification are saved as a multi-scale wood grain deviation detection model set, and an index relationship between the sub-image size and the corresponding detection model is established.
[0008] Preferably, obtaining the segmentation sizes corresponding to different size scales includes: Extract all preset different size specifications from the multi-scale normal wood board image database; For each preset size specification, calculate the edge margin generated when the image of the wood board to be sorted is segmented using the size; Compare the margins corresponding to all preset size specifications and select the preset size specification with the smallest margin as the segmentation size; The calculation steps of the edge margin include: Get the image size of the wood board to be sorted ; Get the preset size specifications ; calculate And round down to get the number of sub-regions that can be completely divided in the horizontal direction ; calculate And round down to get the number of sub-regions that can be completely divided in the vertical direction ; Using the formula Calculate horizontal edge margin; Using the formula Calculate vertical edge margins; Use the sum of the horizontal margin and the vertical margin as the margin.
[0009] Preferably, dividing the wooden board image into a plurality of sub-images according to the segmentation size and recording the spatial position information of each sub-image includes: According to the segmentation size, the image of the wood board to be sorted is segmented regularly starting from the upper left corner; the segmented image is divided into a complete image and an incomplete image; and the incomplete image is processed; Among them, a complete image refers to an image that can be completely captured from the image of the wood board to be sorted according to the segmentation size; an incomplete image refers to an image that cannot be completely captured from the image of the wood board to be sorted according to the segmentation size; The processing of the incomplete image includes: if the area of the intercepted image is smaller than a preset ratio of the segmentation size, discarding the incomplete image; otherwise, mirror-flipping the content of the intercepted image along the center line and copying it to the area not intercepted, thereby filling the incomplete image, wherein the preset ratio is at least 50%; After the segmentation and incomplete image processing are completed, the position information of each sub-image in the original image is recorded, and the position information is represented by row and column coordinates.
[0010] Preferably, the determining the grade of the wood boards to be sorted based on all defect images and the images of the wood boards to be sorted comprises: Calculate the ratio of defective images to the total number of sub-images as the overall defect index; Obtaining a defect distribution index based on the spatial position information of each defect image; According to the spatial position information of each defect image, adjacent defect sub-regions are identified to obtain the defect continuity index; The wood boards to be sorted are divided into different grades based on the overall defect index, defect distribution index and defect continuity index.
[0011] Preferably, obtaining the defect distribution index according to the spatial position information of each defect image includes: Get the maximum horizontal coordinate in the spatial position information of the sub-image and the maximum ordinate ; For each defect image, get its coordinates , use the following formula to calculate the defect distribution value : , The maximum defect distribution value among all defect images is taken as the defect distribution index; The step of identifying adjacent defect sub-regions based on the spatial position information of each defect image and obtaining the defect continuity index includes: Based on the spatial location information of each defect image, a defect area connectivity graph is constructed; all adjacent defect sub-images are identified and classified into the same connected area; the number of defect sub-images contained in each connected area is calculated; and the number of defect sub-images contained in the largest connected area is taken as the defect continuity index.
[0012] Preferably, the classifying the wood boards to be sorted into different grades based on the overall defect index, the defect distribution index and the defect continuity index comprises: Setting preset thresholds for the overall defect index, defect distribution index, and defect continuity index; When the overall defect index, defect distribution index and defect continuity index are all lower than their corresponding preset thresholds, the wood board to be sorted is classified into the highest grade; When any one of the overall defect index, defect distribution index and defect continuity index exceeds its preset threshold, the wood board to be sorted is classified as the second highest grade; When two of the overall defect index, defect distribution index and defect continuity index exceed their preset thresholds, the wood board to be sorted is classified as medium grade; When the overall defect index, defect distribution index and defect continuity index all exceed their preset thresholds, the wood boards to be sorted are classified into the lowest grade.
[0013] The present invention also provides a wood board sorting system based on machine learning, which is used to implement a wood board sorting method based on machine learning, comprising: A database establishment module is used to establish a multi-scale normal wood board image database, wherein the multi-scale normal wood board image database is used to store normal wood board images of different sizes; A model training module is used to train corresponding detection models for judging whether a wood board image is normal for each different size specification based on a multi-scale normal wood board image database, thereby forming a multi-scale wood grain deviation detection model set; An image acquisition module is used to acquire images of the wood boards to be sorted, and acquire segmentation sizes corresponding to different size scales according to the size of the images of the wood boards to be sorted and different size scales in the multi-scale normal wood board image database; An image segmentation module is used to segment the wooden board image into multiple sub-images according to the segmentation size and record the spatial position information of each sub-image; The defect detection module is used to select a wood grain deviation detection model corresponding to the sub-image size, judge each sub-image, and mark the sub-image with abnormal judgment results as a defect image; A grade determination module, configured to determine the grade of the wood boards to be sorted based on all defect images and images of the wood boards to be sorted; The sorting execution module is used to sort the wooden boards to be sorted according to the divided grades.
[0014] The present invention provides a wood board sorting method and system based on machine learning, which has the following beneficial effects: By obtaining the maximum horizontal and vertical coordinates in the spatial position information of the sub-image and calculating the positional relationship of each defect image relative to the center of the board, the impact of defect distribution on the use value of the board can be scientifically quantified. This method pays special attention to defects in the central area of the board and assigns them a higher weight, thereby solving the problem of existing technologies ignoring the importance of defect location and achieving a more refined grading that meets the needs of actual applications. By calculating the defect continuity index, the problem of existing technologies' insufficient consideration of defect size and continuity is effectively solved. By constructing a defect area connectivity graph, identifying adjacent defect sub-images and grouping them into the same connected area, and calculating the number of defect sub-images contained in the largest connected area, the actual size of a single defect can be accurately assessed, providing a more accurate basis for quality assessment for the rational use of wood boards.
[0015] By comprehensively considering three dimensions—overall defect index, defect distribution index, and defect continuity index—this solution achieves a comprehensive assessment of wood board quality, overcoming the limitations of existing single-metric evaluation methods. This multi-dimensional evaluation system more accurately reflects the actual use value of wood boards, improving the scientific and practical nature of wood board grading, providing wood processing companies with more precise quality management tools and improving the efficiency of wood resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 Schematic diagram of a process of wood board sorting method based on machine learning of the present invention; Figure 2 This is a module schematic diagram of a wood board sorting system based on machine learning of the present invention. DETAILED DESCRIPTION
[0017] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0018] Example 1 See also Figure 1 In this embodiment, a wood board sorting method based on machine learning includes: S1. Establish a multi-scale normal wood board image database, which is used to store normal wood board images of different sizes; The multi-scale normal wood board image database contains at least two preset different size specifications, and each size specification contains at least 100 normal wood board images. The normal wood board images are pre-marked defect-free standard wood board images.
[0019] In this embodiment, a multi-scale normal wood board image database can be established by the following steps: First, at least two different preset sizes can be determined, for example, 128×128 pixels and 256×256 pixels can be selected as the basic sizes. An industrial camera can be used to photograph defect-free wooden boards under controlled lighting conditions, and the camera can be kept perpendicular to the surface of the board to obtain the best image effect. The collected images can be appropriately preprocessed, such as denoising and lighting equalization. The images can be reviewed by personnel with experience in wood inspection. After confirming that there are no obvious defects such as knots, cracks, and insect eyes in the images, they can be marked as normal wooden board images. Sub-images that meet the preset size specifications can be cropped from the original high-resolution image, ensuring that at least 100 normal wooden board images of each size specification are collected.
[0020] S2. Based on the multi-scale normal wood board image database, corresponding wood board detection models for determining whether the wood board image is normal are trained for each different size specification to form a multi-scale wood grain deviation detection model set; The multi-scale wood grain deviation detection model set includes: Extract normal wood board images from a multi-scale normal wood board image database according to different size specifications; Preprocess the normal wood board images of each size specification; Extracting the feature vector of each preprocessed image, the feature vector includes texture features, color features and structural features; Build a feature sample library and group feature vectors according to size specifications; For each size specification feature sample group, a single-class classification algorithm is used to construct the feature space discrimination boundary, and the inside of the boundary is defined as the normal area; Set model training parameters, including algorithm core parameters and optimization variables; Optimize training parameters through cross-validation method and select the optimal parameter combination; The trained models and their parameters for each size specification are saved as a multi-scale wood grain deviation detection model set, and an index relationship between the sub-image size and the corresponding detection model is established.
[0021] In this embodiment, a multi-scale wood grain deviation detection model set can be formed by the following steps: First, we can extract normal wood board images at different sizes (e.g., 128×128 pixels and 256×256 pixels) from an established multi-scale database of normal wood board images. For each size, we can perform preprocessing operations, including contrast enhancement, Gaussian filtering, denoising, and image normalization, to enhance image features and mitigate the effects of illumination variations.
[0022] Next, the feature vectors of each preprocessed image can be extracted. For texture features, the gray-level co-occurrence matrix (GLCM) can be used to extract statistics such as energy, contrast, correlation, and entropy. For color features, histogram features of hue, saturation, and brightness can be extracted in the HSV color space. For structural features, local binary patterns (LBP) or Gabor filters can be used to extract the directional and periodic characteristics of the wood grain.
[0023] The extracted feature vectors can be constructed into a feature sample library and grouped by size. For each size sample group, a single-class classification algorithm, such as a one-class support vector machine (SVM) or isolation forest, can be used to construct a discriminant boundary in the feature space. These algorithms learn the distribution characteristics of normal wood panel samples and establish a closed boundary in the feature space, defining the area within the boundary as the normal region.
[0024] During model training, you can set key training parameters, such as the kernel type (RBF kernel is optional) for the One-Class SVM, the penalty factor ν (controls the proportion of outliers), and the kernel parameter γ (controls the smoothness of the decision boundary). These parameters can be optimized using a 5-fold cross-validation method. Specifically, split the dataset into 5 parts, using 4 parts as the training set and 1 part as the validation set. After 5 cycles, the parameter combination with the best average performance is selected.
[0025] After training is complete, the models for each size and their optimal parameters can be saved as a multi-scale wood grain deviation detection model set. At the same time, an index relationship can be established between the sub-image size and the corresponding detection model, for example, 128×128 pixels corresponds to model_128, 256×256 pixels corresponds to model_256, and so on.
[0026] When using these models to detect wood board images, the appropriate detection model is automatically selected based on the input image size. For each wood board image to be detected, the same feature vector used during training is extracted and then input into the corresponding model. The model calculates the distance from the feature vector to the decision boundary, or the anomaly score, and determines whether the image is a normal wood board image based on a preset threshold. If the feature vector falls within the normal region (i.e., the decision function value is greater than 0 or the anomaly score is below the threshold), the image is considered normal; otherwise, it is considered an abnormal wood board with grain deviations.
[0027] Through this method, the multi-scale wood grain deviation detection model set formed can effectively perform normal / abnormal discrimination on wood board images of different sizes, providing reliable technical support for subsequent wood board sorting.
[0028] S3. Obtain an image of the wood board to be sorted, and obtain segmentation sizes corresponding to different size scales according to the size of the image of the wood board to be sorted and different size scales in the multi-scale normal wood board image database; Get the segmentation size corresponding to different size scales including: Extract all preset different size specifications from the multi-scale normal wood board image database; For each preset size specification, calculate the edge margin generated when the image of the wood board to be sorted is segmented using the size; Compare the margins corresponding to all preset size specifications and select the preset size specification with the smallest margin as the segmentation size; The calculation steps of the edge margin include: Get the image size of the wood board to be sorted ; Get the preset size specifications ; calculate And round down to get the number of sub-regions that can be completely divided in the horizontal direction ; calculate And round down to get the number of sub-regions that can be completely divided in the vertical direction ; Using the formula Calculate horizontal edge margin; Using the formula Calculate vertical edge margins; Use the sum of the horizontal margin and the vertical margin as the margin.
[0029] In this embodiment, the segmentation sizes corresponding to different size scales can be obtained by the following steps: First, an industrial camera or scanning device can be used to obtain a complete image of the wood board to be sorted. After obtaining the image, the actual size of the image can be recorded.
[0030] Then, all preset different sizes can be extracted from the multi-scale normal wood board image database. In this embodiment, it is assumed that the database contains two or more preset sizes.
[0031] For each preset size specification, the edge margin generated when the image of the wood board to be sorted is segmented using this size can be calculated. The steps for calculating the edge margin are as follows: First, obtain the image size of the wood board to be sorted and the preset size specification to be evaluated.
[0032] Then, the number of sub-regions that can be completely divided in the horizontal direction can be calculated and rounded down, that is, the image length is divided by the length of the preset size and rounded down. Similarly, the number of sub-regions that can be completely divided in the vertical direction can be calculated and rounded down.
[0033] Next, we can calculate the horizontal margin by subtracting the length of the image from the length of all complete subregions and multiplying it by the image width. Similarly, we can calculate the vertical margin.
[0034] Finally, the total edge margin can be taken as the sum of the horizontal edge margin and the vertical edge margin.
[0035] After performing the above calculations on all preset size specifications, their corresponding total edge margins can be compared, and the preset size specification with the smallest edge margin can be selected as the final segmentation size.
[0036] This method ensures that when segmenting the wood plank images, the image area is maximized, unused edge areas are reduced, and the comprehensiveness and accuracy of detection are improved. A smaller edge margin means that when segmenting the plank images to that size specification, the effective area in the plank image is more fully utilized, and less blank edge area is wasted.
[0037] S4, dividing the wooden board image into multiple sub-images according to the segmentation size, and recording the spatial position information of each sub-image; The wooden board image is divided into multiple sub-images according to the segmentation size, and the spatial position information of each sub-image is recorded, including: According to the segmentation size, the image of the wood board to be sorted is segmented regularly starting from the upper left corner; the segmented image is divided into a complete image and an incomplete image; and the incomplete image is processed; Among them, a complete image refers to an image that can be completely captured from the image of the wood board to be sorted according to the segmentation size; an incomplete image refers to an image that cannot be completely captured from the image of the wood board to be sorted according to the segmentation size; Processing of incomplete images includes: if the area of the intercepted image is smaller than a preset ratio of the segmentation size, the incomplete image is discarded; otherwise, the content of the intercepted image is mirror-flipped along the center line and copied to the area not intercepted to fill the incomplete image, wherein the preset ratio is at least 50%; After completing the segmentation and processing of the incomplete image, the position information of each sub-image in the original image is recorded, and the position information is represented by row and column coordinates.
[0038] In this embodiment, after obtaining the optimal segmentation size, the image of the wood board to be sorted can be segmented into multiple sub-images through the following steps: First, the image of the wood planks to be sorted can be segmented according to the segmentation size determined in the previous step. The segmentation process begins at the top left corner of the image and gradually captures sub-images along the horizontal and vertical directions according to the segmentation size. For example, if the segmentation size is determined to be 128×128 pixels, a 128×128 pixel sub-image is captured starting from the top left corner of the image. Then, the sub-image is captured by moving 128 pixels to the right, and the next sub-image is captured until the right edge of the image is reached. The sub-image is then captured again, moving 128 pixels downward, and the same process is repeated until the entire image area is processed.
[0039] During the segmentation process, the captured sub-images can be divided into two categories: complete images and incomplete images. A complete image is a sub-image that can be completely captured from the image of the wood planks to be sorted according to the segmentation size (e.g., 128×128 pixels). An incomplete image is a sub-image located at the edge of the original image and cannot be completely captured according to the segmentation size. For example, only a partial area (e.g., 100×128 pixels or 128×80 pixels) may fall within the original image range.
[0040] Incomplete images can be processed based on the ratio of the cropped area to the segmented size. First, the ratio of the cropped area to the segmented size is calculated. If this ratio is less than a preset threshold (at least 50%), the incomplete image is discarded and excluded from subsequent analysis. If the ratio is greater than or equal to the preset threshold, the incomplete image needs to be filled.
[0041] The infill process can be performed using a mirror flipping method. Specifically, the captured image content can be mirrored along a midline perpendicular to the missing boundary and then copied to the uncaptured area. For example, if the right edge is missing, the existing content can be mirrored horizontally along the midline of the right boundary; if the bottom edge is missing, the existing content can be mirrored vertically along the midline of the bottom boundary. This method maintains texture continuity between the infilled area and the original area, reducing the impact of boundary effects on subsequent analysis.
[0042] After segmentation and processing of incomplete images, the position of each sub-image within the original image needs to be recorded. This position information can be expressed using row and column coordinates, with counting starting at (1,1). For example, the position of the first sub-image in the upper left corner of the original image can be recorded as (1,1), the sub-image to its right as (1,2), the sub-image on the left of the second row as (2,1), and so on. This method of recording position information facilitates rapid location of the sub-image within the original image during subsequent analysis, and is particularly useful for accurately tracking the distribution of defects on the original wood board when defects are discovered.
[0043] Through the segmentation and position recording process described above, the complete image of the wood plank to be sorted is converted into a series of uniformly sized, clearly positioned sub-images, laying the foundation for subsequent wood grain deviation detection. Furthermore, the rational processing of incomplete images ensures that the edge areas of the wood plank are not overlooked, improving the comprehensiveness of the detection.
[0044] S5. Select a wood grain deviation detection model corresponding to the sub-image size, perform a judgment on each sub-image, and mark a sub-image with an abnormal judgment result as a defective image; In this embodiment, after completing the segmentation of the wood board image and recording the position information, the following steps can be used to detect wood grain deviation for each sub-image: First, based on the sub-image size obtained in the previous step, a corresponding detection model can be selected from the multi-scale wood grain deviation detection model set. For example, if the sub-image size is 128×128 pixels, a wood grain deviation detection model trained for that size specification is selected. This matching selection ensures that the model is adaptable to the input image features.
[0045] Next, each sub-image can be preprocessed to align with the image processing used during model training. Feature vectors can then be extracted from these preprocessed sub-images, including texture, color, and structural features, consistent with the feature extraction method used during model training. The extracted feature vectors are then fed into the selected wood grain deviation detection model, which then outputs a judgment indicating whether the sub-image is a normal wood board image.
[0046] For sub-images that are judged to be abnormal, they can be marked as defective images and their location information can be recorded. In this way, effective defect detection can be performed on each sub-region of the wood board image, providing basic data for subsequent wood board grade classification.
[0047] S6. Determine the grade of the wood board to be sorted based on all defect images and the image of the wood board to be sorted; The grade of the wood board to be sorted is determined based on all defect images and the image of the wood board to be sorted, including: Calculate the ratio of defective images to the total number of sub-images as the overall defect index; Obtaining a defect distribution index based on the spatial position information of each defect image; According to the spatial position information of each defect image, adjacent defect sub-regions are identified to obtain the defect continuity index; The wood boards to be sorted are divided into different grades based on the overall defect index, defect distribution index and defect continuity index.
[0048] According to the spatial position information of each defect image, the defect distribution index is obtained including: Get the maximum horizontal coordinate in the spatial position information of the sub-image and the maximum ordinate ; For each defect image, get its coordinates , use the following formula to calculate the defect distribution value : , The maximum defect distribution value among all defect images is taken as the defect distribution index; Based on the spatial location information of each defect image, adjacent defect sub-regions are identified and the defect continuity index is obtained, including: Based on the spatial location information of each defect image, a defect area connectivity graph is constructed; all adjacent defect sub-images are identified and classified into the same connected area; the number of defect sub-images contained in each connected area is calculated; and the number of defect sub-images contained in the largest connected area is taken as the defect continuity index.
[0049] Based on the overall defect index, defect distribution index and defect continuity index, the wood boards to be sorted are divided into different grades, including: Setting preset thresholds for the overall defect index, defect distribution index, and defect continuity index; When the overall defect index, defect distribution index and defect continuity index are all lower than their corresponding preset thresholds, the wood board to be sorted is classified into the highest grade; When any one of the overall defect index, defect distribution index and defect continuity index exceeds its preset threshold, the wood board to be sorted is classified as the second highest grade; When two of the overall defect index, defect distribution index and defect continuity index exceed their preset thresholds, the wood board to be sorted is classified as medium grade; When the overall defect index, defect distribution index and defect continuity index all exceed their preset thresholds, the wood boards to be sorted are classified into the lowest grade.
[0050] In this embodiment, after completing the defect detection of the sub-image, the grade of the wood board to be sorted can be determined by the following steps: First, three key metrics can be calculated based on the inspection results to assess the overall quality of the wood board. The first metric is the overall defect index, which is calculated by calculating the ratio of the number of defective images to the total number of sub-images. This index reflects the overall defect coverage of the wood board and ranges from 0 to 1, with higher values indicating more defects on the board.
[0051] The second metric is the defect distribution index, calculated based on the spatial location of each defect image. This index primarily reflects the distribution of defects within the board, specifically whether the defects are located in the center of the board. The defect distribution index also ranges from 0 to 1, with higher values indicating defects closer to the center of the board, which generally has a greater impact on the board's usability.
[0052] The third metric is the defect continuity index, which is calculated by identifying adjacent defect subregions. This index reflects the size or continuity of a single defect and is an integer representing the number of subimages contained within the largest connected defect region. Larger values indicate larger individual defects, which generally indicate more severe quality issues.
[0053] Next, we can classify the wood planks to be sorted into different grades based on these three metrics. First, we need to set the thresholds for the three metrics. For example, we can set the threshold for the overall defect index to 0.1 (allowing a maximum of 10% of the area to have defects), the threshold for the defect distribution index to 0.6 (disallowing obvious defects in the central area), and the threshold for the defect continuity index to 3 (disallowing a single defect larger than three consecutive sub-images).
[0054] Based on these thresholds, boards can be divided into four grades: When the overall defect index, defect distribution index, and defect continuity index are all below their respective preset thresholds, the wood planks are classified as Grade A (the highest grade). This type of wood planks have few noticeable defects and are suitable for use in high-end furniture or other applications requiring the highest aesthetic standards.
[0055] When any one of the three indicators exceeds its preset threshold, the wood board to be sorted can be classified as Grade B (the second highest grade). This type of wood board has a few defects, but the overall quality is still good and is suitable for general furniture or interior structural parts.
[0056] When two of the three indicators exceed their preset thresholds, the wood boards to be sorted can be classified as Grade C (Medium Grade). This type of wood board has more obvious defects and is suitable for structural parts or industrial uses where appearance is not important.
[0057] When all three indicators exceed their preset thresholds, the wood boards to be sorted can be classified as Grade D (the lowest grade). This type of wood board has serious defects and is only suitable for applications where appearance is not a priority or further processing is required.
[0058] Through this multi-index comprehensive evaluation method, the quality of wooden boards can be comprehensively and objectively graded, taking into account not only the number of defects but also the impact of the location and size of defects on the use value of the wooden boards, providing a scientific basis for subsequent sorting and utilization of wooden boards.
[0059] S7. Sorting the wooden boards to be sorted according to the divided grades.
[0060] In this embodiment, after the wood boards are graded, an automated conveyor system and mechanical sorting devices can be used to guide the different graded wood boards to corresponding storage areas, achieving automated sorting of the wood boards. This process can be seamlessly integrated with existing industrial automated sorting systems, improving wood sorting efficiency and accuracy.
[0061] Example 2 See also Figure 2 The present invention provides a wood board sorting system based on machine learning, which is used to implement a wood board sorting method based on machine learning, including: A database establishment module is used to establish a multi-scale normal wood board image database, which is used to store normal wood board images of different sizes; A model training module is used to train corresponding detection models for judging whether a wood board image is normal for each different size specification based on a multi-scale normal wood board image database, thereby forming a multi-scale wood grain deviation detection model set; An image acquisition module is used to acquire images of the wood boards to be sorted, and obtain segmentation sizes corresponding to different size scales according to the size of the images of the wood boards to be sorted and different size scales in the multi-scale normal wood board image database; An image segmentation module is used to segment the wooden board image into multiple sub-images according to the segmentation size and record the spatial position information of each sub-image; The defect detection module is used to select a wood grain deviation detection model corresponding to the sub-image size, judge each sub-image, and mark the sub-image with abnormal judgment results as a defect image; A grade determination module, configured to determine the grade of the wood boards to be sorted based on all defect images and images of the wood boards to be sorted; The sorting execution module is used to sort the wooden boards to be sorted according to the divided grades.
[0062] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only one type. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0063] The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be covered by the scope of protection of the present invention.
[0064] Finally: 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, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A wood board sorting method based on machine learning, characterized in that: include: Establishing a multi-scale normal wood board image database, wherein the multi-scale normal wood board image database is used to store normal wood board images of different sizes; Based on a multi-scale normal wood board image database, we train corresponding detection models for different sizes to determine whether a wood board image is normal, thus forming a multi-scale wood grain deviation detection model set. Acquire an image of a wood board to be sorted, and acquire segmentation sizes corresponding to different size scales according to the size of the image of the wood board to be sorted and different size scales in the multi-scale normal wood board image database; The wooden board image is divided into multiple sub-images according to the segmentation size, and the spatial position information of each sub-image is recorded; Select a wood grain deviation detection model corresponding to the sub-image size, make a judgment on each sub-image, and mark the sub-image with an abnormal judgment result as a defective image; Determining the grade of the wood board to be sorted based on all defect images and the image of the wood board to be sorted; The wood boards to be sorted are sorted according to the divided grades.
2. The wood board sorting method based on machine learning according to claim 1, characterized in that: The multi-scale normal wood board image database includes at least two preset different size specifications, and each size specification includes at least 100 normal wood board images, and the normal wood board images are pre-marked defect-free standard wood board images.
3. The wood board sorting method based on machine learning according to claim 2, characterized in that: The forming of a multi-scale wood grain deviation detection model set comprises: Extract normal wood board images from a multi-scale normal wood board image database according to different size specifications; Preprocess the normal wood board images of each size specification; Extracting a feature vector of each preprocessed image, wherein the feature vector includes texture features, color features, and structural features; Build a feature sample library and group feature vectors according to size specifications; For each size specification feature sample group, a single-class classification algorithm is used to construct the feature space discrimination boundary, and the inside of the boundary is defined as the normal area; Set model training parameters, including algorithm core parameters and optimization variables; Optimize training parameters through cross-validation method and select the optimal parameter combination; The trained models and their parameters for each size specification are saved as a multi-scale wood grain deviation detection model set, and an index relationship between the sub-image size and the corresponding detection model is established.
4. The wood board sorting method based on machine learning according to claim 2, characterized in that: The obtaining of segmentation sizes corresponding to different size scales includes: Extract all preset different size specifications from the multi-scale normal wood board image database; For each preset size specification, calculate the edge margin generated when the image of the wood board to be sorted is segmented using the size; Compare the margins corresponding to all preset size specifications and select the preset size specification with the smallest margin as the segmentation size; The calculation steps of the edge margin include: Get the image size of the wood board to be sorted ; Get the preset size specifications ; calculate And round down to get the number of sub-regions that can be completely divided in the horizontal direction ; calculate And round down to get the number of sub-regions that can be completely divided in the vertical direction ; Using the formula Calculate horizontal edge margin; Using the formula Calculate vertical edge margins; Use the sum of the horizontal margin and the vertical margin as the margin.
5. The wood board sorting method based on machine learning according to claim 4 is characterized in that: The step of dividing the wooden board image into a plurality of sub-images according to the segmentation size and recording the spatial position information of each sub-image comprises: According to the segmentation size, the image of the wood board to be sorted is segmented regularly starting from the upper left corner; the segmented image is divided into a complete image and an incomplete image; and the incomplete image is processed; Among them, a complete image refers to an image that can be completely captured from the image of the wood board to be sorted according to the segmentation size; an incomplete image refers to an image that cannot be completely captured from the image of the wood board to be sorted according to the segmentation size; The processing of the incomplete image includes: if the area of the intercepted image is smaller than a preset ratio of the segmentation size, discarding the incomplete image; otherwise, mirror-flipping the content of the intercepted image along the center line and copying it to the area not intercepted, thereby filling the incomplete image, wherein the preset ratio is at least 50%; After the segmentation and incomplete image processing are completed, the position information of each sub-image in the original image is recorded, and the position information is represented by row and column coordinates.
6. The wood board sorting method based on machine learning according to claim 5, characterized in that: The step of determining the grade of the wood boards to be sorted based on all defect images and the images of the wood boards to be sorted comprises: Calculate the ratio of defective images to the total number of sub-images as the overall defect index; Obtaining a defect distribution index based on the spatial position information of each defect image; According to the spatial position information of each defect image, adjacent defect sub-regions are identified to obtain the defect continuity index; The wood boards to be sorted are divided into different grades based on the overall defect index, defect distribution index and defect continuity index.
7. The wood board sorting method based on machine learning according to claim 6, characterized in that: The obtaining of the defect distribution index according to the spatial position information of each defect image includes: Get the maximum horizontal coordinate in the spatial position information of the sub-image and the maximum ordinate ; For each defect image, get its coordinates , use the following formula to calculate the defect distribution value : , The maximum defect distribution value among all defect images is taken as the defect distribution index; The step of identifying adjacent defect sub-regions based on the spatial position information of each defect image and obtaining the defect continuity index includes: Based on the spatial location information of each defect image, a defect area connectivity graph is constructed; all adjacent defect sub-images are identified and classified into the same connected area; the number of defect sub-images contained in each connected area is calculated; and the number of defect sub-images contained in the largest connected area is taken as the defect continuity index.
8. The method for sorting wood boards based on machine learning according to claim 7, characterized in that: The classification of the wood boards to be sorted into different grades based on the overall defect index, defect distribution index and defect continuity index includes: Setting preset thresholds for the overall defect index, defect distribution index, and defect continuity index; When the overall defect index, defect distribution index and defect continuity index are all lower than their corresponding preset thresholds, the wood board to be sorted is classified into the highest grade; When any one of the overall defect index, defect distribution index and defect continuity index exceeds its preset threshold, the wood board to be sorted is classified as the second highest grade; When two of the overall defect index, defect distribution index and defect continuity index exceed their preset thresholds, the wood board to be sorted is classified as medium grade; When the overall defect index, defect distribution index and defect continuity index all exceed their preset thresholds, the wood boards to be sorted are classified into the lowest grade.
9. A wood board sorting system based on machine learning, used to implement the wood board sorting method based on machine learning according to any one of claims 1 to 8, characterized in that: include: A database establishment module is used to establish a multi-scale normal wood board image database, wherein the multi-scale normal wood board image database is used to store normal wood board images of different sizes; A model training module is used to train corresponding detection models for judging whether a wood board image is normal for each different size specification based on a multi-scale normal wood board image database, thereby forming a multi-scale wood grain deviation detection model set; An image acquisition module is used to acquire images of the wood boards to be sorted, and acquire segmentation sizes corresponding to different size scales according to the size of the images of the wood boards to be sorted and different size scales in the multi-scale normal wood board image database; An image segmentation module is used to segment the wooden board image into multiple sub-images according to the segmentation size and record the spatial position information of each sub-image; The defect detection module is used to select a wood grain deviation detection model corresponding to the sub-image size, judge each sub-image, and mark the sub-image with abnormal judgment results as a defect image; A grade determination module, configured to determine the grade of the wood boards to be sorted based on all defect images and images of the wood boards to be sorted; The sorting execution module is used to sort the wooden boards to be sorted according to the divided grades.
Citation Information
Patent Citations
Defect level judgment method and storage medium
CN111223078A
Defect detection method and system, electronic equipment and medium
CN116385331A
Weld defect detection method and system, electronic equipment and storage medium
CN116385410A
Ceramic tile sorting method and system based on opc and ceramic tile surface defect recognition model
CN117523307A
Lithium battery diaphragm flaw detection method and system, computer equipment and storage medium
CN118333972A