Deep learning-based tray defect detection method and system
By applying multi-scale morphological decomposition and adaptive spectrum filtering in pallet defect detection, the problems of noise sensitivity and detailed information loss in traditional methods are solved; at the same time, through dynamic convolution kernel generation and feature fusion module design, the adaptability and detection performance of the model are improved, and high accuracy and comprehensive defect detection effects are achieved.
Patent Information
- Application Number
- CN202510263606.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-06
AI Technical Summary
Traditional image processing methods and convolutional neural networks have problems such as noise sensitivity, loss of detail information, insufficient feature extraction, poor adaptability of static convolution kernels, insufficient multi-scale feature fusion and loss of pooling operation information in pallet defect detection.
The detailed information of image quality and defect areas is enhanced through multi-scale morphological decomposition, adaptive spectrum filtering, frequency domain inverse transformation, definition of scale weights and filter fusion; at the same time, by defining dynamic convolution weights, building dynamic convolution generators, designing feature fusion modules, designing dynamic pooling layers and designing loss functions, convolution kernels are dynamically generated to improve the adaptability and detection performance of the model.
It effectively enhances image quality, improves the accuracy and adaptability of defect detection, can better capture the global and local information of tray defects, and improves the comprehensiveness of detection and the training effect of the model.
Smart Images

Figure CN120107227A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pallet detection technology, and specifically to a pallet defect detection method and system based on deep learning. Background Art
[0002] A pallet defect detection method and system based on deep learning is a comprehensive technical solution that combines image processing technology and deep learning technology to accurately detect pallet defects. It can significantly reduce the cost and error rate of manual inspection and provide reliable technical support for pallet quality control.
[0003] Traditional image processing methods have problems in pallet defect detection, such as sensitivity to noise, loss of detail information, and insufficient feature extraction; traditional convolutional neural networks have problems in pallet defect detection, such as poor adaptability of static convolution kernels, insufficient multi-scale feature fusion, and loss of information in pooling operations; traditional parameter tuning methods have problems in low search efficiency and poor parameter adaptability in pallet defect detection model optimization. Summary of the invention
[0004] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a pallet defect detection method and system based on deep learning. In view of the problems of noise sensitivity, loss of detail information, and insufficient feature extraction in traditional image processing methods in pallet defect detection, this solution effectively enhances the detail information of the defective area through multi-scale morphological decomposition, adaptive spectral filtering, frequency domain inverse transform, definition of scale weights and filter fusion, while suppressing background noise, enhancing the image quality and improving the accuracy of defect detection; in view of the problems of poor adaptability of static convolution kernels, insufficient multi-scale feature fusion, and loss of pooling operation information in traditional convolutional neural networks in pallet defect detection, this solution defines dynamic convolution weights, constructs a dynamic convolution generator, and designs a feature fusion module , design dynamic pooling layers and loss functions, which can dynamically generate convolution kernels according to the local context of the input feature map, enhance the model's ability to capture complex defect features, improve the adaptability of detection, and better capture the global and local information of pallet defects, improve the comprehensiveness of detection, and improve the training effect and detection performance of the model; In response to the problems of low search efficiency and poor parameter adaptability of traditional parameter tuning methods in the optimization of pallet defect detection models, this scheme dynamically adjusts the search strategy by tuning the initial settings, defining spatial adaptation factors, parameter search, evaluating fitness, mutation operations, and designing start and stop rules to ensure the adaptability and stability of parameter tuning and avoid invalid searches, thereby improving the efficiency of parameter tuning, global search capability and adaptability of the pallet defect detection model.
[0005] The technical solution adopted by the present invention is as follows: a pallet defect detection method based on deep learning, the method comprising the following steps:
[0006] Step S1: data preparation;
[0007] Step S2: image processing;
[0008] Step S3: constructing a pallet defect detection model;
[0009] Step S4: global tuning;
[0010] Step S5: Defect detection.
[0011] Furthermore, in step S1, the data preparation first collects a pallet image, and the types of the pallet image include a normal pallet and a defective pallet; then the image is annotated to mark the type of the pallet image and the defect position in the image.
[0012] Furthermore, in step S2, the image processing is performed by multi-scale morphological decomposition, adaptive spectrum filtering, frequency domain inverse transformation, definition of scale weights and filter fusion, specifically including the following steps:
[0013] Step S21: multi-scale morphological decomposition, expressed as follows:
[0014] ;
[0015] in, Represents the index of the image scale, a and b represent the coordinate row index and column index of the image respectively. Represents the image The scale decomposition results are represents the scale-weighted fusion operator, represents the original image, Indicates A square kernel of size , Represents the use of square kernel Perform opening operation on the original image. Represents the use of square kernel Perform a closing operation on the original image. Represents a compound operator;
[0016] Step S22: Adaptive spectrum filtering, expressed as follows:
[0017] ;
[0018] Among them, u and v represent the frequency domain coordinate index of the image, Indicates The Fourier transform result of the image at each scale is: represents Fourier transform, Represents the image Perform Fourier transform, represents an adaptive frequency domain filter, represents an exponential function with a natural constant as base, and represent the row and column coordinates of the center of the frequency domain, respectively. represents the bandwidth of the filter, represents the adaptive gain parameter, represents the local signal-to-noise ratio, which is defined as the ratio of the spectrum energy to the noise energy. Express The result after filtering;
[0019] Step S23: frequency domain inverse transformation, expressed as follows:
[0020] ;
[0021] in, represents the first The filtered image of scales, represents the inverse frequency domain transform, Represents the frequency domain image Perform inverse frequency domain transform;
[0022] Step S24: define the scale weight, which is expressed as follows:
[0023] ;
[0024] in, represents the scale weight of the slth scale, Indicates taking the absolute value, Representing images The gradient of represents the filtered image of the gth scale after the inverse frequency domain transform, Representing images The gradient of
[0025] Step S25: filtering fusion, which is expressed as follows:
[0026] ;
[0027] in, Represents the image after filtering and fusion.
[0028] Further, in step S3, the pallet defect detection model is constructed by defining dynamic convolution weights, constructing a dynamic convolution generator, designing a feature fusion module, designing a dynamic pooling layer, and designing a loss function to construct the pallet defect detection model, specifically including the following steps:
[0029] Step S31: Define dynamic convolution weights, as shown below:
[0030] ;
[0031] Among them, i and j represent the row index and column index of the spatial position of the feature map, respectively, and m and n represent the row index and column index of the basic convolution kernel, respectively. represents the dynamic convolution weight, represents the normalized exponential function, P and Q represent the width and height of the local neighborhood, p and q represent the offset of the local neighborhood in the row direction and column direction respectively, represents the basic weight matrix, Indicates that the feature map is at position The eigenvalue at represents the base bias;
[0032] Step S32: construct a dynamic convolution generator, which is expressed as follows:
[0033] ;
[0034] Among them, x and y represent the row index and column index of the spatial position inside the convolution kernel, respectively. Indicates the position in the feature map The spatial position inside the dynamic convolution kernel generated at The value at , M and N represent the maximum number of rows and columns of the basic convolution kernel, respectively. Represents the spatial position inside the basic convolution kernel of the mth row and nth column The value at Represents the convolution bias term;
[0035] Step S33: Design a feature fusion module, as shown below:
[0036] ;
[0037] in, Indicates that the feature map after feature fusion is at position The value at represents the maximum scale of the feature map, Indicates The characteristic coefficient of the scale, represents the resizing function, represents the feature map, Indicates that the feature map Adjust to target size , represents element-by-element multiplication, represents the hyperbolic tangent function, and Represent the scale fusion weight and bias respectively;
[0038] Step S34: Design a dynamic pooling layer, as shown below:
[0039] ;
[0040] in, Indicates that the feature map after the pooling operation is at position The value at, c1 and c2 represent the row index and column index of the pooling window, represents the pooling window, Indicates the input feature map at the pooling window position ( ), represents the sigmoid function, represents the mask weight, represents the mask bias;
[0041] Step S35: Design a loss function, which is expressed as follows:
[0042] ;
[0043] in, Represents the loss value of the model, represents the cross entropy loss, Indicates The feature map of each scale is at position The value at Represents the first The feature map of each scale is at position The value at It means taking the square of L2 norm.
[0044] Further, in step S4, the global tuning is performed by tuning initial settings, defining spatial adaptation factors, parameter search, evaluating fitness, mutation operations, and designing start and stop rules, specifically including the following steps:
[0045] Step S41: Optimizing initial settings and determining tuning parameters, including creating a parameter search space, randomly generating initial parameter search points in the parameter space, setting a maximum number of parameter searches, and setting a parameter fitness qualification value;
[0046] Step S42: define the spatial adaptation factor, which is expressed as follows:
[0047] ;
[0048] Among them, o and r represent the index of the parameter search point, t represents the number of parameter searches, represents the spatial adaptation factor of the oth parameter search point during the t+1th parameter search, represents the spatial adaptation factor of the oth parameter search point during the tth parameter search, represents the spatial adaptation coefficient, Represents the spatial adaptation factor of the rth parameter search point during the tth parameter search;
[0049] Step S43: parameter search, expressed as follows:
[0050] ;
[0051] in, It indicates the parameter point searched by the oth parameter search point in the t+1th parameter search. It indicates the parameter point searched by the oth parameter search point in the tth parameter search. and represents the search adjustment coefficient, It represents the parameter point searched by the rth parameter search point in the tth parameter search. Indicates the maximum value of the spatial adaptation factor, Indicates the parameter point with the highest fitness;
[0052] Step S44: Evaluate the fitness, and set the inverse of the loss function value of the model as the fitness of the parameter point;
[0053] Step S45: define the mutation probability, which is expressed as follows:
[0054] ;
[0055] Where D represents the mutation probability, represents the initial mutation probability, represents the mutation weight, T represents the maximum number of parameter searches;
[0056] Step S46: mutation operation, represented as follows:
[0057] ;
[0058] in, Indicates the parameter position after mutation;
[0059] Step S47: Design start and stop rules, perform parameter search at parameter search points, calculate the fitness of the searched parameter points after each parameter search, if the fitness of more than 70% of the parameter search points has not been improved compared with the previous search, perform abnormal mutation operation, and then perform the next parameter search, otherwise directly perform the next search; when the fitness of the searched parameter point is greater than the qualified fitness value, the search ends and the parameter with the highest fitness is output; when the number of searches is greater than the maximum number of searches, re-optimize the initial settings and search again.
[0060] Furthermore, in step S5, the defect detection is to collect image data of the pallet in real time, input the pallet defect detection model, the model detects the real-time pallet image, outputs the type of the pallet, and when the type of the pallet is a defective pallet, marks the location of the defect.
[0061] The present invention provides a pallet defect detection system based on deep learning, comprising a data preparation module, an image processing module, a pallet defect detection model building module, a global tuning module and a defect detection module;
[0062] The data preparation module first collects pallet images, the types of which include normal pallets and defective pallets; then annotates the images, annotates the types of pallet images and defect locations in the images, and sends the data to the image processing module;
[0063] The image processing module receives the data sent by the data preparation module, processes the image data, and sends the data to the pallet defect detection model building module;
[0064] The pallet defect detection model building module receives the data sent by the image processing module, builds the pallet defect detection model module, and sends the data to the global tuning module;
[0065] The global tuning module receives data sent by the pallet defect detection model building module, optimizes the parameters of the model, and sends the data to the defect detection module;
[0066] The defect detection module receives data sent by the global tuning module, collects image data of the pallet in real time, uses the pallet defect detection model to check the type of the pallet, and marks the location of the defect when the type of the pallet is a defective pallet.
[0067] The beneficial effects achieved by the present invention using the above scheme are as follows:
[0068] (1) To address the problems of noise sensitivity, loss of detail information, and insufficient feature extraction in traditional image processing methods for pallet defect detection, this solution effectively enhances the detail information of the defect area through multi-scale morphological decomposition, adaptive spectral filtering, frequency domain inverse transform, definition of scale weights, and filter fusion, while suppressing background noise, thereby enhancing image quality and improving the accuracy of defect detection.
[0069] (2) To address the problems of poor adaptability of static convolution kernels, insufficient multi-scale feature fusion, and information loss in pooling operations in traditional convolutional neural networks in pallet defect detection, this scheme defines dynamic convolution weights, constructs a dynamic convolution generator, designs a feature fusion module, designs a dynamic pooling layer, and designs a loss function. It can dynamically generate convolution kernels according to the local context of the input feature map, thereby enhancing the model's ability to capture complex defect features, improving the adaptability of detection, and better capturing the global and local information of pallet defects, thereby improving the comprehensiveness of detection and improving the model's training effect and detection performance.
[0070] (3) To address the problems of low search efficiency and poor parameter adaptability of traditional parameter tuning methods in the optimization of pallet defect detection models, this scheme dynamically adjusts the search strategy by tuning the initial settings, defining spatial adaptation factors, parameter search, evaluating fitness, mutation operations, and designing start and stop rules to ensure the adaptability and stability of parameter tuning and avoid invalid searches, thereby improving the efficiency, global search capability, and adaptability of pallet defect detection model parameter tuning. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 A schematic diagram of a pallet defect detection method based on deep learning provided by the present invention;
[0072] Figure 2 A schematic diagram of a pallet defect detection system based on deep learning provided by the present invention;
[0073] Figure 3 It is a schematic diagram of image processing;
[0074] Figure 4 Schematic diagram for building a pallet defect detection model;
[0075] Figure 5 Schematic diagram of global tuning.
[0076] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0077] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0078] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.
[0079] Example 1, see Figure 1 The present invention provides a pallet defect detection method based on deep learning, which comprises the following steps:
[0080] Step S1: Data preparation, firstly collecting pallet images, wherein the types of pallet images include normal pallets and defective pallets; then annotating the images, annotating the types of pallet images and defect locations in the images;
[0081] Step S2: image processing, image processing is performed through multi-scale morphological decomposition, adaptive spectrum filtering, frequency domain inverse transformation, definition of scale weights and filter fusion;
[0082] Step S3: constructing a pallet defect detection model by defining dynamic convolution weights, constructing a dynamic convolution generator, designing a feature fusion module, designing a dynamic pooling layer, and designing a loss function;
[0083] Step S4: global tuning, which is performed by tuning the initial settings, defining spatial adaptation factors, parameter search, evaluating fitness, mutation operations, and designing start and stop rules;
[0084] Step S5: Defect detection, real-time image data of the pallet is collected and input into the pallet defect detection model. The model detects the real-time pallet image and outputs the type of the pallet. When the type of the pallet is a defective pallet, the location of the defect is marked.
[0085] Example 2, see Figure 1 and Figure 3 This embodiment is based on the above embodiment, and the image processing specifically includes the following steps:
[0086] Step S21: multi-scale morphological decomposition, expressed as follows:
[0087] ;
[0088] in, Represents the index of the image scale, a and b represent the coordinate row index and column index of the image respectively. Represents the image The scale decomposition results are represents the scale-weighted fusion operator, represents the original image, Indicates A square kernel of size , Represents the use of square kernel Perform opening operation on the original image. Represents the use of square kernel Perform a closing operation on the original image. Represents a compound operator;
[0089] Step S22: Adaptive spectrum filtering, expressed as follows:
[0090] ;
[0091] Among them, u and v represent the frequency domain coordinate index of the image, Indicates The Fourier transform result of the image at each scale is: represents Fourier transform, Represents the image Perform Fourier transform, represents an adaptive frequency domain filter, represents an exponential function with a natural constant as base, and represent the row and column coordinates of the center of the frequency domain, respectively. represents the bandwidth of the filter, represents the adaptive gain parameter, represents the local signal-to-noise ratio, which is defined as the ratio of the spectrum energy to the noise energy. Express The result after filtering;
[0092] Step S23: frequency domain inverse transformation, expressed as follows:
[0093] ;
[0094] in, represents the first The filtered image of scales, represents the inverse frequency domain transform, Represents the frequency domain image Perform inverse frequency domain transform;
[0095] Step S24: define the scale weight, which is expressed as follows:
[0096] ;
[0097] in, represents the scale weight of the slth scale, Indicates taking the absolute value, Representing images The gradient of represents the filtered image of the gth scale after the inverse frequency domain transform, Representing images The gradient of
[0098] Step S25: filtering fusion, which is expressed as follows:
[0099] ;
[0100] in, Represents the image after filtering and fusion.
[0101] By performing the above operations, in order to address the problems of noise sensitivity, loss of detail information, and insufficient feature extraction in traditional image processing methods in pallet defect detection, this solution effectively enhances the detail information of the defective area through multi-scale morphological decomposition, adaptive spectral filtering, frequency domain inverse transform, definition of scale weights and filter fusion, while suppressing background noise, thereby enhancing the image quality and improving the accuracy of defect detection.
[0102] Example 3, see Figure 1 and Figure 4 This embodiment is based on the above embodiment, and the construction of the pallet defect detection model specifically includes the following steps:
[0103] Step S31: Define dynamic convolution weights, as shown below:
[0104] ;
[0105] Among them, i and j represent the row index and column index of the spatial position of the feature map, respectively, and m and n represent the row index and column index of the basic convolution kernel, respectively. represents the dynamic convolution weight, represents the normalized exponential function, P and Q represent the width and height of the local neighborhood, p and q represent the offset of the local neighborhood in the row direction and column direction respectively, represents the basic weight matrix, Indicates that the feature map is at position The eigenvalue at represents the base bias;
[0106] Step S32: construct a dynamic convolution generator, which is expressed as follows:
[0107] ;
[0108] Among them, x and y represent the row index and column index of the spatial position inside the convolution kernel, respectively. Indicates the position in the feature map The spatial position inside the dynamic convolution kernel generated at The value at , M and N represent the maximum number of rows and columns of the basic convolution kernel, respectively. Represents the spatial position inside the basic convolution kernel of the mth row and nth column The value at Represents the convolution bias term;
[0109] Step S33: Design a feature fusion module, as shown below:
[0110] ;
[0111] in, Indicates that the feature map after feature fusion is at position The value at represents the maximum scale of the feature map, Indicates The characteristic coefficient of the scale, represents the resizing function, represents the feature map, Indicates that the feature map Adjust to target size , represents element-by-element multiplication, represents the hyperbolic tangent function, and Represent the scale fusion weight and bias respectively;
[0112] Step S34: Design a dynamic pooling layer, as shown below:
[0113] ;
[0114] in, Indicates that the feature map after the pooling operation is at position The value at, c1 and c2 represent the row index and column index of the pooling window, represents the pooling window, Indicates the input feature map at the pooling window position ( ), represents the sigmoid function, represents the mask weight, represents the mask bias;
[0115] Step S35: Design a loss function, which is expressed as follows:
[0116] ;
[0117] in, Represents the loss value of the model, represents the cross entropy loss, Indicates The feature map of each scale is at position The value at Represents the first The feature map of each scale is at position The value at It means taking the square of L2 norm.
[0118] By performing the above operations, in order to address the problems of poor adaptability of static convolution kernels, insufficient multi-scale feature fusion, and information loss in pooling operations in traditional convolutional neural networks in pallet defect detection, this solution defines dynamic convolution weights, constructs a dynamic convolution generator, designs a feature fusion module, designs a dynamic pooling layer, and designs a loss function. It can dynamically generate convolution kernels according to the local context of the input feature map, thereby enhancing the model's ability to capture complex defect features, improving the adaptability of detection, and better capturing the global and local information of pallet defects, thereby improving the comprehensiveness of detection and improving the training effect and detection performance of the model.
[0119] Example 4, see Figure 1 and Figure 5 This embodiment is based on the above embodiment, and the global tuning specifically includes the following steps:
[0120] Step S41: Optimizing initial settings and determining tuning parameters, including creating a parameter search space, randomly generating initial parameter search points in the parameter space, setting a maximum number of parameter searches, and setting a parameter fitness qualification value;
[0121] Step S42: define the spatial adaptation factor, which is expressed as follows:
[0122] ;
[0123] Among them, o and r represent the index of the parameter search point, t represents the number of parameter searches, represents the spatial adaptation factor of the oth parameter search point during the t+1th parameter search, represents the spatial adaptation factor of the oth parameter search point during the tth parameter search, represents the spatial adaptation coefficient, Represents the spatial adaptation factor of the rth parameter search point during the tth parameter search;
[0124] Step S43: parameter search, expressed as follows:
[0125] ;
[0126] in, It indicates the parameter point searched by the oth parameter search point in the t+1th parameter search. It indicates the parameter point searched by the oth parameter search point in the tth parameter search. and represents the search adjustment coefficient, It represents the parameter point searched by the rth parameter search point in the tth parameter search. Indicates the maximum value of the spatial adaptation factor, Indicates the parameter point with the highest fitness;
[0127] Step S44: Evaluate the fitness, and set the inverse of the loss function value of the model as the fitness of the parameter point;
[0128] Step S45: define the mutation probability, which is expressed as follows:
[0129] ;
[0130] Where D represents the mutation probability, represents the initial mutation probability, represents the mutation weight, T represents the maximum number of parameter searches;
[0131] Step S46: mutation operation, represented as follows:
[0132] ;
[0133] in, Indicates the parameter position after mutation;
[0134] Step S47: Design start and stop rules, perform parameter search at parameter search points, calculate the fitness of the searched parameter points after each parameter search, if the fitness of more than 70% of the parameter search points has not been improved compared with the previous search, perform abnormal mutation operation, and then perform the next parameter search, otherwise directly perform the next search; when the fitness of the searched parameter point is greater than the qualified fitness value, the search ends and the parameter with the highest fitness is output; when the number of searches is greater than the maximum number of searches, re-optimize the initial settings and search again.
[0135] By performing the above operations, in order to address the problems of low search efficiency and poor parameter adaptability of traditional parameter tuning methods in the optimization of pallet defect detection models, this solution dynamically adjusts the search strategy by tuning the initial settings, defining spatial adaptation factors, parameter search, evaluating fitness, mutation operations and designing start and stop rules to ensure the adaptability and stability of parameter tuning, avoid invalid searches, and improve the efficiency, global search capability and adaptability of pallet defect detection model parameter tuning.
[0136] Example 5, see Figure 1 and Figure 2 , this embodiment is based on the above embodiment, and a pallet defect detection system based on deep learning provided by the present invention includes a data preparation module, an image processing module, a pallet defect detection model building module, a global tuning module and a defect detection module;
[0137] The data preparation module first collects pallet images, the types of which include normal pallets and defective pallets; then annotates the images, annotates the types of pallet images and defect locations in the images, and sends the data to the image processing module;
[0138] The image processing module receives the data sent by the data preparation module, processes the image data, and sends the data to the pallet defect detection model building module;
[0139] The pallet defect detection model building module receives the data sent by the image processing module, builds the pallet defect detection model module, and sends the data to the global tuning module;
[0140] The global tuning module receives data sent by the pallet defect detection model building module, optimizes the parameters of the model, and sends the data to the defect detection module;
[0141] The defect detection module receives data sent by the global tuning module, collects image data of the pallet in real time, uses the pallet defect detection model to check the type of the pallet, and marks the location of the defect when the type of the pallet is a defective pallet.
[0142] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0143] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.
[0144] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.
Claims
1. A pallet defect detection method based on deep learning, characterized in that: The method comprises the following steps: Step S1: Data preparation, firstly collecting pallet images, wherein the types of pallet images include normal pallets and defective pallets; then annotating the images, annotating the types of pallet images and defect locations in the images; Step S2: image processing, image processing is performed by multi-scale morphological decomposition, adaptive spectrum filtering, frequency domain inverse transformation, definition of scale weights and filter fusion; Among them, the multi-scale morphological decomposition is expressed as follows: ; in, Represents the index of the image scale, a and b represent the coordinate row index and column index of the image respectively. Represents the image The scale decomposition results are represents the scale-weighted fusion operator, represents the original image, Indicates A square kernel of size , Represents the use of square kernel Perform opening operation on the original image. Represents the use of square kernel Perform a closing operation on the original image. Represents a compound operator; Step S3: constructing a pallet defect detection model by defining dynamic convolution weights, constructing a dynamic convolution generator, designing a feature fusion module, designing a dynamic pooling layer, and designing a loss function; Step S4: global tuning, which is performed by tuning the initial settings, defining spatial adaptation factors, parameter search, evaluating fitness, mutation operations, and designing start and stop rules; Step S5: Defect detection, real-time image data of the pallet is collected and input into the pallet defect detection model. The model detects the real-time pallet image and outputs the type of the pallet. When the type of the pallet is a defective pallet, the location of the defect is marked.
2. The method for pallet defect detection based on deep learning according to claim 1, characterized in that: In step S2, the image processing is performed by multi-scale morphological decomposition, adaptive spectrum filtering, frequency domain inverse transformation, definition of scale weights and filter fusion, specifically including the following steps: Step S21: multi-scale morphological decomposition; Step S22: Adaptive spectrum filtering, expressed as follows: ; Among them, u and v represent the frequency domain coordinate index of the image, Indicates The Fourier transform result of the image at each scale is: represents Fourier transform, Represents the image Perform Fourier transform, represents an adaptive frequency domain filter, represents an exponential function with a natural constant as base, and represent the row and column coordinates of the center of the frequency domain, respectively. represents the bandwidth of the filter, represents the adaptive gain parameter, represents the local signal-to-noise ratio, which is defined as the ratio of the spectrum energy to the noise energy. Express The result after filtering; Step S23: frequency domain inverse transformation, expressed as follows: ; in, represents the first The filtered image of scales, represents the inverse frequency domain transform, Represents the frequency domain image Perform inverse frequency domain transform; Step S24: define the scale weight, which is expressed as follows: ; in, represents the scale weight of the slth scale, Indicates taking the absolute value, Representing images The gradient of represents the filtered image of the gth scale after the inverse frequency domain transform, Representing images The gradient of Step S25: filtering fusion, which is expressed as follows: ; in, Represents the image after filtering and fusion.
3. The method for pallet defect detection based on deep learning according to claim 1, characterized in that: In step S3, the pallet defect detection model is constructed by defining dynamic convolution weights, constructing a dynamic convolution generator, designing a feature fusion module, designing a dynamic pooling layer, and designing a loss function. Specifically, the pallet defect detection model is constructed, and the steps are as follows: Step S31: Define dynamic convolution weights, as shown below: ; Among them, i and j represent the row index and column index of the spatial position of the feature map, respectively, and m and n represent the row index and column index of the basic convolution kernel, respectively. represents the dynamic convolution weight, represents the normalized exponential function, P and Q represent the width and height of the local neighborhood, p and q represent the offset of the local neighborhood in the row direction and column direction respectively, represents the basic weight matrix, Indicates that the feature map is at position The eigenvalue at represents the base bias; Step S32: construct a dynamic convolution generator, which is expressed as follows: ; Among them, x and y represent the row index and column index of the spatial position inside the convolution kernel, respectively. Indicates the position in the feature map The spatial position inside the dynamic convolution kernel generated at The value at , M and N represent the maximum number of rows and columns of the basic convolution kernel, respectively. Represents the spatial position inside the basic convolution kernel of the mth row and nth column The value at Represents the convolution bias term; Step S33: Design a feature fusion module, as shown below: ; in, Indicates that the feature map after feature fusion is at position The value at represents the maximum scale of the feature map, Indicates The characteristic coefficient of the scale, represents the resizing function, represents the feature map, Indicates that the feature map Adjust to target size , represents element-by-element multiplication, represents the hyperbolic tangent function, and Represent the scale fusion weight and bias respectively; Step S34: Design a dynamic pooling layer, as shown below: ; in, Indicates that the feature map after the pooling operation is at position The value at, c1 and c2 represent the row index and column index of the pooling window, represents the pooling window, Indicates the input feature map at the pooling window position ( ), represents the sigmoid function, represents the mask weight, represents the mask bias; Step S35: Design a loss function, which is expressed as follows: ; in, Represents the loss value of the model, represents the cross entropy loss, Indicates The feature map of each scale is at position The value at Represents the first The feature map of each scale is at position The value at It means taking the square of L2 norm.
4. The method for pallet defect detection based on deep learning according to claim 1, characterized in that: In step S4, the global tuning is performed by tuning initial settings, defining spatial adaptation factors, parameter search, evaluating fitness, mutation operations, and designing start and stop rules, specifically including the following steps: Step S41: Optimizing initial settings and determining tuning parameters, including creating a parameter search space, randomly generating initial parameter search points in the parameter space, setting a maximum number of parameter searches, and setting a parameter fitness qualification value; Step S42: define the spatial adaptation factor, which is expressed as follows: ; Among them, o and r represent the index of the parameter search point, t represents the number of parameter searches, represents the spatial adaptation factor of the oth parameter search point during the t+1th parameter search, represents the spatial adaptation factor of the oth parameter search point during the tth parameter search, represents the spatial adaptation coefficient, Represents the spatial adaptation factor of the rth parameter search point during the tth parameter search; Step S43: parameter search, expressed as follows: ; in, It indicates the parameter point searched by the oth parameter search point in the t+1th parameter search. It indicates the parameter point searched by the oth parameter search point in the tth parameter search. and represents the search adjustment coefficient, It represents the parameter point searched by the rth parameter search point in the tth parameter search. Indicates the maximum value of the spatial adaptation factor, Indicates the parameter point with the highest fitness; Step S44: Evaluate the fitness, and set the inverse of the loss function value of the model as the fitness of the parameter point; Step S45: define the mutation probability, which is expressed as follows: ; Where D represents the mutation probability, represents the initial mutation probability, represents the mutation weight, T represents the maximum number of parameter searches; Step S46: mutation operation, represented as follows: ; in, Indicates the parameter position after mutation; Step S47: Design start and stop rules, perform parameter search at parameter search points, calculate the fitness of the searched parameter points after each parameter search, if the fitness of more than 70% of the parameter search points has not been improved compared with the previous search, perform abnormal mutation operation, and then perform the next parameter search, otherwise directly perform the next search; when the fitness of the searched parameter point is greater than the qualified fitness value, the search ends and the parameter with the highest fitness is output; when the number of searches is greater than the maximum number of searches, re-optimize the initial settings and search again.
5. A pallet defect detection system based on deep learning, used to implement a pallet defect detection method based on deep learning as described in any one of claims 1 to 4, characterized in that: It includes data preparation module, image processing module, pallet defect detection model building module, global tuning module and defect detection module; The data preparation module first collects pallet images, the types of which include normal pallets and defective pallets; then annotates the images, annotates the types of pallet images and defect locations in the images, and sends the data to the image processing module; The image processing module receives the data sent by the data preparation module, processes the image data, and sends the data to the pallet defect detection model building module; The pallet defect detection model building module receives the data sent by the image processing module, builds the pallet defect detection model module, and sends the data to the global tuning module; The global tuning module receives data sent by the pallet defect detection model building module, optimizes the parameters of the model, and sends the data to the defect detection module; The defect detection module receives data sent by the global tuning module, collects image data of the pallet in real time, uses the pallet defect detection model to check the type of the pallet, and marks the location of the defect when the type of the pallet is a defective pallet.