Toothbrush quality detection method based on image recognition
By combining the Attention-UNet++ model and the Log-Gabor filter bank, independent quality detection of the toothbrush head and handle is achieved, solving the problems of insufficient detection accuracy and poor adaptability in existing technologies, providing detailed quality reports, and supporting production optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-12
- Publication Date
- 2026-03-13
AI Technical Summary
Existing toothbrush quality testing methods cannot distinguish between the different quality requirements of the toothbrush head and the handle, resulting in insufficient testing accuracy, poor algorithm adaptability, static evaluation mechanism that cannot be dynamically adjusted, and a high rate of missed detection.
The Attention-UNet++ model is used for pixel-level segmentation. Multi-scale Hough transform and Gaussian filter bank are used to detect the direction of the bristles and calculate the quality score of the toothbrush head region. A virtual 3D height model is constructed in the toothbrush handle region. The frequency domain response is extracted using Log-Gabor filter bank and the quality score of the handle region is calculated. The quality score is then comprehensively evaluated using dynamic weight coefficients and thresholds.
It enables independent and precise quality inspection of toothbrush heads and handles, improving inspection accuracy and reliability, enabling timely detection of minor defects, providing detailed quality reports, and supporting production improvements.
Smart Images

Figure CN121661035A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial image quality inspection technology, specifically to a toothbrush quality inspection method based on image recognition. Background Technology
[0002] In the toothbrush manufacturing process, quality inspection is a crucial step in ensuring product safety and functionality. Traditional inspection methods mainly rely on manual visual inspection or simple image processing techniques, such as edge detection or threshold segmentation, which have the following significant drawbacks: Ignoring the importance of specific areas: Current technologies typically treat toothbrushes as a whole and process them uniformly, failing to differentiate between the toothbrush head, the core functional area affecting cleaning effectiveness, and the toothbrush handle (the structural support area affecting durability), which have different quality requirements. For example, sparse or broken bristles (defects in the head area) have a far greater impact on user experience than minor scratches on the handle, but traditional methods do not assign higher weight to critical areas, resulting in a high rate of missed detections.
[0003] Poor algorithm adaptability: General image recognition algorithms do not consider the local characteristics of toothbrushes during feature extraction, resulting in insufficient detection accuracy for subtle defects such as bristle density and handle cracks. Especially on high-speed production lines, factors such as changes in lighting and background interference can easily lead to misjudgments.
[0004] Static evaluation mechanism: The existing system uses fixed thresholds or rules, which cannot dynamically adjust the detection strategy according to production data, resulting in a lag in response to batch defects; Therefore, an image recognition-based toothbrush quality detection method is proposed to solve the above problems. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides an image recognition-based toothbrush quality detection method, which has advantages such as better detection accuracy and a more evidence-based detection method designed specifically for the characteristics of toothbrushes, thus solving the problems mentioned in the background section.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a toothbrush quality detection method based on image recognition, comprising the following steps: S1: Obtain the image of the toothbrush to be detected, and perform non-local mean denoising and CLAHE contrast enhancement processing on the image to be detected to obtain the preprocessed image; S2: The preprocessed image is segmented at the pixel level using the Attention-UNet++ model to generate a toothbrush head region mask M1 and a toothbrush handle region mask M2. S3: Within the toothbrush head region mask M1, use multi-scale Hough transform to detect the bristle orientation, and use a Gaussian filter bank to calculate the bristle angle variance θ. uarThe brush density gradient analysis algorithm is used to count the number of brush bristles D per unit area based on the edges extracted by the Sobel operator. h and its standard deviation σ D Calculate the quality score S1 for the toothbrush head area; S4: Within the toothbrush handle area mask M2, establish a virtual three-dimensional height model h based on injection molding process parameters, and reconstruct the surface height map H using the SfS algorithm with parting line prior constraints. recon Calculate the height gradient amplitude within the ±1mm range of the theoretical fractal line. The frequency domain response is extracted using a Log-Gabor filter bank, the local phase uniformity abrupt change rate ΔPC is calculated, and the high gradient and phase abrupt change features are fused to generate a comprehensive glitch index B. index And calculate the quality score S2 for the toothbrush handle area; S5: Set dynamic weighting coefficients α1 and α2, satisfying α1 + α2 = 1 and α1 > α2. Calculate the weighted total score S using the dynamic weighting coefficients α1 and α2, the quality score S1 for the toothbrush head area, and the quality score S2 for the toothbrush handle area. total Determine the weighted total score S total If the value is greater than or equal to the dynamic threshold T, then it is qualified; otherwise, it is unqualified. S6: Dynamically update the weight coefficients based on historical detection data to obtain the dynamic threshold T. new And satisfy α1∈[0.6, 0.8], α2∈[0.2, 0.4].
[0007] Preferably, step S3 specifically involves the following steps: S3.1: Within the toothbrush head region mask M1, use multi-scale Hough transform to detect bristle orientation, and use a Gaussian filter bank with scales σ∈{1,3,5} for edge detection. For the edge point set E at each scale... σ Perform the Hough transform, the expression is: ; Where (x, y) are the coordinates of the edge point, H(ρ, θ) is the accumulated value of the Hough transform at (ρ, θ) in the parameter space, and δ() is the Dirac function; S3.2: The Hough transform results at the three scales are weighted and fused to obtain the comprehensive directional response map, expressed as: ; Among them, H total (θ) represents the directional response intensity after fusion, ω σ The weighting coefficients for scale σ are... To eliminate the influence of distance by maximizing the value along the ρ direction at a fixed angle θ; S3.3: Extract significant directional peaks, assuming N peaks are detected.p Main directions Calculate the variance θ of toothbrush bristle angles. uar The expression is: ; Where, N p θ represents the number of salient directions detected. i Let be the angle value of the i-th principal direction. The average angle across all principal directions; S3.4: Perform connected component analysis on the image preprocessed in step S1, clustering adjacent foreground pixels into brush hair clusters. Let N be the detected clusters. c Connected components And calculate the number of effective bristle clumps N. ualid The expression is: ; Where, N c C represents the total number of connected regions. j For the j-th connected component, Let A be the number of pixels in the j-th connected component. min As the minimum effective area threshold, A max The maximum effective area threshold is Ⅱ(), which is an exponential function that takes the value 1 when the condition is met and 0 otherwise. S3.5: Calculate the number of bristles per unit area D h and standard deviation σ D The expression is: ; ; Among them, A h a is the total area of the toothbrush head region. j Let a be the area of the j-th effective connected region. cell To design the desired area of a single cluster; S3.6: The number of bristles D calculated through the above steps h and standard deviation σ D The quality score S1 of the toothbrush head area is calculated, and the expression is: ; Where β1 is the directional consistency weighting coefficient, β2 is the density uniformity weighting coefficient, and θ max D max This represents the historical maximum value for the sliding window statistics.
[0008] Preferably, step S4 specifically involves the following steps: S4.1: Based on injection molding process parameters, clamping force F1, mold clearance F2, and cooling time F3, a virtual three-dimensional height model is constructed, expressed as: ; Among them, k is the die material coefficient, which is determined by material hardness and elastic modulus, h is the predicted burr height, and λ is the cooling rate attenuation coefficient; S4.2: Reconstruct the surface height map H using the SfS algorithm with prior constraints on the parting line recon , and calculate the height gradient amplitude within the range of ±1 mm from the theoretical parting line ; S4.3: Use the Log-Gabor filter bank to extract the frequency domain response and calculate the local phase consistency mutation rate △PC; S4.4: Fuse the height gradient and phase mutation features to generate the comprehensive burr index B index , and the expression is: ; Among them, A ROI is the total area of the region of interest, is the surface height gradient amplitude at the position (x, y), and △PC(x, y) is the phase consistency mutation rate at the position (x, y); S4.5: Calculate the quality score S2 of the toothbrush handle area, and the expression: ; Among them, γ is the normalization coefficient.
[0009] Preferably, step S5 is specifically: Set the dynamic weight coefficients α1 and α2, and calculate the weighted total score S from the quality score S1 of the toothbrush head area and the quality score S2 of the toothbrush handle area total , and the expression is: And judge whether the weighted total score S total is ≥ the dynamic threshold T. If so, it is qualified; otherwise, it is unqualified.
[0010] 5. A toothbrush quality detection method based on image recognition according to claim 1, wherein the dynamic threshold T is calculated in step S6 new , and the expression is: ; Among them, T old is the weight of the toothbrush head area before update, T new is the weight of the toothbrush head area after update, η is the learning rate, G h is the historical defect frequency of the toothbrush head area, G total is the total defect frequency, and clip() is a clipping function to ensure that the weight is within the range of [0.6, 0.8].
[0011] Preferably, the dynamic threshold T is calculated using the following formula: ; Where T0 is the baseline threshold, ε is the adjustment factor, and N defect N represents the number of defective parts detected in the current batch. batch This represents the total number of items tested in the current batch.
[0012] Preferably, a bristle integrity factor C is introduced in the calculation of the toothbrush head area quality score S1. f As a supplementary indicator, the expression is: ; Where, N detected N represents the number of bristle clumps detected. expected The expected quantity is as designed; Through the bristle integrity factor C f The corrected quality score S1' for the toothbrush head area is calculated, and its expression is: ; Compared with existing technologies, the present invention provides an image recognition-based toothbrush quality detection method, which has the following beneficial effects: 1. This image recognition-based toothbrush quality inspection method, through regional evaluation, provides an independent and clear understanding of the quality status of the toothbrush head and handle. It can separately determine whether quality defects exist in the two regions and the severity of the defects. Based on this, a weighted total score S is calculated. total The calculation and comparison with the dynamic threshold T realize the organic combination of independent evaluation and comprehensive decision-making. This combination takes into account the quality characteristics of different areas of the toothbrush and conducts a comprehensive evaluation of the overall quality of the toothbrush.
[0013] 2. In this image recognition-based toothbrush quality detection method, if the quality score S1 of the toothbrush head region is low but the quality score S2 of the toothbrush handle region is high, the S1 obtained after weighted calculation is... total It may still meet the pass standards, but at this point, it can be clearly pointed out that there is a quality problem in the toothbrush head area, reminding the production department to focus on and improve it; conversely, the same applies. This evaluation method avoids the excessive influence of a single area's quality problem on the overall product evaluation, improves the reliability and accuracy of the test results, and provides manufacturers with a more valuable quality test report. Attached Figure Description
[0014] Figure 1 This is a schematic diagram of the structure of an image recognition-based toothbrush quality detection method proposed in this invention. Detailed Implementation
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0016] Please see Figure 1 A toothbrush quality detection method based on image recognition, comprising the following steps: S1: Obtain the image of the toothbrush to be detected, and perform non-local mean denoising and CLAHE contrast enhancement processing on the image to be detected to obtain the preprocessed image; S2: The preprocessed image is segmented at the pixel level using the Attention-UNet++ model to generate a toothbrush head region mask M1 and a toothbrush handle region mask M2. S3: Within the toothbrush head region mask M1, use multi-scale Hough transform to detect the bristle orientation, and use a Gaussian filter bank to calculate the bristle angle variance θ. uar The brush density gradient analysis algorithm is used to count the number of brush bristles D per unit area based on the edges extracted by the Sobel operator. h and its standard deviation σ D Calculate the quality score S1 for the toothbrush head area; Step S3 is as follows: S3.1: Within the toothbrush head region mask M1, use multi-scale Hough transform to detect bristle orientation, and use a Gaussian filter bank with scales σ∈{1,3,5} for edge detection. For the edge point set E at each scale... σ Perform the Hough transform, the expression is: ; Where (x, y) are the coordinates of the edge point, H(ρ, θ) is the accumulated value of the Hough transform at (ρ, θ) in the parameter space, and δ() is the Dirac function; S3.2: The Hough transform results at the three scales are weighted and fused to obtain the comprehensive directional response map, expressed as: ; Among them, H total (θ) represents the directional response intensity after fusion, ω σ The weighting coefficients for scale σ are... To eliminate the influence of distance by maximizing the value along the ρ direction at a fixed angle θ; S3.3: Extract significant directional peaks, assuming N peaks are detected. p Main directions Calculate the variance θ of toothbrush bristle angles. uarThe expression is: ; Where, N p θ represents the number of salient directions detected. i Let be the angle value of the i-th principal direction. The average angle across all principal directions; S3.4: Perform connected component analysis on the image preprocessed in step S1, clustering adjacent foreground pixels into brush hair clusters. Let N be the detected clusters. c Connected components And calculate the number of effective bristle clumps N. ualid The expression is: ; Where, N c C represents the total number of connected regions. j For the j-th connected component, Let A be the number of pixels in the j-th connected component. min As the minimum effective area threshold, A max The maximum effective area threshold is Ⅱ(), which is an exponential function that takes the value 1 when the condition is met and 0 otherwise. S3.5: Calculate the number of bristles per unit area D h and standard deviation σ D The expression is: ; ; Among them, A h a is the total area of the toothbrush head region. j Let a be the area of the j-th effective connected region. cell To design the desired area of a single cluster; S3.6: The number of bristles D calculated through the above steps h and standard deviation σ D The quality score S1 of the toothbrush head area is calculated, and the expression is: ; Where β1 is the directional consistency weighting coefficient, β2 is the density uniformity weighting coefficient, and θ max D max This represents the historical maximum value for the sliding window statistics.
[0017] In calculating the quality score S1 of the toothbrush head area, a bristle integrity factor C is introduced. f As a supplementary indicator, the expression is: ; Where, N detected N represents the number of bristle clumps detected. expectedThe expected quantity is as designed; Through the bristle integrity factor C f The corrected quality score S1' for the toothbrush head area is calculated, and its expression is: ; S4: Within the toothbrush handle area mask M2, establish a virtual three-dimensional height model h based on injection molding process parameters, and reconstruct the surface height map H using the SfS algorithm with parting line prior constraints. recon Calculate the height gradient amplitude within the ±1mm range of the theoretical fractal line. The frequency domain response is extracted using a Log-Gabor filter bank, the local phase uniformity abrupt change rate ΔPC is calculated, and the high gradient and phase abrupt change features are fused to generate a comprehensive glitch index B. index And calculate the quality score S2 for the toothbrush handle area; Step S4 is as follows: S4.1: Based on injection molding process parameters, clamping force F1, mold clearance F2, and cooling time F3, a virtual three-dimensional height model is constructed, expressed as: ; Where k is the mold material coefficient, which is determined by the material hardness and elastic modulus, h is the predicted burr height, and λ is the cooling rate attenuation coefficient. S4.2: Reconstructing the surface height map H using the SfS algorithm with parting line prior constraints. recon Calculate the height gradient amplitude within the ±1mm range of the theoretical fractal line. ; S4.3: Use the Log-Gabor filter bank to extract the frequency domain response and calculate the local phase uniformity abrupt change rate ΔPC; S4.4: Integrate high gradient and phase abrupt change features to generate a comprehensive spurt index B. index And in calculating the comprehensive burr index B index Previously, it was necessary to normalize the height gradient and phase abrupt change features. The specific process is based on existing techniques, so it will not be elaborated on in detail. The expression is as follows: ; Among them, A ROI The total area of the region of interest. Let be the magnitude of the surface height gradient at position (x, y), and let ΔPC(x, y) be the phase uniformity abrupt change rate at position (x, y). S4.5: Calculate the quality score S2 for the toothbrush handle area, expression: ; Wherein, γ is the normalization coefficient.
[0018] This technical solution designs independent calculation processes and evaluation mechanisms for the toothbrush head and handle areas, achieving precise focused detection of different key parts of the toothbrush. In the toothbrush head area, multi-scale Hough transform is used to accurately detect the bristle direction, and a Gaussian filter bank is used to meticulously calculate the bristle angle variance. This allows for the sensitive detection of even minute deviations in the bristle direction, effectively identifying inconsistencies in bristle direction caused by manufacturing process issues, such as partially skewed or disordered bristles. This significantly improves the detection accuracy of the toothbrush head area on this key indicator. For the toothbrush handle area, a virtual three-dimensional height model is constructed based on injection molding process parameters, and the SfS algorithm with parting line prior constraints is used to reconstruct the surface height map. This accurately restores the microscopic morphology of the toothbrush handle surface, improving the detection accuracy of minor surface burrs, unevenness, and other defects, providing high-precision detection data support for toothbrush handle quality control.
[0019] Considering the differences in function, structure, and manufacturing process between the toothbrush head and handle, this solution customizes exclusive feature extraction methods for both regions, comprehensively and deeply reflecting their respective quality status. In the toothbrush head region, in addition to bristle direction detection, a bristle density gradient analysis algorithm is employed. Based on edge extraction using the Sobel operator, the number of bristles per unit area and their standard deviation are statistically analyzed. This method accurately assesses the uniformity of bristle distribution, detects areas with sparse or uneven bristle density, and promptly identifies quality defects caused by uneven injection molding or bristle implantation process issues. In the toothbrush handle region, the height gradient amplitude is calculated, and the frequency domain response is extracted using a Log-Gabor filter bank. Then, the local phase consistency abrupt change rate is calculated, fusing these features to generate a comprehensive burr index. This index comprehensively considers factors such as burr height, shape, and texture, enabling a comprehensive and accurate evaluation of the burr condition on the toothbrush handle surface. It avoids the potential for missed or false detections that may occur with single-feature detection, providing a comprehensive and reliable basis for toothbrush handle quality assessment.
[0020] S5: Set dynamic weighting coefficients α1 and α2, satisfying α1 + α2 = 1 and α1 > α2. Calculate the weighted total score S using the dynamic weighting coefficients α1 and α2, the quality score S1 for the toothbrush head area, and the quality score S2 for the toothbrush handle area. total Determine the weighted total score S total If the value is greater than or equal to the dynamic threshold T, then it is qualified; otherwise, it is unqualified. Step S5 is as follows: By setting dynamic weighting coefficients α1 and α2, and calculating the weighted total score S1 from the quality score of the toothbrush head area S1 and the quality score of the toothbrush handle area S2, a dynamic weighted total score S is obtained. total The expression is: ; And determine the weighted total score Stotal Whether it is ≥ the dynamic threshold T. If so, it is qualified; otherwise, it is unqualified.
[0021] S6: Dynamically update the weight coefficient according to historical detection data to obtain the dynamic threshold T new .
[0022] Calculate the dynamic threshold T in step S6 new The expression is: ; Among them, T old is the weight of the toothbrush head area before update, T new is the weight of the toothbrush head area after update, η is the learning rate, G h is the historical defect frequency of the toothbrush head area, G total is the total defect frequency, clip() is the clipping function to ensure that the weight is within the range of [0.6, 0.8].
[0023] The calculation formula of the dynamic threshold T is: ; Among them, T0 is the benchmark threshold, ε is the adjustment factor, N defect is the number of defective parts detected in the current batch, N batch is the total number of parts detected in the current batch.
[0024] The results of the regional evaluation record the quality status of the toothbrush head and the toothbrush handle in detail, providing convenience for quality traceability. When there is a quality problem with the product, it is possible to quickly locate the problem area, determine whether there is a defect in the toothbrush head or the toothbrush handle, and even further trace back to the specific production process link. For example, if it is detected that the consistency of the bristle direction in the toothbrush head area is poor, by analyzing the production records, it is possible to check whether it is due to problems with the injection mold, failures of the bristle implantation equipment, or improper setting of production process parameters. According to the traceability results, the production department can make targeted production improvements, adjust production process parameters, repair or replace equipment, optimize mold design, etc., thereby improving product quality, reducing the defective rate, and enhancing production efficiency and economic benefits.
[0025] To sum up, this toothbrush quality detection method based on image recognition enables an independent and clear understanding of the quality status of the toothbrush head and the toothbrush handle through regional evaluation, can separately judge whether there are quality defects and the severity of the defects in the two regions. On this basis, through the calculation of the weighted total score S total and the comparison with the dynamic threshold T, the organic combination of independent evaluation and comprehensive decision-making is realized. This combination method not only considers the quality characteristics of different regions of the toothbrush but also comprehensively evaluates the quality of the toothbrush as a whole.
[0026] Furthermore, if the quality score S1 of the toothbrush head area is low but the quality score S2 of the toothbrush handle area is high, the S obtained after weighted calculation will be... total It may still meet the pass standards, but at this point, it can be clearly pointed out that there is a quality problem in the toothbrush head area, reminding the production department to focus on and improve it; conversely, the same applies. This evaluation method avoids the excessive influence of a single area's quality problem on the overall product evaluation, improves the reliability and accuracy of the test results, and provides manufacturers with a more valuable quality test report.
[0027] It should be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0028] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A toothbrush quality detection method based on image recognition, characterized in that, Includes the following steps: S1: Obtain the image of the toothbrush to be detected, and perform non-local mean denoising and CLAHE contrast enhancement processing on the image to be detected to obtain the preprocessed image; S2: The preprocessed image is segmented at the pixel level using the Attention-UNet++ model to generate a toothbrush head region mask M1 and a toothbrush handle region mask M2. S3: Within the toothbrush head region mask M1, use multi-scale Hough transform to detect the bristle orientation, and use a Gaussian filter bank to calculate the bristle angle variance θ. uar The brush density gradient analysis algorithm is used to count the number of brush bristles D per unit area based on the edges extracted by the Sobel operator. h and its standard deviation σ D Calculate the quality score S1 for the toothbrush head area; S4: Within the toothbrush handle area mask M2, establish a virtual three-dimensional height model h based on injection molding process parameters, and reconstruct the surface height map H using the SfS algorithm with parting line prior constraints. recon Calculate the height gradient amplitude within the ±1mm range of the theoretical fractal line. The frequency domain response is extracted using a Log-Gabor filter bank, the local phase uniformity abrupt change rate ΔPC is calculated, and the high gradient and phase abrupt change features are fused to generate a comprehensive glitch index B. index And calculate the quality score S2 for the toothbrush handle area; S5: Set dynamic weighting coefficients α1 and α2, satisfying α1 + α2 = 1 and α1 > α2. Calculate the weighted total score S using the dynamic weighting coefficients α1 and α2, the quality score S1 for the toothbrush head area, and the quality score S2 for the toothbrush handle area. total Determine the weighted total score S total If the value is greater than or equal to the dynamic threshold T, then it is qualified; otherwise, it is unqualified. S6: Dynamically update the weight coefficients based on historical detection data to obtain the dynamic threshold T. new .
2. The toothbrush quality detection method based on image recognition according to claim 1, characterized in that, Step S3 is as follows: S3.1: Within the toothbrush head region mask M1, use multi-scale Hough transform to detect bristle orientation, and use a Gaussian filter bank with scales σ∈{1,3,5} for edge detection. For the edge point set E at each scale... σ Perform the Hough transform, the expression is: ; Where (x, y) are the coordinates of the edge point, H(ρ, θ) is the accumulated value of the Hough transform at (ρ, θ) in the parameter space, and δ() is the Dirac function; S3.2: The Hough transform results at the three scales are weighted and fused to obtain the comprehensive directional response map, expressed as: ; Among them, H total (θ) represents the directional response intensity after fusion, ω σ The weighting coefficients for scale σ are... To eliminate the influence of distance by maximizing the value along the ρ direction at a fixed angle θ; S3.3: Extract significant directional peaks, assuming N peaks are detected. p Main directions Calculate the variance θ of toothbrush bristle angles. uar The expression is: ; Where, N p θ represents the number of salient directions detected. i Let be the angle value of the i-th principal direction. The average angle across all principal directions; S3.4: Perform connected component analysis on the image preprocessed in step S1, clustering adjacent foreground pixels into brush hair clusters. Let N be the detected clusters. c Connected components And calculate the number of effective bristle clumps N. ualid The expression is: ; Where, N c C represents the total number of connected regions. j For the j-th connected component, Let A be the number of pixels in the j-th connected component. min As the minimum effective area threshold, A max The maximum effective area threshold is Ⅱ(), which is an exponential function that takes the value 1 when the condition is met and 0 otherwise. S3.5: Calculate the number of bristles per unit area D h and standard deviation σ D The expression is: ; ; Among them, A h a is the total area of the toothbrush head region. j Let a be the area of the j-th effective connected region. cell To design the desired area of a single cluster; S3.6: The number of bristles D calculated through the above steps h and standard deviation σ D The quality score S1 of the toothbrush head area is calculated, and the expression is: ; Where β1 is the directional consistency weighting coefficient, β2 is the density uniformity weighting coefficient, and θ max D max This represents the historical maximum value for the sliding window statistics.
3. The toothbrush quality detection method based on image recognition according to claim 1, characterized in that, Step S4 is as follows: S4.1: Based on injection molding process parameters, clamping force F1, mold clearance F2, and cooling time F3, a virtual three-dimensional height model is constructed, expressed as: ; Where k is the mold material coefficient, which is determined by the material hardness and elastic modulus, h is the predicted burr height, and λ is the cooling rate attenuation coefficient. S4.2: Reconstructing the surface height map H using the SfS algorithm with parting line prior constraints. recon Calculate the height gradient amplitude within the ±1mm range of the theoretical fractal line. ; S4.3: Use the Log-Gabor filter bank to extract the frequency domain response and calculate the local phase uniformity abrupt change rate ΔPC; S4.4: Integrate high gradient and phase abrupt change features to generate a comprehensive spurt index B. index The expression is: ; Among them, A ROI The total area of the region of interest. Let be the magnitude of the surface height gradient at position (x, y), and let ΔPC(x, y) be the phase uniformity abrupt change rate at position (x, y). S4.5: Calculate the quality score S2 for the toothbrush handle area, expression: ; Wherein, γ is the normalization coefficient.
4. The toothbrush quality detection method based on image recognition according to claim 1, characterized in that, Step S5 is as follows: By setting dynamic weighting coefficients α1 and α2, and calculating the weighted total score S1 from the quality score of the toothbrush head area S1 and the quality score of the toothbrush handle area S2, a dynamic weighted total score S is obtained. total The expression is: ; And judge the weighted total score S total Whether it is ≥ the dynamic threshold T. If so, it is qualified; otherwise, it is unqualified.
5. The toothbrush quality detection method based on image recognition according to claim 1, characterized in that, In step S6, the dynamic threshold T is calculated. new The expression is: ; Among them, T old T represents the weight of the toothbrush head region before the update. new The updated toothbrush head region weights, where η is the learning rate and G is the learning rate. h G represents the historical defect frequency in the toothbrush head area. total The total defect frequency is represented by `clip()`, which is the clipping function to ensure that the weights are within the range of [0.6, 0.8].
6. The toothbrush quality detection method based on image recognition according to claim 4, characterized in that, The formula for calculating the dynamic threshold T is: ; Where T0 is the baseline threshold, ε is the adjustment factor, and N defect N represents the number of defective parts detected in the current batch. batch This represents the total number of items tested in the current batch.
7. The toothbrush quality detection method based on image recognition according to claim 2, characterized in that, In calculating the quality score S1 of the toothbrush head area, a bristle integrity factor C is introduced. f As a supplementary indicator, the expression is: ; Where, N detected N represents the number of bristle clumps detected. expected The expected quantity is as designed; Through the bristle integrity factor C f The corrected quality score S1' for the toothbrush head area is calculated, and its expression is: 。