A hybrid multi-granularity frequency-based golden finger defect detection method
By using a hybrid multi-fine-grained frequency detection method, residual convolution and frequency attention modules are employed to improve the accuracy and robustness of gold finger defect detection, solving the problems of detection accuracy and stability in complex scenarios and achieving efficient identification of fine-grained defects.
Patent Information
- Application Number
- CN202511157385.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-08-19
AI Technical Summary
Existing gold finger defect detection methods struggle to ensure detection accuracy and stability in complex scenarios such as complex backgrounds, high reflectivity interference, multi-scale targets, and blurred edges.
A gold finger defect detection method based on hybrid multi-fine-grained frequency is adopted. Through residual convolution module, hybrid cross-frequency attention module and decoding structure, multi-scale convolution features are extracted and frequency domain decomposed. Combined with pooling operation and fully connected structure, frequency-enhanced feature map is generated to improve detection accuracy and robustness.
It significantly improves the detection accuracy and stability in complex scenarios such as complex backgrounds, high reflectivity interference, multi-scale targets, and blurred edges, and enhances the detection capability for fine-grained defects such as minor scratches and gaps.
Smart Images

Figure CN120655645B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of gold finger defect detection technology, and in particular to a gold finger defect detection method based on mixed multi-fine-grained frequencies. Background Technology
[0002] In modern electronic manufacturing and assembly, circuit boards, as core components of electronic systems, directly impact the overall product performance and stability through their connection reliability. The gold finger area on the circuit board is a crucial contact point for high-speed electrical connections between the board and other modules; its conductivity and physical integrity are paramount. The gold finger surface is typically a metal plating structure, requiring excellent flatness and smoothness. Defects such as scratches, breaks, oxidation, and foreign matter residue can easily lead to poor contact, increased resistance, or even electrical breakdown, severely affecting the reliability and safety of electronic products. Therefore, defect detection in the gold finger area is a critical step in pre-shipment quality control of circuit boards, possessing significant practical application needs and engineering value.
[0003] Current methods for detecting defects in gold fingers mainly fall into two categories: traditional image processing-based algorithms and intelligent detection algorithms based on deep learning. One approach is defect enhancement based on the HSV (Hue, Saturation, Value) color space and an improved MSECE (Multi-Scale Enhanced Color Enhancement) image enhancement algorithm, combined with Two-pass connected region labeling and area thresholding algorithms for defect identification. This method improves image contrast and has some detection capability for minor defects, but it is prone to false detections in complex backgrounds or areas with unclear boundaries. Another approach starts from image structure, using a network architecture based on ZS (Zhang-Suen) skeleton extraction to extract skeleton line features of the gold finger region for defect identification. This effectively improves the recognition rate of linear cracks, but its response to nonlinear defects and blurred edge regions is weak. A third approach uses least squares for noise fitting and suppression, and introduces a region growing algorithm to detect target defects. This is suitable for extracting speckle-like defects in homogeneous backgrounds, but it exhibits instability when handling multi-scale and multi-morphological defects. Furthermore, based on the classic ResNet50 convolutional neural network, this method integrates a multi-attention mechanism and a pyramid pooling structure, enabling the model to possess cross-scale semantic aggregation capabilities and improving its ability to perceive fine-grained defects in complex scenes. However, this method does not adequately model the structural features of gold fingers, and may still result in misjudgments, especially in cases of metallic mirror highlights or repetitive texture backgrounds. Additionally, considering the structural and distribution characteristics of gold fingers, a boundary extraction algorithm based on Gaussian blur and erosion operations is designed. An adaptive binarization method based on histograms is used to locate the gold finger region, and finally, a transfer learning strategy is combined to achieve defect classification and recognition within the region. This method has strong structural characteristics and good adaptability to regular gold fingers, but its extraction effect is poor for target regions with severe deformation or occlusion interference.
[0004] In the process of realizing this invention, the inventors discovered at least the following problems in the prior art:
[0005] In gold finger defect detection methods, it is difficult to ensure detection accuracy and stability in complex scenarios such as complex backgrounds, high reflectivity interference, multi-scale targets, and blurred edges. Summary of the Invention
[0006] The purpose of this invention is to provide a method for detecting defects in gold fingers based on hybrid multi-fine-grained frequencies, thereby solving the technical problem in existing gold finger defect detection methods that struggle to ensure detection accuracy and stability in complex scenarios such as complex backgrounds, high reflectivity interference, multi-scale targets, and blurred edges. The various technical effects of the preferred solutions among the many technical solutions provided by this invention are detailed below.
[0007] To achieve the above objectives, the present invention provides the following technical solution:
[0008] This invention provides a method for detecting defects in gold fingers based on hybrid multi-fine-grained frequencies, comprising the following steps: S100: Normalizing and enhancing multiple original gold finger images to construct a training dataset and a validation dataset; S200: Encoding the images in the training dataset using three cascaded residual convolutional modules to obtain three first feature maps at different levels; S300: Inputting the three first feature maps into a hybrid cross-frequency attention module, and performing parallel convolutional kernel operations of different sizes to obtain three second feature maps, and inputting each second feature map into a multi-fine-grained frequency attention module to obtain three frequency response feature maps: a low-frequency response map, a mid-frequency response map, and a high-frequency response map; S400: Inputting the three frequency response feature maps into different pooling operation channels respectively. Pooling operations are performed, and the results of the three pooling operations are fed into a fully connected structure. The output results are added along the channel dimension to obtain a frequency attention map, which is then activated to output a dual-path attention map. S500: The dual-path attention map is fused element-wise by addition and then multiplied element-wise with the frequency response feature map to generate a frequency enhancement feature map. S600: Decoding is performed based on the first feature map and the frequency enhancement feature map. The gold finger defect detection neural network is trained using the training dataset, and the model performance of the gold finger defect detection neural network is evaluated and optimized using the validation dataset during the training process. Finally, the trained gold finger defect detection network is obtained. S700: The gold finger image to be detected is input into the trained gold finger defect detection network to obtain the detection result of the gold finger defect.
[0009] Preferably, in step S200, the residual convolution module uses downsampling to increase the feature channel dimension; each residual convolution module includes two 3×3 convolutional layers and one 1×1 convolutional identity mapping residual path, and each convolutional layer has a normalization operation and an activation function.
[0010] Preferably, in step S300, the parallel convolution kernels are 7×7 convolution kernels, 5×5 convolution kernels, and 3×3 convolution kernels, which extract spatial semantic features with large, medium, and small receptive fields through convolution operations, respectively, to obtain three second feature maps: a large receptive field feature map, a medium receptive field feature map, and a small receptive field feature map.
[0011] Preferably, in step S300, the multi-fine-grained frequency attention module decomposes the large receptive field feature map, medium receptive field feature map, and small receptive field feature map using a discrete cosine filter, dividing them into three channels: low frequency, medium frequency, and high frequency, respectively, which correspond to the overall contour, texture structure, and edge transition regions of the image. The module then performs inter-channel multiplication operations with the first feature map at the shallow, medium, and deep levels to obtain the low-frequency response map, medium-frequency response map, and high-frequency response map.
[0012] Preferably, in step S400, the low-frequency response map, mid-frequency response map, and high-frequency response map are respectively input into the minimum pooling operation channel, the average pooling operation channel, and the maximum pooling operation channel for pooling operations, extracting the regional response features of the corresponding frequencies, and inputting them into their respective fully connected structures for feature compression and enhancement.
[0013] Preferably, in step S400, the outputs of the three fully connected structures are added together along the channel dimension to obtain a frequency attention map, which is then activated using the Sigmoid function. The activated frequency attention map is then divided into two paths, and element-wise multiplication and element-wise division operations are performed with the frequency response feature map respectively to output a dual-path attention map.
[0014] Preferably, in step S600, decoding is performed through a decoding structure, which includes a three-level residual upsampling module. Each residual upsampling module performs upsampling to restore spatial resolution through transposed convolution, followed by two 3×3 convolution kernels for extracting fine features, and sets residual connection paths. Each residual upsampling module simultaneously receives two input signals from the frequency-enhanced feature first feature map.
[0015] Preferably, in step S600, the Adam optimizer is selected for parameter updates during the training process, different learning rates are used for the frequency domain correlation layer and the spatial domain correlation layer, and the learning rate is proportionally reduced when the loss on the validation set does not decrease; in addition, the Dropout strategy and L2 regularization term are used during the training process to prevent overfitting, and the Cutout operation is used on some feature maps to enhance the network's robustness to occlusion and interference.
[0016] Preferably, in step S600, the multi-scale knowledge distillation loss function based on cosine similarity is used during training. And perform cosine similarity calculations on multiple feature layers in terms of spatial location. Alignment ensures that the deep structure of the gold finger defect detection neural network remains consistent; during training, spectral preservation supervision is also performed on the features of each frequency band after discrete cosine transform decomposition.
[0017] Preferably, in step S600, the loss function Cosine similarity The expressions are as follows:
[0018] ,
[0019] ,
[0020] Where K represents the number of network layers in the encoding and decoding networks. This represents the k-th layer of the coding network with height . Width is The output tensor, This represents the k-th layer of the decoding network with height . Width is The output tensor, This represents the mapping from the input image to the encoded feature space. , , These represent the number of channels, height, and width of the feature map at layer k, respectively. Represents the cosine distance of the k-th layer in spatial location.
[0021] Implementing one of the above-described technical solutions of the present invention has the following advantages or beneficial effects:
[0022] This invention enhances the network's ability to identify and robust key anomaly regions by employing a hybrid cross-frequency attention module. This module extracts spatial features from different receptive fields through multi-scale convolution and introduces a frequency domain decomposition mechanism to divide the feature map into low-frequency, mid-frequency, and high-frequency components. It also enhances the response of key frequency bands by combining max, average, and min pooling operations, highlighting defect features in high-frequency regions. This effectively suppresses high-reflectivity interference and background texture noise, enhancing the model's ability to detect fine-grained defects such as minor scratches and notches. It significantly improves the detection accuracy and stability in complex scenarios such as complex backgrounds, high-reflectivity interference, multi-scale targets, and blurred edges. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0024] Figure 1 This is a flowchart of a gold finger defect detection method based on mixed multi-fine-grained frequency according to an embodiment of the present invention;
[0025] Figure 2 This is a schematic diagram of the structure of a gold finger defect detection method based on mixed multi-fine-grained frequency according to an embodiment of the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the present invention clearer, various exemplary embodiments described below will be referenced to the accompanying drawings, which form part of the exemplary embodiments, illustrating various exemplary embodiments that may be used to implement the present invention. Unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. It should be understood that they are merely examples of processes, methods, and apparatuses consistent with some aspects of the present invention disclosed as detailed in the appended claims, and other embodiments may be used, or structural and functional modifications may be made to the embodiments listed herein without departing from the scope and spirit of the present invention.
[0027] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," etc., indicate the orientation or positional relationship based on the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the referred element must have a specific orientation, or be constructed and operated in a specific orientation. The terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. The term "multiple" means two or more. The terms "connected" and "linked" should be interpreted broadly, for example, they can be fixed connections, detachable connections, integral connections, mechanical connections, electrical connections, communication connections, direct connections, indirect connections through an intermediate medium, and can be the internal connection of two elements or the interaction relationship between two elements. The term "and / or" includes any and all combinations of one or more of the related listed items. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0028] To illustrate the technical solution described in this invention, specific embodiments are described below, showing only the parts related to the embodiments of this invention.
[0029] Example:
[0030] like Figure 1 , Figure 2As shown, this invention provides a method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies, including the following steps: S100: Normalization and image enhancement operations are performed on multiple original gold finger images (i.e., multiple original images containing gold fingers). Normalization is a technique used to adjust data or features to a specific range or distribution, with the aim of accelerating training, stabilizing gradients, and improving model performance. Image enhancement generates diverse and reasonable training samples by randomly transforming the images, thereby improving the model's generalization ability. Training and validation datasets are constructed. The training dataset is used to train the model, and the validation dataset is used to fine-tune hyperparameters (such as learning rate and number of network layers) and evaluate model performance to avoid overfitting. The validation dataset does not participate in training and is only used to verify the model's performance on unseen data. The ratio between the two can be set according to training needs, such as the validation dataset accounting for 10%-20%. S200: Images from the training dataset are input into three cascaded residual convolutional modules for encoding. These modules address degradation issues in deep network training, while simultaneously improving feature extraction capabilities and training stability. Encoding compresses the input images into low-dimensional, high-order feature representations. The core objective is to extract key information and remove redundancy, transforming the original image data into a task-relevant, compact representation. This results in three different levels of first feature maps: shallow (edges, colors, textures, corners), mid-level (local parts, simple shapes, texture combinations), and deep (global structure). Each residual convolutional module corresponds to one level of first feature map. S300: In this embodiment, the output features of the three first feature maps are simultaneously used in two paths: the skip connections in the decoding stage and the input to the hybrid cross-frequency attention module, achieving multi-path reuse of encoded features. Three first feature maps are input into a hybrid cross-frequency attention module, where parallel convolutional kernels of different sizes are used to generate three second feature maps. These parallel kernels extract features separately and then fuse them for output, improving the model's ability to model multi-scale and multi-morphological features. Each second feature map is then input into a multi-fine-grained frequency attention module to obtain three frequency response feature maps: a low-frequency response map, a mid-frequency response map, and a high-frequency response map. These frequency response feature maps display preferences for different spatial frequencies, providing a frequency domain perspective for model interpretation, robustness analysis, and compression optimization. S400: The three frequency response feature maps are input into different pooling operation channels for pooling operations. The results of the three pooling operations are then fed into a fully connected structure, and the outputs are summed along the channel dimension to obtain a frequency attention map. This is then activated to output a dual-path attention map. S500: The dual-path attention map is fused element-wise by addition and then multiplied element-wise with the frequency response feature map to generate a frequency-enhanced feature map. Preferably, this enhanced feature map is integrated and output using a 3×3 convolutional kernel for subsequent decoding.S600: Decoding is performed based on the first feature map and the frequency-enhanced feature map. The training dataset is used to train the gold finger defect detection neural network. During training, the validation dataset is used to evaluate the model performance of the gold finger defect detection neural network (only the validation set is used to measure model metrics, without adjusting model weights) and to fine-tune it (using feedback from the validation set to modify hyperparameters, early stopping, model selection, etc.). This process improves the model's detection accuracy and stability for gold finger images, ultimately resulting in a fully trained gold finger defect detection network. S700: The gold finger image to be detected is input into the fully trained gold finger defect detection network to obtain the detection results. This embodiment addresses the challenges of diverse defect types, large scale differences, complex image textures, and localized high reflectivity in the gold finger area of circuit boards during actual inspection. It enhances the network's ability and robustness in identifying key anomaly regions by employing a hybrid cross-frequency attention module. This module extracts spatial features from different receptive fields through multi-scale convolution and introduces a frequency domain decomposition mechanism to divide the feature map into low-frequency, mid-frequency, and high-frequency components. It also combines max, average, and min pooling operations to enhance the response in key frequency bands, highlighting defect features in high-frequency regions. This effectively suppresses high-reflectivity interference and background texture noise, enhancing the model's ability to detect fine-grained defects such as minor scratches and notches. It significantly improves detection accuracy and stability in complex scenarios with complex backgrounds, high-reflectivity interference, multi-scale targets, and blurred edges.
[0031] As an optional implementation method, such as Figure 2 As shown, in step S200, the residual convolution module uses downsampling to increase the feature channel dimension, thereby compensating for the loss of spatial information. It can also control the computational load through grouped convolution or depthwise separable convolution, enhancing feature representation capabilities while reducing spatial redundancy. Each residual convolution module includes two 3×3 convolutional layers and one 1×1 convolutional identity mapping residual path. The 3×3 convolutional layers achieve the best balance between parameter efficiency, expressive power, and computational cost, extracting local features and expanding the receptive field through combination. Furthermore, each convolutional layer includes a normalization operation and an activation function. The normalization operation is used to achieve stable training and decelerate convergence, while the activation function enables the network to learn complex patterns.
[0032] As an optional implementation, in step S300, the parallel convolution kernels are 7×7 convolution kernels (the receptive field of one convolution is 49 pixels), 5×5 convolution kernels (the receptive field of one convolution is 25 pixels), and 3×3 convolution kernels (the receptive field of one convolution is 9 pixels). The spatial semantic features with large, medium, and small receptive fields are extracted through convolution operations, respectively, to obtain three second feature maps: a large receptive field feature map, a medium receptive field feature map, and a small receptive field feature map, which correspond to the global, component structure, and local details of the image, respectively.
[0033] As an optional implementation, in step S300, the multi-fine-grained frequency attention module decomposes the large receptive field feature map, medium receptive field feature map, and small receptive field feature map using a Discrete Cosine Transform Filter (DCT filter, a frequency domain filter constructed based on discrete cosine transform, which converts image blocks of spatial signals into frequency domain coefficients through two-dimensional discrete cosine transform). These are divided into three channels: low frequency, medium frequency, and high frequency (image energy is mainly concentrated in the low frequency, while the high frequency is mostly noise or details). These channels correspond to the overall contour, texture structure, and edge abrupt change regions of the image. Specifically, the 7×7 large receptive field branch is dedicated to handling low-frequency global contour defects (such as large-area oxidation and overall deformation), and the 5×5 medium receptive field branch... The system handles mid-frequency texture defects (such as surface scratches and texture anomalies) and high-frequency edge defects (such as micro-cracks and edge burrs) with a 3×3 small receptive field branch, thereby solving the technical problem of specialized processing for defects with different frequency characteristics. The system also performs inter-channel multiplication operations with the first feature map at three levels: shallow, middle, and deep, to obtain the low-frequency response map (obtained by inter-channel multiplication of the large receptive field feature map with the first feature map in the shallow layer), the mid-frequency response map (obtained by inter-channel multiplication of the middle receptive field feature map with the first feature map in the middle layer), and the high-frequency response map (obtained by inter-channel multiplication of the small receptive field feature map with the first feature map in the deep layer).
[0034] As an optional implementation, in step S400, the low-frequency response map, mid-frequency response map, and high-frequency response map are input into the minimum pooling operation channel, average pooling operation channel, and maximum pooling operation channel, respectively, for pooling operations. Minimum pooling avoids the averaging of subtle changes in low-frequency global defect detection, average pooling reduces noise interference in mid-frequency texture defects, and maximum pooling prevents the suppression of weak signals in high-frequency edge defects. The corresponding frequency region response features are extracted and input into their respective fully connected structures for feature compression and enhancement to improve model efficiency and expressive power. In this embodiment, each pooling operation branch contains two fully connected layers.
[0035] As an optional implementation, in step S400, the outputs of the three fully connected structures are summed in the channel dimension to obtain a frequency attention map. The frequency attention map performs weighted processing on the features in the frequency domain, highlighting key frequency components and suppressing redundant or noisy frequency bands, thereby enhancing the model's ability to perceive the spectral structure. It is then activated by the Sigmoid function, mapping any real number input to (0, 1). The activated frequency attention map is then divided into two paths, and element-wise multiplication and element-wise division operations are performed with the frequency response feature map, respectively, to output a dual-path attention map. The multiplication operation amplifies the abnormal feature response, and the division operation suppresses background noise interference, thereby forming a bidirectional modulation mechanism for abnormal regions.
[0036] As an optional implementation, decoding is performed using a decoding structure in step S600, such as... Figure 2 As shown, the decoding structure includes a three-level residual upsampling module. Residual connections are used to bring high-frequency details in low-resolution features to high-resolution space without loss, avoiding edge blurring and information loss caused by interpolation / transposed convolution. Each residual upsampling module restores spatial resolution by upsampling through transposed convolution (by exchanging the roles of forward / backward propagation, mapping low-resolution input to high-resolution output, and achieving learnable upsampling). It is followed by two 3×3 convolutional kernels for extracting fine features and setting residual connection paths. Residual connections enhance attention and control weights, enabling deep networks to learn quickly and stably. Each residual upsampling module simultaneously receives two input signals: a first feature map of frequency enhancement features (in this embodiment, the first feature map is fused through skip connections, which fuse the high-resolution features (spatial details) in the encoder with the upsampled features (semantic information) in the decoder to compensate for the loss of spatial information caused by downsampling, improve segmentation / reconstruction accuracy, make the segmentation edges sharper and small targets not disappear, and the encoder features are cropped to the same size as the decoder features and then spliced to achieve skip connections). This enables the complementary fusion of the enhanced information after frequency domain processing and the original spatial detail information to improve the edge restoration quality.
[0037] As an optional implementation, in step S600, the training process selects the Adam optimizer (Adaptive Moment Estimation, which automatically adjusts the learning step size of each parameter through momentum and adaptive learning rate, balancing fast convergence and stable training) for parameter updates. Different learning rates are used for the frequency domain correlation layer and the spatial domain correlation layer. The initial learning rate is set to 0.001, and the learning rate is proportionally reduced when the validation set loss does not decrease. Since the frequency domain and spatial domain modules have different convergence characteristics, a smaller learning rate is used for the frequency domain correlation layer to maintain the stability of the frequency domain features, while a standard learning rate is used for the spatial domain correlation layer to ensure the learning efficiency of the spatial domain features, thus avoiding instability in the frequency domain feature training process. Furthermore, the training process employs Dropout and L2 regularization to prevent overfitting. Dropout reduces variance by averaging the model and randomly shuts down neurons to break co-fitting. L2 regularization reduces bias by shrinking weights and penalizes large weights to prevent overfitting. By first controlling the weight scale with L2 and then randomly perturbing the activation with Dropout, overfitting can be significantly reduced. Cutout operations are also used on some feature maps to enhance the network's robustness to occlusion and interference. The Cutout operation randomly occludes a rectangular region (setting pixel values to 0) on the input image, allowing the network to learn using image context information rather than local features, thereby improving generalization ability. It can also be combined with Mixup and AutoAugment operations to further enhance robustness.
[0038] As an optional implementation, in step S600, the multi-scale knowledge distillation loss function based on cosine similarity is used during training. That is, at multiple spatial scales, cosine similarity is used to measure the directional consistency of teacher and student features, weakening absolute numerical differences and strengthening structural consistency rather than numerical fitting, thereby improving the generalization ability of student models; and cosine similarity is applied to multiple feature layers in terms of spatial location. Alignment ensures the consistency of the deep structural expression of the gold finger defect detection neural network. Cosine similarity alignment forces directional consistency rather than numerical consistency, making it an efficient and robust optimization objective during learning. During training, spectral preservation supervision is also applied to the features of each frequency band after Discrete Cosine Transform (DCT decomposition, which projects time / spatial signals onto a cosine basis to obtain frequency coefficients with highly concentrated energy) to ensure the quality of intermediate feature learning. At the same time, combined with frequency domain consistency constraints, the network maintains the accuracy of frequency domain decomposition while learning multi-scale features in the spatial domain, preventing distortion of frequency domain information during deep propagation and improving the model's adaptability to multi-scale defects and detection accuracy.
[0039] As an optional implementation, in step S600, the loss function Cosine similarity The expressions are as follows:
[0040] ,
[0041] ,
[0042] Where K represents the number of network layers in the encoding and decoding networks. This represents the k-th layer of the coding network with height . Width is The output tensor, This represents the k-th layer of the decoding network with height . Width is The output tensor, This represents the mapping from the input image to the encoded feature space. , , These represent the number of channels, height, and width of the feature map at layer k, respectively. This represents the cosine distance of the k-th layer in spatial location (a larger value indicates a greater anomaly). This loss function guides the decoding network to learn the high-dimensional embedding representation of normal images from the encoding network in both shallow and deep layers by comparing the consistency of the responses of the encoding and decoding networks in multi-layer feature spaces point by point, thereby enabling the decoding network to more sensitively perceive abnormal regions during the inference stage.
[0043] The embodiment is merely a specific example and does not indicate that this is the only way to implement the present invention.
[0044] The above description is merely a preferred embodiment of the present invention. Those skilled in the art will understand that various changes or equivalent substitutions can be made to these features and embodiments without departing from the spirit and scope of the present invention. Furthermore, under the teachings of the present invention, these features and embodiments can be modified to adapt to specific situations and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the protection scope of the present invention.
Claims
1. A method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies, characterized in that, Includes the following steps: S100: Normalize and enhance multiple original gold finger images to construct training and validation datasets; S200: Input the images of the training dataset into three cascaded residual convolutional modules for encoding to obtain first feature maps of three different levels: shallow, middle and deep. S300: Input the three first feature maps into the hybrid cross-frequency attention module, and use parallel convolution kernels of different sizes to obtain three second feature maps. Input each second feature map into the multi-fine-grained frequency attention module to obtain three frequency response feature maps: low-frequency response map, mid-frequency response map, and high-frequency response map. S400: Input the three frequency response feature maps into different pooling operation channels for pooling operations. The results of the three pooling operations are fed into a fully connected structure and the output results are added in the channel dimension to obtain a frequency attention map. After activation, a dual-path attention map is output. S500: The dual-path attention map is fused element-wise by addition and then multiplied element-wise with the frequency response feature map to generate a frequency-enhanced feature map; S600: Decodes based on the first feature map and frequency-enhanced feature map, trains the gold finger defect detection neural network using the training dataset, and evaluates and optimizes the model performance of the gold finger defect detection neural network using the validation dataset during the training process, finally obtaining the trained gold finger defect detection network; S700: Input the image of the gold finger to be detected into the trained gold finger defect detection network to obtain the detection result of the gold finger defect.
2. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 1, characterized in that, In step S200, the residual convolution module uses downsampling to increase the feature channel dimension; each residual convolution module includes two 3×3 convolutional layers and one 1×1 convolutional identity mapping residual path, and each convolutional layer has a normalization operation and an activation function.
3. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 1, characterized in that, In step S300, the parallel convolution kernels are 7×7 convolution kernels, 5×5 convolution kernels, and 3×3 convolution kernels. They extract spatial semantic features with large, medium, and small receptive fields through convolution operations, respectively, to obtain three second feature maps: a large receptive field feature map, a medium receptive field feature map, and a small receptive field feature map.
4. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 3, characterized in that, In step S300, the multi-fine-grained frequency attention module decomposes the large receptive field feature map, medium receptive field feature map, and small receptive field feature map using a discrete cosine filter, dividing them into three channels: low frequency, medium frequency, and high frequency, respectively, which correspond to the overall contour, texture structure, and edge abrupt regions of the image. The module then performs inter-channel multiplication operations with the first feature map at the shallow, medium, and deep layers to obtain the low-frequency response map, medium-frequency response map, and high-frequency response map.
5. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 1, characterized in that, In step S400, the low-frequency response map, mid-frequency response map, and high-frequency response map are respectively input into the minimum pooling operation channel, average pooling operation channel, and maximum pooling operation channel for pooling operations, extracting the regional response features of the corresponding frequencies, and inputting them into their respective fully connected structures for feature compression and enhancement.
6. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 5, characterized in that, In step S400, the outputs of the three fully connected structures are added together along the channel dimension to obtain a frequency attention map, which is then activated by the Sigmoid function. The activated frequency attention map is then divided into two paths, and element-wise multiplication and element-wise division operations are performed with the frequency response feature map respectively to output a dual-path attention map.
7. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 1, characterized in that, In step S600, decoding is performed through a decoding structure, which includes a three-level residual upsampling module. Each residual upsampling module performs upsampling to restore spatial resolution through transposed convolution, followed by two 3×3 convolution kernels for extracting fine features, and sets residual connection paths. Each residual upsampling module simultaneously receives two input signals from the first feature map of the frequency enhancement feature.
8. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 7, characterized in that, In step S600, the Adam optimizer is selected for parameter updates during the training process. Different learning rates are used for the frequency domain correlation layer and the spatial domain correlation layer, and the learning rate is proportionally reduced when the loss on the validation set does not decrease. In addition, the Dropout strategy and L2 regularization term are used during the training process to prevent overfitting, and the Cutout operation is used on some feature maps to enhance the network's robustness to occlusion and interference.
9. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 7, characterized in that, In step S600, the training process uses a multi-scale knowledge distillation loss function based on cosine similarity. And perform cosine similarity calculations on multiple feature layers in terms of spatial location. Alignment ensures that the deep structure of the gold finger defect detection neural network remains consistent; during training, spectral preservation supervision is also performed on the features of each frequency band after discrete cosine transform decomposition.
10. The method for detecting defects in gold fingers based on mixed multi-fine-grained frequencies according to claim 9, characterized in that, In step S600, the loss function Cosine similarity The expressions are as follows: , , Where K represents the number of network layers in the encoding and decoding networks. This represents the k-th layer of the coding network with height . Width is The output tensor, This represents the k-th layer of the decoding network with height . Width is The output tensor, This represents the mapping from the input image to the encoded feature space. , , These represent the number of channels, height, and width of the feature map at layer k, respectively. This represents the cosine distance of the k-th layer in spatial location.
Citation Information
Patent Citations
Deep forgery detection method and corresponding device
CN115311525A
Method and system for restoring a compressed image with raindrops
US20250252721A1