Deep learning method and system for PCB defect detection and storage medium
By using a multi-scale feature dynamic fusion and a dual-branch collaborative detection mechanism, the problem of difficulty in capturing scale features and task interference in PCB board defect detection is solved, enabling accurate classification and localization of defects at different scales, and improving the accuracy and adaptability of detection.
Patent Information
- Application Number
- CN202511739730.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-02-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing PCB board defect detection methods struggle to simultaneously and effectively capture defect features at different scales. Feature fusion strategies cannot be adaptively adjusted, and there is interference between classification and localization tasks, affecting detection accuracy and adaptability.
A multi-scale feature dynamic fusion and dual-branch collaborative detection mechanism is adopted. Multi-scale features are extracted through parallel convolutional layers, and fusion weights are calculated by combining channel attention mechanism. The feature maps are weighted and fused, and the defect classification and localization branches are processed in parallel. A spatial attention mechanism is introduced to strengthen the defect region.
It improves the accuracy and adaptability of PCB board defect detection, and can simultaneously identify defects of multiple scales, from microscopic circuit anomalies to macroscopic component missingness, thereby improving detection efficiency and robustness.
Smart Images

Figure CN121582707A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial inspection technology, and in particular to a deep learning method, system and storage medium for PCB board defect detection. Background Technology
[0002] Printed circuit boards (PCBs), as core components of modern electronic devices, directly impact the reliability and stability of the entire product. During PCB manufacturing, due to the complexity of the process, various types of defects are inevitable, such as open circuits, short circuits, missing components, and misalignments. Traditional inspection methods mainly rely on manual visual inspection or traditional machine vision. The former suffers from low efficiency, fatigue, and strong subjectivity, while the latter has significant limitations in adaptability, generalization ability, and detection rate of minute defects. Although deep learning-based methods have been introduced into this field in recent years, most existing technologies employ single-scale feature analysis, making it difficult to simultaneously and effectively capture defect features at different scales, from microscopic circuit anomalies to macroscopic component missingness. Feature fusion strategies often use fixed weights, failing to adaptively adjust according to specific defect features. Furthermore, the feature interference problem between classification and localization tasks has not been well resolved. These factors collectively limit the accuracy and practicality of existing inspection methods in complex industrial scenarios. Summary of the Invention
[0003] The main objective of this invention is to provide a deep learning method, system, and storage medium for PCB board defect detection. By using multi-scale feature dynamic fusion and a dual-branch collaborative detection mechanism, it aims to achieve accurate classification and localization of PCB board defects, thereby improving the accuracy and adaptability of defect detection in complex industrial scenarios.
[0004] To achieve the above objectives, this invention provides a deep learning method for PCB board defect detection, comprising the following steps: Acquire image data of the PCB board to be inspected; The image data is input into a deep learning feature extraction network, and multi-scale features of the standardized image are extracted synchronously through a group of convolutional layers with convolutional kernels of different sizes set in parallel. The multi-scale features are input into the dynamic feature selection module, and the fusion weights corresponding to each scale feature are adaptively calculated based on the context information of the multi-scale features. The multi-scale features are weighted and fused based on the fusion weights to generate an enhanced feature map; The enhanced feature map is simultaneously input into the defect classification branch and the defect localization branch; The enhanced feature map is classified through the defect localization branch to output the defect type. The enhanced feature map is then processed by the feature enhancement unit in the defect localization branch to highlight the defect region and output the defect location information.
[0005] Further, the steps for acquiring image data of the PCB board to be inspected include: Acquire surface images of the PCB board using image acquisition equipment; The surface image is processed to unify its format and normalize its size, forming image data that meets the requirements of network input.
[0006] Further, the step of inputting the image data into a deep learning feature extraction network and simultaneously extracting multi-scale features of the normalized image through a group of convolutional layers with convolutional kernels of different sizes set in parallel includes: The image data is simultaneously input into multiple pre-set parallel convolutional layers in a deep learning feature extraction network; Each parallel convolutional layer uses a convolutional kernel of a different size to process the image data and extract image features with different levels of detail. Each convolutional layer outputs a feature map of the corresponding scale. The feature maps output by each convolutional layer are combined to form multi-scale features.
[0007] Further, the step of inputting the multi-scale features into the dynamic feature selection module and adaptively calculating the fusion weights corresponding to each scale feature based on the context information of the multi-scale features includes: The correlation between the various feature channels in the multi-scale features is analyzed using a channel attention mechanism; The importance of each feature channel is determined based on the aforementioned correlation; The fusion weights of features at each scale are assigned based on the degree of importance.
[0008] Further, the step of weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map includes: The feature maps at each scale are weighted and calculated with their corresponding fusion weights. The weighted features are optimized by adjusting the channel dimension and recalibrating the feature mapping. The output is an enhanced feature map containing multi-scale information.
[0009] Further, the step of simultaneously inputting the enhanced feature map into both the defect classification branch and the defect localization branch includes: The enhanced feature map is copied into two identical feature map copies; The copy of the first feature map is input into the defect classification branch, which consists of a fully connected layer and a softmax layer; The second feature map copy is input into the defect localization branch, which consists of an upsampling layer and a convolutional layer.
[0010] Further, the step of classifying the enhanced feature map through the defect localization branch and outputting the defect type includes: The input feature map is reduced in dimensionality using a fully connected layer. The probability distribution of various defects is calculated using a softmax classifier; The final defect type is determined based on the maximum probability value.
[0011] Further, the step of processing the enhanced feature map through the feature enhancement unit in the defect localization branch to highlight the defect region and output defect location information includes: The spatial resolution of the feature map is restored through upsampling operations; Enhance the feature response of defective regions using spatial attention mechanisms; The location coordinates of the defect are generated using a boundary regression network.
[0012] This invention also provides a deep learning system for PCB board defect detection, comprising: The data acquisition unit is used to acquire image data of the PCB board to be inspected. The feature extraction unit is used to input the image data into a deep learning feature extraction network and simultaneously extract multi-scale features of the standardized image through a group of convolutional layers with convolutional kernels of different sizes set in parallel. The weight calculation unit is used to input the multi-scale features into the dynamic feature selection module and adaptively calculate the fusion weights corresponding to each scale feature based on the context information of the multi-scale features. The feature enhancement unit is used to perform weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map; A branch processing unit is used to simultaneously input the enhanced feature map into the defect classification branch and the defect localization branch; The classification and localization unit is used to classify the enhanced feature map through the defect localization branch, output the defect type, and process the enhanced feature map through the feature enhancement unit in the defect localization branch to highlight the defect area and output the defect location information.
[0013] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the deep learning method for PCB board defect detection described above.
[0014] The deep learning method, system, and storage medium for PCB board defect detection provided by this invention have the following beneficial effects: This invention effectively solves the problem that single-scale features cannot fully cover the diverse defects of PCB boards by constructing a parallel multi-scale feature extraction network, improving the detection capability for defects of different scales, from micro-line anomalies to large component missingness; it adopts a dynamic feature selection mechanism based on channel attention to overcome the shortcomings of traditional fixed-weight fusion methods in feature utilization efficiency, achieving adaptive optimization of feature combinations based on different defect features; by designing a dual-branch parallel processing architecture for classification and localization, it avoids the drawbacks of mutual interference between the two types of tasks in a single-branch network, and introduces a spatial attention mechanism in the feature enhancement unit to effectively enhance the feature response of defect areas and improve the localization accuracy of small defects. The overall technical solution enables the PCB board defect detection system to maintain high detection efficiency while possessing better adaptability and robustness, better meeting the stringent quality control requirements of the modern electronics manufacturing industry. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating a deep learning method for PCB board defect detection in one embodiment of the present invention. Figure 2 This is a structural block diagram of a deep learning system for PCB board defect detection in one embodiment of the present invention.
[0016] The objectives, features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0018] Reference Figure 1 This is a flowchart illustrating a deep learning method for PCB board defect detection proposed in this invention, comprising the following steps: S1, acquire image data of the PCB board to be inspected; S2, The image data is input into a deep learning feature extraction network, and multi-scale features of the standardized image are extracted synchronously through a group of convolutional layers with convolutional kernels of different sizes set in parallel. S3, input the multi-scale features into the dynamic feature selection module, and adaptively calculate the fusion weights corresponding to each scale feature based on the context information of the multi-scale features; S4, weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map; S5, simultaneously input the enhanced feature map into the defect classification branch and the defect localization branch; S6, the enhanced feature map is classified through the defect localization branch to output the defect type, and the enhanced feature map is processed by the feature enhancement unit in the defect localization branch to highlight the defect area and output the defect location information.
[0019] In one embodiment, for step S1, The steps for acquiring image data of the PCB board to be inspected include: Acquire surface images of the PCB board using image acquisition equipment; The surface image is processed to unify its format and normalize its size, forming image data that meets the requirements of network input.
[0020] In practical implementation, high-resolution industrial image acquisition equipment is used to acquire surface images of the PCB board. This equipment preferably employs a uniform illumination system to ensure consistent lighting conditions during image acquisition, thereby reducing detection errors caused by uneven illumination. After acquiring the raw images, preprocessing is performed: the surface images are format-unified, converting images from different sources into a tensor format suitable for deep learning model processing; simultaneously, size normalization is performed, adjusting the input images to a preset standard size to ensure that the subsequent deep learning feature extraction network can accept input data of uniform specifications and eliminate feature extraction biases caused by differences in image size. This standardized image acquisition and preprocessing process solves the problem of inconsistent image acquisition conditions affecting detection accuracy in real-world industrial environments.
[0021] In one embodiment, for step S2, The steps of inputting the image data into a deep learning feature extraction network and simultaneously extracting multi-scale features of the normalized image through a group of convolutional layers with convolutional kernels of different sizes set in parallel include: The image data is simultaneously input into multiple pre-set parallel convolutional layers in a deep learning feature extraction network; Each parallel convolutional layer uses a convolutional kernel of a different size to process the image data and extract image features with different levels of detail. Each convolutional layer outputs a feature map of the corresponding scale. The feature maps output by each convolutional layer are combined to form multi-scale features.
[0022] In practical implementation, preprocessed standardized image data is input in parallel into multiple pre-configured convolutional layers in the feature extraction network. These convolutional layers employ convolutional kernels of different sizes. Smaller kernels focus on extracting local detail features of the image, such as microscopic structural information like line edges and solder joint textures; medium-sized kernels are responsible for capturing regional features, including mesoscopic patterns such as line routing and component layout; and larger kernels focus on extracting global features, such as macroscopic features like the wiring patterns and component distribution of the entire PCB board. This parallel multi-path feature extraction architecture enables the network to simultaneously acquire comprehensive feature information from microscopic to macroscopic levels. After feature extraction, each convolutional layer outputs feature maps at corresponding scales. These feature maps are then stitched and fused along the channel dimension to form a composite multi-scale feature containing rich hierarchical information. This embodiment effectively addresses the limitations of traditional single-scale feature extraction methods when facing diverse defects on PCB boards, particularly by simultaneously detecting defects at multiple scales, from minor short circuits and open circuits to larger defects such as missing or misaligned components, significantly improving the adaptability and robustness of the detection system.
[0023] In one embodiment, for step S3, The step of inputting the multi-scale features into the dynamic feature selection module and adaptively calculating the fusion weights corresponding to each scale feature based on the context information of the multi-scale features includes: The correlation between the various feature channels in the multi-scale features is analyzed using a channel attention mechanism; The importance of each feature channel is determined based on the aforementioned correlation; The fusion weights of features at each scale are assigned based on the degree of importance.
[0024] In practical implementation, the multi-scale features generated in step S2 are subjected to in-depth analysis. The relative importance of each channel feature is evaluated by establishing global dependencies between feature channels. Specifically, the dynamic feature selection module compresses the spatial dimension of each feature channel through global average pooling, generates channel-level statistical descriptors, and constructs a correlation model between channels through fully connected layers and nonlinear activation functions. Based on this model, the most critical feature channels for the current PCB board defect detection task are accurately identified: for example, when detecting micro-line defects, feature channels carrying high-frequency detail information are given higher importance; while when identifying large-area soldering anomalies, feature channels containing regional semantic information are more important. According to this dynamically evaluated importance, appropriate fusion weights are assigned to features of different scales, realizing adaptive feature optimization for specific detection scenarios. This embodiment effectively overcomes the limitations of traditional fixed-weight fusion methods in handling diverse PCB defects through an intelligent weight allocation mechanism, ensuring that features that contribute more to the current detection task are fully emphasized in the final feature fusion process, thereby improving the recognition accuracy of various defects and the system's generalization ability.
[0025] In one embodiment, for step S4, The step of weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map includes: The feature maps at each scale are weighted and calculated with their corresponding fusion weights. The weighted features are optimized by adjusting the channel dimension and recalibrating the feature mapping. The output is an enhanced feature map containing multi-scale information.
[0026] In the specific implementation, the fusion weights calculated by the dynamic feature selection module are weighted channel-by-channel with the corresponding multi-scale feature maps. Each channel of each scale feature map is multiplied by its importance weight to ensure that useful information in features at different scales is reasonably preserved while suppressing interference from redundant or noisy features. After weighting, a 1×1 convolution kernel is used to adjust the channel dimensions, achieving uniformity in the number of feature channels and establishing a cross-scale feature interaction mechanism to enable effective flow of semantic information between features at different scales. Through feature mapping recalibration—that is, using nonlinear transformation combined with feature normalization—the fused features are optimized to improve the quality of feature representation and make key defect features more prominent. The final enhanced feature map deeply fuses feature information from different scales, including detailed local texture features and macroscopic semantic features, forming a feature representation with rich hierarchical information. This feature fusion method solves the problems of information redundancy and feature conflicts caused by simple splicing or addition of multi-scale features in traditional methods.
[0027] In one embodiment, for step S5, The step of simultaneously inputting the enhanced feature map into the defect classification branch and the defect localization branch includes: The enhanced feature map is copied into two identical feature map copies; The copy of the first feature map is input into the defect classification branch, which consists of a fully connected layer and a softmax layer; The second feature map copy is input into the defect localization branch, which consists of an upsampling layer and a convolutional layer.
[0028] In the specific implementation, the enhanced feature map generated in step S4 is copied into two identical feature map copies. This copying operation ensures the complete preservation of the original feature information, providing a completely consistent feature foundation for subsequent parallel classification and localization tasks. The first feature map copy is fed into the classification branch, which is dedicated to defect type identification. This branch consists of a fully connected layer and a softmax layer. The fully connected layer flattens the two-dimensional feature map into a one-dimensional feature vector and performs non-linear transformations, while the softmax layer calculates the probability of multi-class defects based on these high-level semantic features. Simultaneously, the second feature map copy is input into the localization branch, which processes spatial information. This branch gradually restores the spatial resolution of the feature map through upsampling operations and refines the features using subsequent convolutional layers to accurately capture the boundary information and location features of defects. This dual-branch parallel architecture achieves a balance between feature extraction and task decoupling: the classification branch focuses on identifying defect categories from global features, while the localization branch concentrates on processing spatial details to determine the defect location. The two branches are both relatively independent and complementary. This embodiment effectively overcomes the feature interference problem that occurs when traditional single-branch networks process classification and localization tasks simultaneously by using a dual-branch parallel architecture, ensuring accurate identification of various defects while also ensuring precise location of the defects.
[0029] In one embodiment, for step S6, The steps of classifying the enhanced feature map and outputting the defect type through the defect localization branch include: The input feature map is reduced in dimensionality using a fully connected layer. The probability distribution of various defects is calculated using a softmax classifier; The final defect type is determined based on the maximum probability value.
[0030] In practical implementation, a fully connected layer performs intelligent feature dimensionality reduction on the input feature map, transforming the high-dimensional two-dimensional feature map into a one-dimensional feature vector containing rich semantic information, thus achieving data dimensionality normalization. Furthermore, the non-linear combination capability of the fully connected layer extracts the most discriminative high-level features for the classification task. The refined features are then input into a softmax classifier for deep analysis. This classifier establishes a precise mapping relationship between input features and defect types by calculating the probability distribution of each preset defect category. The probability value is calculated based on the relative distance between the feature and each category prototype in the feature space. By selecting the defect category corresponding to the highest probability value as the final judgment result, the statistical optimality of the classification result is ensured. The entire classification process in this embodiment fully leverages the advantages of deep learning in feature learning and pattern recognition, considering both the distribution characteristics of various defects in the feature space and providing a reliable confidence basis for decision-making through probabilistic output.
[0031] In one embodiment, the step of processing the enhanced feature map through the feature enhancement unit in the defect localization branch to highlight the defect region and output defect location information includes: The spatial resolution of the feature map is restored through upsampling operations; Enhance the feature response of defective regions using spatial attention mechanisms; The location coordinates of the defect are generated using a boundary regression network.
[0032] In practical implementation, the spatial resolution of the feature map is gradually restored through upsampling operations. A combination of transposed convolution and bilinear interpolation is used to reconstruct the low-resolution feature map, which has undergone multiple downsampling steps, into a high-resolution feature space, thus compensating for the spatial information loss caused by pooling operations in deep convolutional networks. A spatial attention mechanism is introduced to intelligently enhance the reconstructed feature map. By analyzing the importance differences of various spatial locations in the feature map, corresponding spatial weight masks are generated, enabling the network to autonomously focus on potential defect regions while suppressing background noise interference, thereby enhancing the feature contrast between defective and normal regions. A designed boundary regression network performs deep analysis on the enhanced features. This network generates multiple candidate regions based on an anchor point mechanism and precisely adjusts the boundary coordinates of these regions through regression calculations, ultimately outputting the defect location information, including bounding box coordinates or defect region masks. This multi-stage localization strategy leverages the advantages of deep learning in feature representation and spatial reasoning, maintaining the semantic richness of the feature map while restoring necessary spatial detail information, effectively solving the problem of insufficient accuracy in locating small defects in traditional detection methods.
[0033] Reference Figure 2 Here is a structural block diagram of a deep learning system for PCB board defect detection according to an embodiment of the present invention, comprising: The data acquisition unit is used to acquire image data of the PCB board to be inspected. The feature extraction unit is used to input the image data into a deep learning feature extraction network and simultaneously extract multi-scale features of the standardized image through a group of convolutional layers with convolutional kernels of different sizes set in parallel. The weight calculation unit is used to input the multi-scale features into the dynamic feature selection module and adaptively calculate the fusion weights corresponding to each scale feature based on the context information of the multi-scale features. The feature enhancement unit is used to perform weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map; A branch processing unit is used to simultaneously input the enhanced feature map into the defect classification branch and the defect localization branch; The classification and localization unit is used to classify the enhanced feature map through the defect localization branch, output the defect type, and process the enhanced feature map through the feature enhancement unit in the defect localization branch to highlight the defect area and output the defect location information.
[0034] For the specific implementation of each unit in the above device example, please refer to the method embodiments described above, and will not be repeated here.
[0035] An embodiment of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0036] In summary, this invention acquires image data of a PCB board to be inspected; inputs the image data into a deep learning feature extraction network, and simultaneously extracts multi-scale features of the standardized image through a group of convolutional layers with convolutional kernels of different sizes set in parallel; inputs the multi-scale features into a dynamic feature selection module, and adaptively calculates the fusion weights corresponding to each scale feature based on the context information of the multi-scale features; performs weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map; inputs the enhanced feature map into both a defect classification branch and a defect localization branch; classifies the enhanced feature map through the defect localization branch and outputs the defect type; and processes the enhanced feature map through the feature enhancement unit in the defect localization branch to highlight the defect region and output the defect location information, thereby achieving accurate classification and localization of PCB board defects and improving the accuracy and adaptability of defect detection in complex industrial scenarios.
[0037] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the present invention and embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM, etc.
[0038] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0039] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A deep learning method for PCB board defect detection, characterized in that, Includes the following steps: Acquire image data of the PCB board to be inspected; The image data is input into a deep learning feature extraction network, and multi-scale features of the standardized image are extracted synchronously through a group of convolutional layers with convolutional kernels of different sizes set in parallel. The multi-scale features are input into the dynamic feature selection module, and the fusion weights corresponding to each scale feature are adaptively calculated based on the context information of the multi-scale features. The multi-scale features are weighted and fused based on the fusion weights to generate an enhanced feature map; The enhanced feature map is simultaneously input into the defect classification branch and the defect localization branch; The enhanced feature map is classified through the defect localization branch to output the defect type. The enhanced feature map is then processed by the feature enhancement unit in the defect localization branch to highlight the defect region and output the defect location information.
2. The deep learning method for PCB board defect detection according to claim 1, characterized in that, The step of acquiring image data of the PCB board to be inspected includes: Acquire surface images of the PCB board using image acquisition equipment; The surface image is processed to unify its format and normalize its size, forming image data that meets the requirements of network input.
3. The deep learning method for PCB board defect detection according to claim 1, characterized in that, The step of inputting the image data into a deep learning feature extraction network and simultaneously extracting multi-scale features of the normalized image through a group of convolutional layers with convolutional kernels of different sizes set in parallel includes: The image data is simultaneously input into multiple pre-set parallel convolutional layers in a deep learning feature extraction network; Each parallel convolutional layer uses a convolutional kernel of a different size to process the image data and extract image features with different levels of detail. Each convolutional layer outputs a feature map of the corresponding scale. The feature maps output by each convolutional layer are combined to form multi-scale features.
4. The deep learning method for PCB board defect detection according to claim 3, characterized in that, The step of inputting the multi-scale features into the dynamic feature selection module and adaptively calculating the fusion weights corresponding to each scale feature based on the context information of the multi-scale features includes: The correlation between the various feature channels in the multi-scale features is analyzed using a channel attention mechanism; The importance of each feature channel is determined based on the aforementioned correlation; The fusion weights of features at each scale are assigned based on the degree of importance.
5. The deep learning method for PCB board defect detection according to claim 4, characterized in that, The step of weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map includes: The feature maps at each scale are weighted and calculated with their corresponding fusion weights. The weighted features are optimized by adjusting the channel dimension and recalibrating the feature mapping. The output is an enhanced feature map containing multi-scale information.
6. The deep learning method for PCB board defect detection according to claim 1, characterized in that, The step of simultaneously inputting the enhanced feature map into the defect classification branch and the defect localization branch includes: The enhanced feature map is copied into two identical feature map copies; The copy of the first feature map is input into the defect classification branch, which consists of a fully connected layer and a softmax layer; The second feature map copy is input into the defect localization branch, which consists of an upsampling layer and a convolutional layer.
7. The deep learning method for PCB board defect detection according to claim 6, characterized in that, The step of classifying the enhanced feature map through the defect localization branch and outputting the defect type includes: The input feature map is reduced in dimensionality using a fully connected layer. The probability distribution of various defects is calculated using a softmax classifier; The final defect type is determined based on the maximum probability value.
8. The deep learning method for PCB board defect detection according to claim 6, characterized in that, The step of processing the enhanced feature map through the feature enhancement unit in the defect localization branch, highlighting the defect region, and outputting defect location information includes: The spatial resolution of the feature map is restored through upsampling operations; Enhance the feature response of defective regions using spatial attention mechanisms; The location coordinates of the defect are generated using a boundary regression network.
9. A deep learning system for PCB board defect detection, characterized in that, include: The data acquisition unit is used to acquire image data of the PCB board to be inspected. The feature extraction unit is used to input the image data into a deep learning feature extraction network and simultaneously extract multi-scale features of the standardized image through a group of convolutional layers with convolutional kernels of different sizes set in parallel. The weight calculation unit is used to input the multi-scale features into the dynamic feature selection module and adaptively calculate the fusion weights corresponding to each scale feature based on the context information of the multi-scale features. The feature enhancement unit is used to perform weighted fusion of the multi-scale features based on the fusion weights to generate an enhanced feature map; A branch processing unit is used to simultaneously input the enhanced feature map into the defect classification branch and the defect localization branch; The classification and localization unit is used to classify the enhanced feature map through the defect localization branch, output the defect type, and process the enhanced feature map through the feature enhancement unit in the defect localization branch to highlight the defect area and output the defect location information.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the deep learning method for PCB board defect detection as described in any one of claims 1 to 8.