Intelligent detection method of cloth color difference based on improved visual algorithm

By improving vision algorithms and deep learning technology, combining multi-spectral cameras and high-definition cameras, efficient and accurate color difference detection in complex textile and printing and dyeing production environments is achieved, solving the problem of time-consuming, labor-intensive and susceptible to human factors in traditional methods.

CN119648814BActive Publication Date: 2025-04-08FUJIAN YUBANG TEXTILE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510176408.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-04-08
Estimated Expiration
2045-02-18

AI Technical Summary

Technical Problem

Traditional chromatic aberration detection methods are time-consuming and labor-intensive, and the results are susceptible to human factors, making it difficult to accurately detect chromatic aberration in complex textile and printing and dyeing production environments.

Method used

The intelligent detection method of cloth chromatic aberration based on improved vision algorithms is adopted to obtain spectral image data through multi-spectral cameras, combine the convolutional neural network and the Attention mechanism to perform image preprocessing and chromatic aberration detection, and dynamically adjust the camera parameters to adapt to different environments.

Benefits of technology

It improves the accuracy and reliability of chromatic aberration detection, and can quickly and accurately detect chromatic aberration in complex environments, reduce human errors, and improve automation level.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648814B_ABST
    Figure CN119648814B_ABST
Patent Text Reader

Abstract

The present invention relates to an intelligent detection method for color difference of cloth based on an improved visual algorithm, comprising the following steps: step S1: obtaining spectral image data of cloth and calibrating it; step S2: adjusting the settings of a high-definition camera according to the real-time image features, and obtaining high-definition image data of cloth based on the high-definition camera; step S3: preprocessing the high-definition image data; step S4: based on the preprocessed high-definition image data, using a deep network EfficientNet combined with an Attention mechanism to perform cloth and background segmentation, extract features, and establish a comprehensive feature vector; step S5: constructing a color difference detection model based on an improved SVM, and performing color difference detection on cloth images based on the comprehensive feature vector; step S6: combining a fuzzy logic algorithm, diagnosing the color difference abnormality of cloth according to the color difference result. The present invention effectively improves the accuracy and reliability of cloth color difference detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of image detection, and in particular to an intelligent detection method for color difference of cloth based on an improved visual algorithm. Background Art

[0002] In the modern textile and printing and dyeing industry, precise control of product quality is crucial to market competitiveness. Among them, color difference detection, as an important part of quality control, directly affects the appearance consistency of products and customer satisfaction. Traditional color difference detection methods mostly rely on manual visual inspection or simple optical measurement, which is not only time-consuming and laborious, but also the results are easily affected by human factors and lead to inconsistency.

[0003] Moreover, due to the diversity and complexity of the production process, the type and color of fabrics and changes in the production environment will have a significant impact on the generation and detection of color difference. In modern textile and printing and dyeing production, factors such as dyeing process fluctuations, raw material differences, and ambient light changes work together to make color difference problems more difficult to detect. Summary of the invention

[0004] In order to solve the above problems, the purpose of the present invention is to provide an intelligent detection method for cloth color difference based on an improved visual algorithm, which effectively improves the accuracy and reliability of cloth color difference detection.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] An intelligent detection method for color difference of cloth based on an improved visual algorithm comprises the following steps:

[0007] Step S1: Acquire spectral image data of the cloth through a multispectral camera, and perform geometric calibration and spectral calibration to ensure that the spectral information of each pixel can be accurately captured and the spectral features can be extracted;

[0008] Step S2: Based on the pre-trained convolutional neural network, a mapping between the cloth type and the optimal parameters of the HD camera is established, the HD camera settings are adjusted according to the real-time collected image features, dynamically adapting to different cloths, colors and ambient light conditions, and HD image data of the cloth is obtained based on the HD camera;

[0009] Step S3: preprocessing the high-definition image data, using a joint convolution process of noise suppression and enhancement to improve image quality, and introducing a directional filter combined with a non-local mean to enhance texture details while accurately removing interference noise;

[0010] Step S4: Based on the pre-processed high-definition image data, use the deep network EfficientNet combined with the Attention mechanism to perform cloth and background segmentation, automatically identify and extract the color, texture, and edge features in the image, and combine the spectral features to establish a comprehensive feature vector;

[0011] Step S5: constructing a color difference detection model based on the improved SVM, and performing color difference detection on the cloth image based on the comprehensive feature vector;

[0012] Step S6: Combined with the fuzzy logic algorithm, diagnose the color difference abnormality of the cloth according to the color difference results.

[0013] Furthermore, step S1 is specifically as follows:

[0014] Step S11: acquiring spectral image data of the cloth through a multispectral camera;

[0015] Step S12: geometric calibration uses a checkerboard pattern calibration plate to ensure that the positions of the calibration points are known and obtain calibration plate images at multiple angles;

[0016] Use the cv2.findChessboardCorners() function and cv2.calibrateCamera() function in the OpenCV vision library for calibration, and the camera internal parameter matrix K calibration:

[0017] ;

[0018] in, fx and fy is the focal length, (c x ,c y ) It is the heart of light;

[0019] Using the camera’s distortion coefficient (k 1 ,k 2 ,p 1 ,p 2 ,k 3 ) to correct image distortion and use the cv2.undistort() function to correct the captured image;

[0020] Step S13: Spectral calibration uses a standardized color card X-Rite ColorChecker, and the reflectance of each color block is known;

[0021] Obtain the response value of each color block in different spectral bands;

[0022] The obtained spectral data are matched with the standard reflectance and the correction coefficient is calculated:

[0023] Calculate the calibration coefficient K(λ) for each band so that the captured color value I measured (λ) can approach the standard reflectivity R(λ) after correction:

[0024] ;

[0025] Among them, the calibration coefficient , is the color value after correction;

[0026] Compare the reflectance after calibration with the actual color card, and iteratively adjust the calibration coefficient to ensure the accuracy of the model;

[0027] Error minimization adjustment is performed through the LMS algorithm;

[0028] Step S14: extracting key features from the calibrated spectral data, including spectral peak position, intensity and shape.

[0029] Furthermore, the error minimization adjustment is performed through the LMS algorithm, as follows:

[0030] The error e(λ) is defined as the difference between the spectral value measured after calibration and the true reflectance:

[0031] ;

[0032] in, is the actual reflectance of the standard color card;

[0033] The LMS algorithm adjusts K(λ) to minimize , for each band λ, calculate the error e(λ);

[0034] And adjust according to the error :

[0035] ;

[0036] Where η is the step size factor; For the original value; For the adjusted value;

[0037] The above steps are iterated until the sum of squared errors is less than a predetermined threshold or the maximum number of iterations is reached.

[0038] Furthermore, step S2 is specifically as follows:

[0039] Use the camera interface to capture video frames in real time, adjust the image size to meet the CNN input requirements, and perform normalization at the same time;

[0040] Extract features based on histogram of oriented gradients;

[0041] Use a deep learning framework (such as TensorFlow or PyTorch) to load a pre-trained CNN and perform real-time inference based on the extracted features to output recommended values ​​for camera settings, including exposure time, ISO, and white balance;

[0042] Use PID control method to adjust:

[0043]

[0044] Among them, ΔParam is the adjustment amount of the camera parameters, error is the difference between the current image features and the target features, Kp,K i ,K d are the proportional, integral and differential gain coefficients respectively;

[0045] Based on the adjustment values ​​calculated by PID control, the camera parameters are controlled through the API provided by the camera (such as ARV, V4L2, etc.), and the exposure, ISO and white balance are gradually adjusted to ensure that the real-time image maintains the best quality under changing ambient light conditions.

[0046] Furthermore, step S3 is specifically as follows:

[0047] First, a shallow CNN is used, which contains several convolutional layers and ReLU activation layers, for basic denoising and enhancement:

[0048] Given an input image I, the output of the convolutional network is I′:

[0049] ;

[0050] Among them, W is the convolution kernel weight, b is the bias, and f is the nonlinear activation function;

[0051] Then apply a directional filter to precisely enhance the specified texture, filtering operation:

[0052]

[0053] in, is the value after the image pixel at position (x, y) is enhanced using a directional filter; For location ( ) of image pixels; is the filter kernel; is the filter coordinate;

[0054] ;

[0055] in, represents a unit vector at an angle θ; For location ( ) of image pixels; is the angle of the directional filter;

[0056] Finally, the remaining noise is removed by non-local mean, the similarity between the pixels of the image is calculated, and the global similarity is used for denoising:

[0057] ;

[0058] in, is the pixel value of position p after non-local mean processing, C(p) is the normalization constant; Ω is the integration domain; is the pixel value at position q in the filtered image;

[0059] NL w (p,q) is the similarity weight between pixel p and surrounding pixels q:

[0060] ;

[0061] in, represents a local patch; h is a smoothing parameter.

[0062] Furthermore, step S4 is specifically as follows: Based on the preprocessed high-definition image, EfficientNet is used to capture basic features, and the Attention mechanism is used to enhance key information; a classifier is used to segment the cloth and the background; the color, texture, and edge features of the cloth are extracted from the segmentation map; and the color, texture, edge, and spectral features are integrated into a comprehensive feature vector.

[0063] Furthermore, EfficientNet is used to capture basic features, and the Attention mechanism is used to enhance key information; a classifier is used to segment cloth and background, as follows:

[0064] Use the EfficientNet basic network as the feature extractor:

[0065] F base =EfficientNet(I input )

[0066] Among them, I input is the preprocessed image, F base is the basic feature map;

[0067] Introduce the application of Attention mechanism, including channel attention and spatial attention

[0068] Channel Attention :

[0069] ;

[0070] in, Represents global average pooling, which reduces the dimension of the feature map to the average value of each channel; W 1 and W 2 is a learnable linear transformation matrix; σ is the Sigmoid activation function;

[0071] Spatial Attention :

[0072] ;

[0073] Among them, AvgPool(F base ) and MaxPool(F base ) respectively represent the pooling of the average and maximum values ​​of the feature maps in the channel dimension; Represents a splicing operation; Represents the convolution operation based on the s×s convolution kernel;

[0074] Superimpose channel attention and spatial attention on basic features to highlight key information:

[0075]

[0076] Among them, F enhanced It is the feature map enhanced by channel and spatial attention mechanism

[0077] Use Softmax classifier to perform pixel-level classification, complete the segmentation of cloth and background, output segmentation map, and identify the cloth and background areas.

[0078] Furthermore, the color, texture, and edge features of the cloth are extracted from the segmentation map; and the color, texture, edge, and spectral features are integrated into a comprehensive feature vector, as follows:

[0079] Extract the cloth region from the segmented image;

[0080] Calculate the mean and variance of the cloth area in different color channels, including RGB, HSV and Lab, to capture the color distribution and obtain color features;

[0081] Calculate the LBP histogram from the cloth area to characterize the local texture pattern and obtain the texture features;

[0082] Use Canny edge detection to extract edges from the cloth area, and then calculate the intensity and direction histograms of these edges to obtain edge features;

[0083] The acquired color, texture, and edge features are combined with spectral features to establish a comprehensive feature vector.

[0084] Furthermore, a color difference detection model is constructed based on the improved SVM, as follows:

[0085] The SVM hyperplane optimization problem is:

[0086] ;

[0087] where w is the weight vector, is bias; is the slack variable; C is the regularization parameter; It is mapped to a higher-dimensional feature vector through a kernel function; For the input A comprehensive feature vector; is the corresponding label;

[0088] By introducing the adaptive function f(x), the hyperplane can be dynamically adjusted:

[0089] ;

[0090] in, is the weight of each support vector, which is optimized according to the current state of the model; b(t) is a parameter that allows adaptive adjustment to ensure the optimal positioning of the hyperplane under specific conditions; is the kernel function; x represents the input sample to be classified;

[0091] According to the data distribution, the kernel function parameters are dynamically adjusted to improve the local sensitivity of the model:

[0092] ;

[0093] in, is a conditionally dependent dynamic parameter; For the input A comprehensive feature vector;

[0094] During the training process, grid search and cross-validation are used to determine the best hyperparameter combination, including penalty coefficients and dynamic kernel parameters.

[0095] Furthermore, step S6 is specifically as follows:

[0096] Fuzzy sets are defined based on the degree of color difference, where the color difference index is divided into low, medium, and high;

[0097] The color difference results output by AHA-SVM are converted into fuzzy input variables, and the specific color difference index is mapped to the fuzzy set using the membership function;

[0098] Establish fuzzy rules based on expert systems or empirical knowledge;

[0099] The fuzzy inference engine Mamdani model is used for rule reasoning, and the diagnosis description of color difference abnormality is generated according to the fuzzy rules and reasoning results.

[0100] The present invention has the following beneficial effects:

[0101] 1. The present invention realizes real-time video stream acquisition and dynamic camera control in complex environments, enhances the flexibility and response speed of the camera to deal with different fabrics and lighting conditions, can obtain higher quality image data, and organically combines convolution processing, directional filters and non-local mean denoising to effectively improve image details and excel in noise resistance;

[0102] 2. The present invention is aimed at color difference detection. Since color difference may usually change due to factors such as ambient light and fabric material, the AHA-SVM is used to dynamically adjust the direction and position of the decision hyperplane to more accurately adapt to changes in data distribution and improve the detection accuracy.

[0103] 3. The present invention combines the color difference abnormality diagnosis capability of the fuzzy logic algorithm, which can intelligently identify and feedback the color difference type and severity, provide users with intuitive and accurate decision support, and effectively improve the automation level of color difference detection. At the same time, it is widely applicable to various industries with high requirements on color difference, such as textiles, printing and dyeing, and has great practical value and economic benefits. BRIEF DESCRIPTION OF THE DRAWINGS

[0104] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION

[0105] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:

[0106] refer to Figure 1 In this embodiment, a method for intelligently detecting color difference of cloth based on an improved visual algorithm is provided, comprising the following steps:

[0107] Step S1: Acquire spectral image data of the cloth through a multispectral camera, and perform geometric calibration and spectral calibration to ensure that the spectral information of each pixel can be accurately captured and the spectral features can be extracted;

[0108] Step S2: Use a large data set to train a convolutional neural network, establish a mapping between cloth types and optimal parameters of a high-definition camera (exposure, white balance, ISO, etc.), adjust the settings of the high-definition camera according to the real-time collected image features, dynamically adapt to different cloths, colors and ambient light conditions, and obtain high-definition image data of the cloth based on the high-definition camera;

[0109] Step S3: preprocessing the high-definition image data, using a joint convolution process of noise suppression and enhancement to improve image quality, and introducing a directional filter combined with a non-local mean to enhance texture details while accurately removing interference noise;

[0110] Step S4: Based on the pre-processed high-definition image data, use the deep network EfficientNet combined with the Attention mechanism to perform cloth and background segmentation, automatically identify and extract the color, texture, and edge features in the image, and combine the spectral features to establish a comprehensive feature vector;

[0111] Step S5: constructing a color difference detection model based on the improved SVM, and performing color difference detection on the cloth image based on the comprehensive feature vector;

[0112] Step S6: Combined with the fuzzy logic algorithm, diagnose the color difference abnormality of the cloth according to the color difference results.

[0113] In this embodiment, step S1 is specifically as follows:

[0114] Step S11: acquiring spectral image data of the cloth through a multispectral camera;

[0115] Step S12: geometric calibration uses a checkerboard pattern calibration plate to ensure that the positions of the calibration points are known and obtain calibration plate images at multiple angles;

[0116] Use the cv2.findChessboardCorners() function and cv2.calibrateCamera() function in the OpenCV vision library for calibration, and the camera internal parameter matrix K calibration:

[0117] ;

[0118] in, fx and fy is the focal length, (c x ,c y ) It is the heart of light;

[0119] Using the camera’s distortion coefficient (k 1 ,k 2 ,p 1 ,p 2,k 3 ) to correct image distortion and use the cv2.undistort() function to correct the captured image;

[0120] Step S13: Spectral calibration uses a standardized color card X-Rite ColorChecker, and the reflectance of each color block is known;

[0121] Obtain the response value of each color block in different spectral bands;

[0122] The obtained spectral data are matched with the standard reflectance and the correction coefficient is calculated:

[0123] Calculate the calibration coefficient K(λ) for each band so that the captured color value I measured (λ) can approach the standard reflectivity R(λ) after correction:

[0124] ;

[0125] Among them, the calibration coefficient , is the color value after correction;

[0126] Compare the reflectance after calibration with the actual color card, and iteratively adjust the calibration coefficient to ensure the accuracy of the model;

[0127] Error minimization adjustment is performed through the LMS algorithm;

[0128] Step S14: extracting key features from the calibrated spectral data, including spectral peak position, intensity and shape.

[0129] In this embodiment, the error minimization adjustment is performed by using the LMS algorithm, as follows:

[0130] The error e(λ) is defined as the difference between the spectral value measured after calibration and the true reflectance:

[0131] ;

[0132] in, is the actual reflectance of the standard color card;

[0133] The LMS algorithm adjusts K(λ) to minimize , for each band λ, calculate the error e(λ);

[0134] And adjust according to the error :

[0135] ;

[0136] Where η is the step size factor; For the original value; For the adjusted value;

[0137] The above steps are iterated until the sum of squared errors is less than a predetermined threshold or the maximum number of iterations is reached.

[0138] In this embodiment, step S2 is specifically as follows:

[0139] Use a camera interface (such as OpenCV or camera SDK) to capture video frames in real time, resize the images to meet the CNN input requirements, and perform normalization.

[0140] Extract features based on histogram of oriented gradients;

[0141] Use a deep learning framework (such as TensorFlow or PyTorch) to load a pre-trained CNN and perform real-time inference based on the extracted features to output recommended values ​​for camera settings, including exposure time, ISO, and white balance;

[0142] Use PID control method to adjust:

[0143]

[0144] Among them, ΔParam is the adjustment amount of the camera parameters, error is the difference between the current image features and the target features, Kp,K i ,K d are the proportional, integral and differential gain coefficients respectively;

[0145] Based on the adjustment values ​​calculated by PID control, the camera parameters are controlled through the API provided by the camera (such as ARV, V4L2, etc.), and the exposure, ISO and white balance are gradually adjusted to ensure that the real-time image maintains the best quality under changing ambient light conditions.

[0146] In this embodiment, step S3 is specifically as follows:

[0147] First, a shallow CNN is used, which contains several convolutional layers and ReLU activation layers, for basic denoising and enhancement:

[0148] Given an input image I, the output of the convolutional network is I′:

[0149] ;

[0150] Among them, W is the convolution kernel weight, b is the bias, and f is the nonlinear activation function;

[0151] Then apply a directional filter to precisely enhance the specified texture, filtering operation:

[0152]

[0153] in, is the value after the image pixel at position (x, y) is enhanced using a directional filter; is the filter kernel; is the filter coordinate; For location ( ) of image pixels;

[0154] ;

[0155] in, represents a unit vector at an angle θ; For location ( ) of image pixels; is the angle of the directional filter;

[0156] Finally, the remaining noise is removed by non-local mean, the similarity between the pixels of the image is calculated, and the global similarity is used for denoising:

[0157] ;

[0158] in, is the pixel value of position p after non-local mean processing, C(p) is the normalization constant; Ω is the integration domain; is the pixel value at position q in the filtered image;

[0159] NL w (p,q) is the similarity weight between pixel p and surrounding pixels q:

[0160] ;

[0161] in, represents a local patch; h is a smoothing parameter.

[0162] In this embodiment, step S4 is specifically as follows: Based on the preprocessed high-definition image, EfficientNet is used to capture basic features, and the Attention mechanism is used to enhance key information; a classifier is used to segment the cloth and the background; the color, texture, and edge features of the cloth are extracted from the segmentation map; and the color, texture, edge, and spectral features are integrated into a comprehensive feature vector.

[0163] In this embodiment, EfficientNet is used to capture basic features, and the Attention mechanism is used to enhance key information; a classifier is used to segment cloth and background, as follows:

[0164] Use the EfficientNet basic network as the feature extractor:

[0165] F base =EfficientNet(I input )

[0166] Among them, I input is the preprocessed image, F base is the basic feature map;

[0167] Introduce the application of Attention mechanism, including channel attention and spatial attention

[0168] Channel Attention :

[0169] ;

[0170] in, Represents global average pooling, which reduces the dimension of the feature map to the average value of each channel; W 1 and W 2 is a learnable linear transformation matrix; σ is the Sigmoid activation function;

[0171] Spatial Attention :

[0172] ;

[0173] Among them, AvgPool(F base ) and MaxPool(F base ) respectively represent the pooling of the average and maximum values ​​of the feature maps in the channel dimension; Represents a splicing operation; Represents the convolution operation based on the s×s convolution kernel;

[0174] Superimpose channel attention and spatial attention on basic features to highlight key information:

[0175]

[0176] Among them, F enhanced It is the feature map enhanced by channel and spatial attention mechanism

[0177] Use Softmax classifier to perform pixel-level classification, complete the segmentation of cloth and background, output segmentation map, and identify the cloth and background areas.

[0178] In this embodiment, the color, texture, and edge features of the cloth are extracted from the segmentation image; and the color, texture, edge, and spectral features are integrated into a comprehensive feature vector, as follows:

[0179] Extract the cloth region from the segmented image;

[0180] Calculate the mean and variance of the cloth area in different color channels, including RGB, HSV and Lab, to capture the color distribution and obtain color features;

[0181] Calculate the LBP histogram from the cloth area to characterize the local texture pattern and obtain the texture features;

[0182] Use Canny edge detection to extract edges from the cloth area, and then calculate the intensity and direction histograms of these edges to obtain edge features;

[0183] The acquired color, texture, and edge features are combined with spectral features to establish a comprehensive feature vector.

[0184] In this embodiment, a color difference detection model is constructed based on the improved SVM, as follows:

[0185] The SVM hyperplane optimization problem is:

[0186] ;

[0187] where w is the weight vector, is bias; is the slack variable; C is the regularization parameter; It is mapped to a higher-dimensional feature vector through a kernel function; For the input A comprehensive feature vector; is the corresponding label;

[0188] By introducing the adaptive function f(x), the hyperplane can be dynamically adjusted:

[0189] ;

[0190] in, is the weight of each support vector, which is optimized according to the current state of the model; b(t) is a parameter that allows adaptive adjustment to ensure the optimal positioning of the hyperplane under specific conditions; is the kernel function; x represents the input sample to be classified;

[0191] According to the data distribution, the kernel function parameters are dynamically adjusted to improve the local sensitivity of the model:

[0192] ;

[0193] in, is a conditionally dependent dynamic parameter; For the input A comprehensive feature vector;

[0194] During the training process, grid search and cross-validation are used to determine the best hyperparameter combination, including penalty coefficients and dynamic kernel parameters.

[0195] In this embodiment, step S6 is specifically as follows:

[0196] Fuzzy sets are defined based on the degree of color difference, where the color difference index is divided into low, medium, and high;

[0197] The color difference results output by AHA-SVM are converted into fuzzy input variables, and the specific color difference index is mapped to the fuzzy set using the membership function;

[0198] Fuzzy rules are established based on expert systems or empirical knowledge; for example, if the color difference is "high", then it is judged as "severe color deviation". If the color difference is "medium" and the spectral features are dense, then it is judged as "possible deviation".

[0199] The fuzzy inference engine Mamdani model is used for rule reasoning, and the diagnosis description of color difference abnormality is generated according to the fuzzy rules and reasoning results.

[0200] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0201] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0202] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0203] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0204] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.

Claims

1. The intelligent detection method of cloth color difference based on improved visual algorithm is characterized by: The following steps are involved: Step S1: Acquire spectral image data of the cloth through a multispectral camera, and perform geometric calibration and spectral calibration to ensure that the spectral information of each pixel can be accurately captured and the spectral features can be extracted; Step S2: Based on the pre-trained convolutional neural network, a mapping between the cloth type and the optimal parameters of the HD camera is established, the HD camera settings are adjusted according to the real-time collected image features, dynamically adapting to different cloths, colors and ambient light conditions, and HD image data of the cloth is obtained based on the HD camera; Step S3: preprocessing the high-definition image data, using a joint convolution process of noise suppression and enhancement to improve image quality, and introducing a directional filter combined with a non-local mean to enhance texture details while accurately removing interference noise; Step S4: Based on the pre-processed high-definition image data, use the deep network EfficientNet combined with the Attention mechanism to perform cloth and background segmentation, automatically identify and extract the color, texture, and edge features in the image, and combine the spectral features to establish a comprehensive feature vector; Step S5: constructing a color difference detection model based on the improved SVM, and performing color difference detection on the cloth image based on the comprehensive feature vector; Step S6: combining fuzzy logic algorithm to diagnose the color difference abnormality of the cloth according to the color difference result; The color difference detection model is constructed based on the improved SVM, as follows: The SVM hyperplane optimization problem is: ; where w is the weight vector, is bias; is the slack variable; C is the regularization parameter; It is mapped to a higher-dimensional feature vector through a kernel function; For the input A comprehensive feature vector; is the corresponding label; By introducing the adaptive function f(x), the hyperplane can be dynamically adjusted: ; in, is the weight of each support vector, which is optimized according to the current state of the model; b(t) is a parameter that allows adaptive adjustment to ensure the optimal positioning of the hyperplane under specific conditions; is the kernel function; x represents the input sample to be classified; According to the data distribution, the kernel function parameters are dynamically adjusted to improve the local sensitivity of the model: ; in, is a conditionally dependent dynamic parameter; For the input A comprehensive feature vector; During the training process, grid search and cross-validation are used to determine the best hyperparameter combination, including penalty coefficients and dynamic kernel parameters; Step S6 is specifically as follows: Fuzzy sets are defined based on the degree of color difference, where the color difference index is divided into low, medium, and high; The color difference results output by AHA-SVM are converted into fuzzy input variables, and the specific color difference index is mapped to the fuzzy set using the membership function; Establish fuzzy rules based on expert systems or empirical knowledge; The fuzzy inference engine Mamdani model is used for rule reasoning, and the diagnosis description of color difference abnormality is generated according to the fuzzy rules and reasoning results.

2. The intelligent detection method for cloth color difference based on improved visual algorithm according to claim 1 is characterized in that: The step S1 is specifically as follows: Step S11: acquiring spectral image data of the cloth through a multispectral camera; Step S12: geometric calibration uses a checkerboard pattern calibration plate to ensure that the positions of the calibration points are known and obtain calibration plate images at multiple angles; Use the cv2.findChessboardCorners() function and cv2.calibrateCamera() function in the OpenCV vision library for calibration, and the camera internal parameter matrix K calibration: ; in, fx and fy is the focal length, (c x ,c y ) It is the heart of light; Use the camera's distortion coefficients (k1, k2, p1, p2, k3) to correct image distortion, and use the cv2.undistort() function to correct the captured image; Step S13: Spectral calibration uses a standardized color card X-Rite ColorChecker, and the reflectance of each color block is known; Obtain the response value of each color block in different spectral bands; The obtained spectral data are matched with the standard reflectance and the correction coefficient is calculated: Calculate the calibration coefficient K(λ) for each band so that the captured color value I measured (λ) can approach the standard reflectivity R(λ) after correction: ; Among them, the calibration coefficient ; is the corrected color value Compare the reflectance after calibration with the actual color card, and iteratively adjust the calibration coefficient to ensure the accuracy of the model; Error minimization adjustment is performed through the LMS algorithm; Step S14: extracting key features from the calibrated spectral data, including spectral peak position, intensity and shape.

3. The intelligent detection method for cloth color difference based on improved visual algorithm according to claim 2 is characterized in that: The error minimization adjustment is performed by the LMS algorithm, as follows: The error e(λ) is defined as the difference between the spectral value measured after calibration and the true reflectance: ; in, is the actual reflectance of the standard color card; The LMS algorithm adjusts K(λ) to minimize , for each band λ, calculate the error e(λ); And adjust according to the error : ; Where η is the step size factor; For the original value; For the adjusted value; The above steps are iterated until the sum of squared errors is less than a predetermined threshold or the maximum number of iterations is reached.

4. The intelligent detection method for cloth color difference based on improved visual algorithm according to claim 1 is characterized in that: The step S2 is specifically as follows: Use the camera interface to capture video frames in real time, adjust the image size to meet the CNN input requirements, and perform normalization at the same time; Extract features based on histogram of oriented gradients; Use a deep learning framework to load a pre-trained CNN and perform real-time inference based on the extracted features to output recommended values ​​for camera settings, including exposure time, ISO, and white balance. Use PID control method to adjust: ; Among them, ΔParam is the adjustment amount of the camera parameters, error is the difference between the current image features and the target features, Kp,K i ,K d are the proportional, integral and differential gain coefficients respectively; Based on the adjustment values ​​calculated by PID control, the camera parameters are controlled through the API provided by the camera, and the exposure, ISO and white balance are gradually adjusted to ensure that the real-time image maintains the best quality under changing ambient light conditions.

5. The intelligent detection method for cloth color difference based on improved visual algorithm according to claim 1 is characterized in that: The step S3 is specifically as follows: First, a shallow CNN is used, which contains several convolutional layers and ReLU activation layers, for basic denoising and enhancement: Given an input image I, the output of the convolutional network is I′: ; Among them, W is the convolution kernel weight, b is the bias, and f is the nonlinear activation function; Then apply a directional filter to precisely enhance the specified texture, filtering operation: ; in, is the value after the image pixel at position (x, y) is enhanced using a directional filter; is the filter kernel; is the filter coordinate; For location ( ) of image pixels; ; in, represents a unit vector at an angle θ; For location ( ) of image pixels; is the angle of the directional filter; Finally, the remaining noise is removed by non-local mean, the similarity between the pixels of the image is calculated, and the global similarity is used for denoising: ; in, is the pixel value of position p after non-local mean processing, C(p) is the normalization constant; Ω is the integration domain; is the pixel value at position q in the filtered image; NL w (p,q) is the similarity weight between pixel p and surrounding pixels q: ; in, represents a local patch; h is a smoothing parameter.

6. The intelligent detection method for cloth color difference based on improved visual algorithm according to claim 1 is characterized in that: The step S4 specifically includes: based on the pre-processed high-definition image, using EfficientNet to capture basic features, using the Attention mechanism to enhance key information; using a classifier to segment the cloth from the background; extracting the color, texture, and edge features of the cloth from the segmentation map; And the color, texture, edge and spectral features are integrated into a comprehensive feature vector.

7. The intelligent detection method for cloth color difference based on improved visual algorithm according to claim 6 is characterized in that: The EfficientNet is used to capture basic features, the Attention mechanism is used to enhance key information, and the classifier is used to segment cloth and background, as follows: Use the EfficientNet basic network as the feature extractor: F base =EfficientNet(I input ) Among them, I input is the preprocessed image, F base is the basic feature map; Introduce the application of Attention mechanism, including channel attention and spatial attention Channel Attention : ; in, Represents global average pooling, which reduces the dimension of the feature map to the average value of each channel; W 1 and W 2 is a learnable linear transformation matrix; σ is the Sigmoid activation function; Spatial Attention : ; Among them, AvgPool(F base ) and MaxPool(F base ) respectively represent the pooling of the average and maximum values ​​of the feature maps in the channel dimension; Represents a splicing operation; Represents the convolution operation based on the s×s convolution kernel; Superimpose channel attention and spatial attention on basic features to highlight key information: ; Among them, F enhanced It is the feature map enhanced by channel and spatial attention mechanism Use Softmax classifier to perform pixel-level classification, complete the segmentation of cloth and background, output segmentation map, and identify the cloth and background areas.

8. The intelligent detection method for cloth color difference based on improved visual algorithm according to claim 7 is characterized in that: The color, texture, and edge features of the cloth are extracted from the segmentation map; and the color, texture, edge, and spectral features are integrated into a comprehensive feature vector, as follows: Extract the cloth region from the segmented image; Calculate the mean and variance of the cloth area in different color channels, including RGB, HSV and Lab, to capture the color distribution and obtain color features; Calculate the LBP histogram from the cloth area to characterize the local texture pattern and obtain the texture features; Use Canny edge detection to extract edges from the cloth area, and then calculate the intensity and direction histograms of these edges to obtain edge features; The acquired color, texture, and edge features are combined with spectral features to establish a comprehensive feature vector.

Citation Information

Patent Citations

  • Single-color cloth defect detection method based on weak supervised learning

    CN115205209A

  • Composite material surface defect detection system and method

    CN119399154A