A method and device for online detection of shoe surface defects
Through image acquisition and deep learning technology, combined with LBP and Sobel algorithms, a shoe body surface defect classifier is constructed, which solves the problems of low efficiency and difficulty in detection in the existing technology, and realizes automated and accurate shoe body surface defect detection.
Patent Information
- Application Number
- CN202410020195.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-07
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-01-07
AI Technical Summary
Existing shoe body inspection methods are inefficient, difficult to detect subtle defects, and rely on manual observation, leading to fatigue and errors.
An online detection method using image acquisition and preprocessing, coordinate system transformation, feature extraction and classifier construction is used to identify shoe body surface defects through LBP algorithm, Sobel edge detection, wavelet transform and deep learning.
It has realized automated and highly efficient shoe body surface defect detection, which can locate and quantitatively analyze defects, improve detection precision and accuracy, identify more subtle defects and assess the severity of defects.
Smart Images

Figure CN117953277B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of shoe body detection, and in particular to an online detection method and device for shoe body surface defects. Background Art
[0002] Currently, shoes are tested after they are produced, but this is mainly done by manual visual inspection, i.e. the light transmittance of the holes in the shoe is observed by shining a flashlight, the depression of the shoe surface is observed by touching it with fingers, and the curvature of the shoe is observed by overlapping the standard shoe with the shoe to be tested.
[0003] This recognition method has the problems of low efficiency, easy fatigue, and difficulty in detecting subtle defects.
[0004] In view of this, the present invention is proposed. Summary of the invention
[0005] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide an online detection method and device for shoe surface defects, which can continuously analyze and detect the surfaces of batches of shoes, thereby improving the detection efficiency.
[0006] In the first aspect, in order to solve the above technical problems, the basic concept of the technical solution adopted by the present invention is:
[0007] A method for online detection of shoe surface defects, the method comprising the following steps:
[0008] Collecting a shoe surface image containing at least one defect, and performing an image preprocessing operation to obtain a first image set;
[0009] Transforming the coordinate system of each element in the first image set to obtain a second image set;
[0010] Transforming the second image set to obtain a first feature set corresponding to the surface contour and texture of the shoe body of the second image set;
[0011] Determine a second feature set corresponding to the shoe surface defect category of the second image set according to the influencing factor gradient of the shoe surface contour and texture corresponding to each element of the first feature set;
[0012] A shoe surface defect classifier is constructed according to the second feature set, and defects are identified on the target shoe surface image according to the shoe surface defect classifier.
[0013] In any of the above solutions, preferably, collecting a shoe surface image containing at least one defect and performing an image preprocessing operation to obtain a first image set includes:
[0014] The collected shoe surface images are marked and stored according to the defect categories to obtain a historical image set;
[0015] Load the historical image set to perform 3-layer wavelet decomposition denoising, and set the soft threshold according to the noise estimation to filter out the noise in the high-frequency subband;
[0016] Adaptive histogram equalization is performed on the denoised historical image set, and the mapping function is set by local area histogram statistics to enhance the contrast of line edges and surface details;
[0017] The LBP algorithm is used to extract the texture features of the line and combined with Sobel edge detection to locate the contour of the shoe surface.
[0018] In any of the above solutions, preferably, transforming the coordinate system of each element in the first image set to obtain the second image set includes:
[0019] Detecting the contours of each element in the first image set and determining the origin of the polar coordinates;
[0020] Detecting the direction of the contour line of each element in the first image set, and calculating the main direction angle of the contour line of each element in the first image set;
[0021] The main direction angle of the route is used as the polar axis, and a polar coordinate system is established according to the origin of the polar coordinates, wherein 0-360 degrees is used as the polar axis range, and the length of the shoe body is used as the maximum polar diameter;
[0022] Using a cubic Lagrange interpolation method, converting the elements in the first image set into the polar coordinate system to generate a polar coordinate image;
[0023] According to the actual position of each point in the polar coordinate image on the surface of the shoe body, a geometric transformation is performed on the polar coordinate image to obtain a second image set.
[0024] In any of the above solutions, preferably, detecting the line contour of each element in the first image set and determining the origin of the polar coordinates includes:
[0025] Extracting a first contour point set according to the line contours of each element in the first image set;
[0026] Calculate the minimum circumscribed rectangle of the first contour point set and obtain the coordinates of the four vertices of the rectangle;
[0027] The average coordinate of the middle point of two vertices that are symmetrical in the horizontal and vertical directions among the four vertex coordinates is determined as the origin of the polar coordinates.
[0028] In any of the above solutions, preferably, the second image set is transformed to obtain a first feature set of the second image set corresponding to the surface contour and texture of the shoe body, including:
[0029] Loading the second image set, using an edge detection algorithm to detect the contour of the shoe surface area of each element in the second image set, to obtain a second contour point set;
[0030] Calculate the curvature value of the second contour point set, encode the curvature value, and obtain the contour curvature feature;
[0031] Use wavelet transform decomposition in the shoe surface area to extract the high-frequency information of the shoe surface texture and obtain the texture features;
[0032] The contour curvature features and texture features are combined to generate the first feature set.
[0033] In any of the above solutions, preferably, according to the gradient of the influence factors of the shoe surface contour and texture corresponding to each element of the first feature set, determining the second feature set corresponding to the shoe surface defect category of the second image set includes:
[0034] Set the matrix corresponding to the first feature set to CX = [cx1, cx2, ..., cx i ], where cx i is the m-dimensional feature vector of the i-th element;
[0035] By formula: The statistical covariance matrix is calculated by the formula: S = VΛV T , perform eigenvalue decomposition, where n is the total number of elements, Λ is the eigenvalue diagonal matrix, and V is the eigenvector matrix;
[0036] Preset the threshold τ, select k eigenvectors whose principal component contribution rate is greater than the threshold τ to form the matrix U / , and get the reduced dimension feature matrix CX / =U / T CX;
[0037] Evaluate the ability of the feature matrix after dimensionality reduction to distinguish different defect categories, and use the mutual information algorithm to select the features that have the greatest impact on specific defect categories to obtain the optimal feature subset;
[0038] The corresponding optimal feature subset is extracted for each defect category to generate a second feature set.
[0039] In any of the above solutions, preferably, constructing a shoe surface defect classifier according to the second feature set, and performing defect recognition on a target shoe surface image according to the shoe surface defect classifier includes:
[0040] The second feature set is used as the input layer of the shoe surface defect classifier, and the output is the defect category. The network parameters are initialized, and the learning rate and number of training rounds are set.
[0041] Define the cross entropy loss function, use the back propagation algorithm to train the shoe surface defect classifier, and use k-fold cross validation on the training set to evaluate the training effect of the shoe surface defect classifier;
[0042] Input the target shoe surface image into the shoe surface defect classifier for prediction to obtain the prediction result;
[0043] Output the prediction results of the target shoe surface image and draw a confidence heat map, marking the defect location.
[0044] In a second aspect, an online detection device for shoe surface defects comprises:
[0045] An acquisition module, used for acquiring a shoe surface image containing at least one defect, and performing an image preprocessing operation to obtain a first image set;
[0046] A transformation module, used for transforming the coordinate system of each element in the first image set to obtain a second image set;
[0047] A calculation module, used for transforming the second image set to obtain a first feature set corresponding to the surface contour and texture of the shoe body of the second image set;
[0048] An extraction module, configured to determine a second feature set corresponding to a shoe surface defect category of a second image set according to a gradient of an influencing factor of each element of the first feature set corresponding to a shoe surface contour and texture;
[0049] The recognition module is used to construct a shoe surface defect classifier according to the second feature set, and perform defect recognition on the target shoe surface image according to the shoe surface defect classifier.
[0050] In a third aspect, an online detection device for shoe surface defects comprises: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned online detection methods for shoe surface defects.
[0051] In a fourth aspect, a computer-readable storage medium stores a program, which, when executed by a processor, implements any of the above-mentioned methods for online detection of shoe surface defects.
[0052] Compared with the prior art, the online detection method for shoe surface defects in the embodiment of the present application can automatically and efficiently perform a comprehensive scan and detection of the shoe surface and identify a variety of defects. Compared with manual inspection, it can detect more subtle defects and locate the defect positions. It can quantitatively evaluate the severity of shoe surface defects and then perform maintenance and repair of the shoe surface.
[0053] The specific implementation modes of the present invention are further described in detail below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. Some specific embodiments of the present application will be described in detail in an illustrative and non-restrictive manner with reference to the drawings. The same reference numerals in the drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the drawings:
[0055] Figure 1 This is a schematic diagram of the process of the online detection method for shoe surface defects according to an embodiment of the present application;
[0056] Figure 2 Schematic diagram of an online detection device for shoe surface defects according to an embodiment of the present application.
[0057] It should be noted that these drawings and text descriptions are not intended to limit the conceptual scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. The elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0058] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application.
[0059] It should be noted that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0060] The following embodiment of the present application takes the online detection method of shoe surface defects as an example to explain the solution of the present application in detail, but this embodiment cannot limit the protection scope of the present application.
[0061] like Figure 1 As shown, the present invention provides an online detection method for shoe surface defects, the method comprising the following steps:
[0062] Step 1, collecting a shoe surface image containing at least one defect, and performing an image preprocessing operation to obtain a first image set;
[0063] Step 2, transforming the coordinate system of each element in the first image set to obtain a second image set;
[0064] Step 3, transforming the second image set to obtain a first feature set of the second image set corresponding to the surface contour and texture of the shoe body;
[0065] Step 4, determining a second feature set corresponding to the shoe surface defect category of the second image set according to the influencing factor gradient of the shoe surface contour and texture corresponding to each element of the first feature set;
[0066] Step 5: construct a shoe surface defect classifier according to the second feature set, and perform defect recognition on the target shoe surface image according to the shoe surface defect classifier.
[0067] In the online detection method for shoe surface defects described in the embodiment of the present invention, with the help of coordinate transformation and feature extraction, the position, length, area and other parameters of the defects can be located and quantitatively analyzed to guide subsequent processing; a classifier can be constructed to automatically identify different types of defects, such as scratches, breakpoints, corrosion, etc., for qualitative analysis; an end-to-end solution can be formed, and the model can be continuously optimized to improve the accuracy of identifying complex defects. Compared with traditional manual inspection, intelligent and precise detection is achieved, which greatly improves the level of detecting shoe surface defects.
[0068] In the above embodiment, the step 1, collecting a shoe surface image containing at least one defect and performing an image preprocessing operation to obtain a first image set, includes:
[0069] Step 11, labeling and storing the collected shoe surface images according to the defect categories to obtain a historical image set;
[0070] Step 12, loading the historical image set to perform 3-layer wavelet decomposition denoising, and setting a soft threshold according to the noise estimation to filter out the noise in the high frequency subband;
[0071] Step 13, performing adaptive histogram equalization on the denoised historical image set, and setting a mapping function through local area histogram statistics to enhance the contrast of line edges and surface details;
[0072] Step 14: Use the LBP algorithm to extract the texture features of the line and combine it with the Sobel edge detection to locate the contour of the shoe surface.
[0073] In the online detection method for shoe surface defects described in the embodiment of the present invention, by constructing an image library containing different defects, a data foundation is laid for subsequent processing, and different defect samples are conducive to improving the generalization ability of the model; through multi-scale analysis, noise of various frequencies is effectively removed, so that the image quality is significantly improved, which is conducive to subsequent feature extraction; adaptive histogram equalization can significantly enhance the image contrast, make the line edges and details clearer and more discernible, and improve the segmentation and recognition effects; LBP algorithm combined with Sobel edge detection can effectively extract the texture and contour features of the shoe surface, lay the foundation for accurately positioning the shoe surface and extracting features, can greatly improve the image quality and information volume of the shoe surface, and provide high-quality input for subsequent recognition algorithms.
[0074] In the above embodiment, the step 2, transforming the coordinate system of each element in the first image set to obtain the second image set, includes:
[0075] Step 21, detecting the contour lines of each element in the first image set and determining the origin of the polar coordinates;
[0076] Step 22, detecting the direction of the contour line of each element in the first image set, and calculating the main direction angle of the contour line of each element in the first image set;
[0077] Step 23, taking the main direction angle of the line as the polar axis, and establishing a polar coordinate system according to the origin of the polar coordinates, wherein 0-360 degrees is taken as the polar axis range, and the length of the shoe body is taken as the maximum polar diameter;
[0078] Step 24, using a cubic Lagrange interpolation method, converting the elements in the first image set into the polar coordinate system to generate a polar coordinate image;
[0079] Step 25: Perform geometric transformation on the polar coordinate image according to the actual position of each point in the polar coordinate image on the surface of the shoe body to obtain a second image set.
[0080] In the online detection method for shoe surface defects described in the embodiment of the present invention, step 21 helps to accurately capture the boundaries of image elements, thereby providing an important basis for subsequent coordinate transformation. By determining the contour line, the shape and position of the image element can be more accurately understood; by determining the origin of the polar coordinates, the reference point of the polar coordinate system can be defined, which in turn affects the calculation and interpretation of all coordinates.
[0081] Step 22: By detecting the direction of the contour line and calculating the main direction angle, the spatial orientation of the image elements can be understood more accurately. This helps to perform coordinate transformation and image processing more effectively in subsequent steps. Step 24: Cubic Lagrange interpolation is an effective mathematical tool for reconstructing images in a new coordinate system. It can provide smooth transitions and high-quality image reconstruction, ensuring the preservation of image quality and details. Step 25: Geometric transformation of the polar coordinate image helps to further refine and adjust the image to meet specific analysis or display requirements. This step allows the image to be adjusted to better reflect the actual situation of the shoe surface, improving the practicality and accuracy of the image data.
[0082] In the above embodiment, the step 21 of detecting the contours of each element in the first image set and determining the origin of the polar coordinates includes:
[0083] Step 211, extracting a first contour point set according to the line contours of each element in the first image set;
[0084] Step 212, calculating the minimum circumscribed rectangle of the first contour point set, and obtaining the coordinates of the four vertices of the rectangle;
[0085] Step 213: determine the average coordinate of the middle point of two vertices that are symmetrical in the horizontal and vertical directions among the four vertex coordinates as the origin of the polar coordinates.
[0086] In the online detection method for shoe surface defects described in an embodiment of the present invention, extracting the contour point set of the shoe surface is the primary step in determining the origin coordinates. The range of the shoe body can be calculated through the first contour point set; the minimum circumscribed rectangle is calculated to cover the entire surface area of the shoe body, and its vertex coordinates reflect the overall position of the shoe body; selecting the middle point of two symmetrical vertices as the origin can make the shoe body located at the center of the coordinate system; the origin determined in this way makes the shoe body surface in the best position of the polar coordinate system, which is conducive to feature representation and description.
[0087] In the above embodiment, the step 22 of detecting the contour direction of each element in the first image set and calculating the main direction angle of the contour of each element in the first image set includes:
[0088] Step 221, using the Sobel operator to obtain the gradient value of each pixel point of each element in the first image set in the horizontal and vertical coordinate directions, and calculating the gradient direction of each pixel according to the gradient value;
[0089] Step 222, dividing the image into a plurality of small regions, and constructing a histogram of the gradient direction in each region;
[0090] Step 223, by formula: Each direction interval of the histogram is weighted to obtain a weighted gradient direction histogram, where bin is a direction interval, (μ x , μ y ) and σ are the center coordinates of the region and the Gaussian weighted standard deviation, respectively. |G(x,y)| is the magnitude of the gradient. x and y are the horizontal and vertical coordinates of the pixel point, and θ is the gradient direction angle.
[0091] Step 224, construct a data matrix D for the weighted gradient direction histogram of each region, and use the formula: Calculate the covariance matrix C of the data matrix D, where is the mean vector of the data matrix D, N is the number of data points, D i is the i-th row in the data matrix D;
[0092] Step 225, performing eigenvalue decomposition on the covariance matrix C to obtain eigenvalue λ and eigenvector v;
[0093] Step 226, selecting the eigenvector vmax corresponding to the maximum eigenvalue λmax as the main direction;
[0094] Step 227, by formula: α = arctan2(v max,y ,v max,x ), convert vmax into an angle value α, where v max,y ,v max,x are the x and y components of the eigenvector respectively.
[0095] In the online detection method for shoe surface defects described in an embodiment of the present invention,.
[0096] In the above embodiment, the step 25, performing geometric transformation on the polar coordinate image according to the actual position of each point in the polar coordinate image on the surface of the shoe body to obtain the second image set, includes:
[0097] Step 251, obtaining the initial polar coordinates T(r,θ) of each pixel point in the polar coordinate system;
[0098] Step 252, by the formula: r′=r·(1+αcos(κr), θ′=θ+βr 2 , calculate the transformed polar coordinates T(r′,θ′) of each pixel point;
[0099] Step 253, smoothing the pixel values of the transformed polar coordinates T(r′,θ′), and mapping each transformed polar coordinate point to a new position, reconstructing the pixels of the new image, and obtaining a second image set.
[0100] In the online detection method for shoe surface defects described in the embodiment of the present invention, step 221 can accurately obtain the gradient value of each pixel in the image in the horizontal and vertical coordinate directions. It helps to accurately reveal the structural features of the image, especially the direction of the edges and contours. Step 222 divides the image into multiple small areas and constructs a histogram of the gradient direction for each area, which helps to analyze and summarize the gradient information of the image in the local area, so as to better understand the local structural features of the image. Step 223 can improve the feature representation ability in a specific area of the image by weighting each direction interval of the histogram. Step 224 can effectively capture the overall distribution characteristics of the gradient direction in the image area by constructing a data matrix and calculating its covariance matrix. Step 225 performs eigenvalue decomposition on the covariance matrix to find the eigenvector that describes the most important direction of change of the data. It helps to determine the most significant directional features in the image area. Step 226 selects the eigenvector corresponding to the maximum eigenvalue as the main direction, which reflects the most important directional information in the image area and is crucial for describing the structure of the image. Step 227 converts the eigenvector into an angle value, making the information of the main direction more intuitive and easy to understand.
[0101] In the above embodiment, step 253, smoothing the pixel values of the transformed polar coordinates T(r′,θ′), and mapping each transformed polar coordinate point to a new position, and reconstructing the pixels of the new image, includes:
[0102] Step 2531, for each pixel point corresponding to the transformed polar coordinates T(r′,θ′), calculate the Euclidean distance d from other pixel points ij ;
[0103] Step 2532, through the basis function: For every Euclidean distance d ij Fill the interpolation matrix A, where ε is the preset broadening parameter;
[0104] Step 2533, solving the linear equation system Av=ω, obtaining the weight vector ω of each basis function, where v is the pixel value vector of the untransformed image;
[0105] Step 2534, for each new position T(r′,θ′) after transformation, calculate its distance from the pixel position before transformation, and determine the pixel value of the new position through basis function and weight vector;
[0106] Step 2535, for each pixel in the image before transformation, calculate the corresponding position in the image after transformation according to the target resolution;
[0107] Step 2536, define the window function and the kernel, and for each resampling point, calculate the value of the window function and the kernel at that point to obtain a weighted average value;
[0108] Step 2537, determine the pixel value of the corresponding position in the new image based on the weighted average value.
[0109] In the online detection method for shoe surface defects described in the embodiment of the present invention, step 2531 calculates the Euclidean distance of each pixel point after transformation with other pixel points, which helps to determine the spatial relationship between each point in the image. Step 2532 fills the interpolation matrix with the Euclidean distance through the basis function, which can smooth the image and avoid the breakage or distortion between pixels generated during the image transformation process. Step 2533 obtains the weight vector of each basis function by solving the linear equation system, so that the appropriate value of each point after transformation can be calculated according to the pixel value vector of the untransformed image. The accuracy and integrity of the data after the image transformation are guaranteed. Step 2534 calculates the distance between each new position after transformation and the pixel position before transformation, and determines the pixel value of the new position through the basis function and the weight vector. It helps to generate high-quality images and maintain image details and clarity. Step 2535 calculates the corresponding position in the transformed image according to the target resolution for each pixel point in the image before transformation, which helps to ensure that the proportion and structure of the image are not distorted. Step 2536 defines the window function and kernel to calculate the weighted average value at the resampling point, which helps to reduce noise and distortion during the transformation process and improve the overall quality of the image. Step 2537 determines the pixel value of the corresponding position in the new image based on the weighted average value, ensuring the overall coordination and realism of the image.
[0110] In the above embodiment, the step 3, transforming the second image set to obtain a first feature set of the second image set corresponding to the surface contour and texture of the shoe body, includes:
[0111] Step 31, loading the second image set, using an edge detection algorithm to detect the contour of the shoe surface area of each element in the second image set, and obtaining a second contour point set;
[0112] Step 32, calculating the curvature value of the second contour point set, and encoding the curvature value to obtain the contour curvature feature;
[0113] Step 33, using wavelet transform decomposition in the shoe surface area to extract high-frequency information of the shoe surface texture and obtain texture features;
[0114] Step 34: Combine the contour curvature features and the texture features to generate a first feature set.
[0115] In the online detection method for shoe surface defects described in the embodiment of the present invention, the shoe contour is accurately detected to locate the shoe position, which is the basis for subsequent feature extraction; the contour curvature is calculated and encoded to capture the shape information of the shoe surface and reflect the surface state of the shoe; the wavelet transform can effectively decompose different frequency sub-bands and extract the texture features of the shoe surface; the contour and texture features can comprehensively represent the state of the shoe surface and are effective features for distinguishing defects; the two types of features are organically combined to construct a feature set with strong expression ability, which lays the foundation for subsequent identification; the feature extraction process is simple and efficient to operate, easy to implement in engineering, and improves the overall system performance.
[0116] In the above embodiment, the step 32, calculating the curvature value of the second contour point set and encoding the curvature value to obtain the contour curvature feature, includes:
[0117] Step 321, traverse the second contour point set, and for each point, use the formula: Calculate the corresponding curvature, where (Δx i =x i+1 -x i ) and (Δy i =y i+1 -y i ) is the difference between adjacent contour points in the x and y directions;
[0118] Step 322, normalizing the calculated curvature value and mapping it to a preset range for encoding;
[0119] Step 323: Use the encoded curvature value sequence as the contour curvature feature.
[0120] In the online detection method for shoe surface defects described in the embodiment of the present invention, step 321 can accurately depict the local curvature characteristics of the contour by traversing the second contour point set and calculating the curvature of each point using a specific formula. Curvature is an important geometric quantity that describes the degree of local bending of the shape of an object. Step 322 normalizes the curvature value and maps it to a preset range for encoding, which helps to standardize the curvature data and make it more suitable for subsequent processing and analysis. Normalization can eliminate the differences in data under different measurement conditions and make the curvature values more comparable. Step 323 uses the encoded curvature value sequence as the contour curvature feature, providing an effective mathematical representation for subsequent image analysis and processing.
[0121] In the above embodiment, the step 4, determining the second feature set corresponding to the shoe surface defect category of the second image set according to the influencing factor gradient of the shoe surface contour and texture corresponding to each element of the first feature set, includes:
[0122] Step 41, set the matrix corresponding to the first feature set to CX = [cx1, cx2, ..., cxi ], where cx i is the m-dimensional feature vector of the i-th element;
[0123] Step 42, by formula: The statistical covariance matrix is calculated by the formula: S = VΛV T , perform eigenvalue decomposition, where n is the total number of elements, Λ is the eigenvalue diagonal matrix, and V is the eigenvector matrix;
[0124] Step 43: preset a threshold value τ, select k eigenvectors whose principal component contribution rate is greater than the threshold value τ to form a matrix U / , and get the reduced dimension feature matrix CX / =U / T CX;
[0125] Step 44, evaluating the ability of the feature matrix after dimensionality reduction to distinguish different defect categories, and using the mutual information algorithm to select the features that have the greatest impact on a specific defect category to obtain the optimal feature subset;
[0126] Step 45, extract the corresponding optimal feature subset for each defect category to generate a second feature set.
[0127] In the online detection method for shoe surface defects described in an embodiment of the present invention, the covariance matrix is used to analyze the correlation of each feature, and feature dimensionality reduction is achieved through principal component analysis; the principal component contribution rate reflects the importance of the feature, and setting a threshold can delete redundant features; the main feature information is retained after dimensionality reduction, and the feature expression ability is improved while reducing the computational complexity; the discrimination ability of different features is evaluated, and the feature subset with the greatest impact on specific defects is selected; a customized feature subset is extracted for each defect category to improve the discrimination; the second feature set can improve the accuracy of subsequent recognition by optimizing the feature representation of each category; the feature selection strategy is simple and effective, and can significantly improve the recognition performance.
[0128] In the above embodiment, the step 5, constructing a shoe surface defect classifier according to the second feature set, and performing defect recognition on the target shoe surface image according to the shoe surface defect classifier, includes:
[0129] Step 51, using the second feature set as the input layer of the shoe surface defect classifier, outputting the defect category, and initializing the network parameters, setting the learning rate and the number of training rounds;
[0130] Step 52, defining a cross entropy loss function, using a back propagation algorithm to train a shoe surface defect classifier, and using k-fold cross validation on the training set to evaluate the training effect of the shoe surface defect classifier;
[0131] Step 53, inputting the target shoe surface image into the shoe surface defect classifier for prediction to obtain a prediction result;
[0132] Step 54, output the prediction result of the target shoe surface image and draw a confidence heat map, marking the defect location.
[0133] In the online detection method for shoe surface defects described in the embodiment of the present invention, the optimized second feature set is used as input to improve the expression ability of the model; a deep learning model such as a convolutional neural network is used to perform end-to-end feature learning and classification; reasonable network parameters and loss functions are set, and back propagation is used for model training; k-fold cross validation can evaluate the stability and generalization ability of the model on the training set; new samples are predicted to automatically identify the category of shoe surface defects; a confidence heat map is drawn to intuitively display the classification results and locate the defect position; this classification strategy can realize intelligent analysis of a large number of shoe surface defects; and the intelligent level of shoe surface detection and maintenance is improved.
[0134] like Figure 2 As shown, the present invention also provides an online detection device for shoe surface defects, comprising:
[0135] The acquisition module 10 is used to acquire a shoe surface image containing at least one defect and perform image preprocessing operations to obtain a first image set;
[0136] A transformation module 20, configured to transform the coordinate system of each element in the first image set to obtain a second image set;
[0137] A calculation module 30, configured to transform the second image set to obtain a first feature set of the second image set corresponding to the surface contour and texture of the shoe body;
[0138] An extraction module 40, configured to determine a second feature set corresponding to a shoe surface defect category of a second image set according to a gradient of an influencing factor of each element of the first feature set corresponding to a shoe surface contour and texture;
[0139] The recognition module 50 is used to construct a shoe surface defect classifier according to the second feature set, and perform defect recognition on the target shoe surface image according to the shoe surface defect classifier.
[0140] The online detection device for shoe surface defects can also communicate with one or more external devices (such as keyboards, pointing devices, displays, etc.), and can also communicate with one or more devices that enable users to interact with the online detection device for shoe surface defects, and / or communicate with any device that enables the online detection device for shoe surface defects to communicate with one or more other computing devices (such as network cards, modems, etc.). Such communication can be performed through an input / output (I / O) interface. In addition, the online detection device for shoe surface defects can also communicate with one or more networks (such as local area networks (LANs), wide area networks (WANs) and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the online detection device for shoe surface defects through a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the online detection device for shoe surface defects, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0141] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0142] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0143] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0144] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for online detection of shoe surface defects, characterized in that: The method comprises the following steps: Collecting a shoe surface image containing at least one defect, and performing an image preprocessing operation to obtain a first image set; Transforming the coordinate system of each element in the first image set to obtain a second image set; Transforming the second image set to obtain a first feature set of the second image set corresponding to the surface contour and texture of the shoe body; Determine a second feature set corresponding to the shoe surface defect category of the second image set according to the influencing factor gradient of the shoe surface contour and texture corresponding to each element of the first feature set; Constructing a shoe surface defect classifier according to the second feature set, and performing defect recognition on a target shoe surface image according to the shoe surface defect classifier; The step of transforming the coordinate system of each element in the first image set to obtain the second image set includes: Detecting the contours of each element in the first image set and determining the origin of the polar coordinates; Detecting the direction of the contour line of each element in the first image set, and calculating the main direction angle of the contour line of each element in the first image set; The main direction angle of the route is used as the polar axis, and a polar coordinate system is established according to the origin of the polar coordinates, wherein 0-360 degrees is used as the polar axis range, and the length of the shoe body is used as the maximum polar diameter; Using a cubic Lagrange interpolation method, converting the elements in the first image set into the polar coordinate system to generate a polar coordinate image; According to the actual position of each point in the polar coordinate image on the surface of the shoe body, a geometric transformation is performed on the polar coordinate image to obtain a second image set; The step of detecting the contour lines of each element in the first image set and determining the origin of the polar coordinates includes: Extracting a first contour point set according to the line contours of each element in the first image set; Calculate the minimum circumscribed rectangle of the first contour point set and obtain the coordinates of the four vertices of the rectangle; The average coordinates of the middle points of two vertices that are symmetrical in the horizontal and vertical directions among the four vertex coordinates are determined as the origin of the polar coordinates; The step of detecting the contour direction of each element in the first image set and calculating the main direction angle of the contour of each element in the first image set includes: Using the Sobel operator to obtain the gradient value of each pixel point of each element in the first image set in the horizontal and vertical coordinate directions, and calculating the gradient direction of each pixel according to the gradient value; Divide the image into multiple small regions and construct a histogram of gradient direction in each region; By formula: , weight each direction interval of the histogram to obtain a weighted gradient direction histogram, where bin is a direction interval, ( , )and are the center coordinates of the region and the Gaussian weighted standard deviation, respectively. is the amplitude of the gradient, x and y are the horizontal and vertical coordinates of the pixel point, is the gradient direction angle; For the weighted gradient direction histogram of each region, a data matrix D is constructed and the formula is: , calculate the covariance matrix C of the data matrix D, where is the mean vector of the data matrix D, N is the number of data points, is the i-th row in the data matrix D; Perform eigenvalue decomposition on the covariance matrix C and obtain the eigenvalue and the eigenvector ; Selection and Maximum Eigenvalue The corresponding eigenvector As the main direction; By formula: ,Will Convert to angle value ,in, are the y and x components of the eigenvector respectively; According to the actual position of each point in the polar coordinate image on the surface of the shoe body, the polar coordinate image is geometrically transformed to obtain a second image set, including: Get the initial polar coordinates of each pixel in the polar coordinate system ; By formula: , calculate the transformed polar coordinates of each pixel ; After transformation, the polar coordinates The pixel values are smoothed, and each transformed polar coordinate point is mapped to a new position, and the pixels of the new image are reconstructed to obtain a second image set; Among them, the transformed polar coordinates The pixel values are smoothed, and each transformed polar coordinate point is mapped to a new position, and the pixels of the new image are reconstructed to obtain a second image set, including: After transformation, the polar coordinates For each corresponding pixel, calculate the Euclidean distance to other pixels ; By basis function: For each Euclidean distance Fill the interpolation matrix A, where is the preset widening parameter; Solving Linear Equations , get the weight vector of each basis function ,in, is the pixel value vector of the untransformed image; For each transformed new position , calculate the distance between it and the pixel position before transformation, and determine the pixel value of the new position through basis function and weight vector; For each pixel in the image before transformation, calculate the corresponding position in the image after transformation according to the target resolution; Define the window function and kernel, and for each resampling point, calculate the value of the window function and kernel at that point to obtain the weighted average value; According to the weighted average, the pixel value of the corresponding position in the new image is determined.
2. The method for online detection of shoe surface defects according to claim 1, characterized in that: Collecting a shoe surface image containing at least one defect and performing an image preprocessing operation to obtain a first image set, including: The collected shoe surface images are marked and stored according to the defect categories to obtain a historical image set; Load the historical image set to perform 3-layer wavelet decomposition denoising, and set the soft threshold according to the noise estimation to filter out the noise in the high-frequency subband; Adaptive histogram equalization is performed on the denoised historical image set, and the mapping function is set by local area histogram statistics to enhance the contrast of line edges and surface details; The LBP algorithm is used to extract the texture features of the line and combined with Sobel edge detection to locate the contour of the shoe surface.
3. The method for online detection of shoe surface defects according to claim 2, characterized in that: The second image set is transformed to obtain a first feature set of the second image set corresponding to the surface contour and texture of the shoe body, including: Loading the second image set, using an edge detection algorithm to detect the contour of the shoe surface area of each element in the second image set, to obtain a second contour point set; Calculate the curvature value of the second contour point set, encode the curvature value, and obtain the contour curvature feature; Use wavelet transform decomposition in the shoe surface area to extract the high-frequency information of the shoe surface texture and obtain the texture features; The contour curvature features and texture features are combined to generate the first feature set.
4. The method for online detection of shoe surface defects according to claim 3, characterized in that: According to the influencing factor gradient of the shoe surface contour and texture corresponding to each element of the first feature set, a second feature set corresponding to the shoe surface defect category of the second image set is determined, including: Set the matrix corresponding to the first feature set to ,in, is the m-dimensional feature vector of the i-th element; By formula: , statistical covariance matrix, and through the formula: , perform eigenvalue decomposition, where n is the total number of elements, is the eigenvalue diagonal matrix, is the eigenvector matrix; Preset the threshold τ, select k eigenvectors whose principal component contribution rate is greater than the threshold τ to form a matrix , and obtain the feature matrix after dimension reduction ; Evaluate the ability of the feature matrix after dimensionality reduction to distinguish different defect categories, and use the mutual information algorithm to select the features that have the greatest impact on specific defect categories to obtain the optimal feature subset; The corresponding optimal feature subset is extracted for each defect category to generate a second feature set.
5. The method for online detection of shoe surface defects according to claim 4, characterized in that: Constructing a shoe surface defect classifier according to the second feature set, and performing defect recognition on a target shoe surface image according to the shoe surface defect classifier, including: The second feature set is used as the input layer of the shoe surface defect classifier, and the output is the defect category. The network parameters are initialized, and the learning rate and number of training rounds are set. Define the cross entropy loss function, use the back propagation algorithm to train the shoe surface defect classifier, and use k-fold cross validation on the training set to evaluate the training effect of the shoe surface defect classifier; Input the target shoe surface image into the shoe surface defect classifier for prediction to obtain the prediction result; Output the prediction results of the target shoe surface image and draw a confidence heat map, marking the defect location.
6. An online detection device for shoe surface defects, characterized in that: Applied in the method as claimed in claim 1, comprising: An acquisition module, used for acquiring a shoe surface image containing at least one defect, and performing an image preprocessing operation to obtain a first image set; A transformation module, used for transforming the coordinate system of each element in the first image set to obtain a second image set; A calculation module, used for transforming the second image set to obtain a first feature set corresponding to the surface contour and texture of the shoe body of the second image set; An extraction module, configured to determine a second feature set corresponding to a shoe surface defect category of a second image set according to a gradient of an influencing factor of each element of the first feature set corresponding to a shoe surface contour and texture; The recognition module is used to construct a shoe surface defect classifier according to the second feature set, and perform defect recognition on the target shoe surface image according to the shoe surface defect classifier.
7. An online detection device for shoe surface defects, characterized in that: include: one or more processors; A storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the online detection method for shoe surface defects as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, which, when executed by a processor, implements the online detection method for shoe surface defects as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Bottleneck defect detection method based on gradient direction histograms
CN106952258A
PCB (Printed Circuit Board) defect evaluation method and device, equipment and medium
CN113870256A
Chip welding line defect detection method and device
CN114494174A
MSWI process combustion state identification method based on multi-feature fusion and improved cascade forest
CN114882391A
Machine vision steel wire rope surface defect detection method based on multi-feature fusion
CN116843626A
