Electronic component identification method based on mixed domain attention mechanism
By introducing a hybrid domain attention mechanism PCBAM in the MobileNetV3 lightweight neural network model, the problems of low recognition efficiency of traditional components and large computing volume of deep learning models are solved, more efficient recognition of electronic components is achieved, and recognition accuracy is improved and speed.
Patent Information
- Application Number
- CN202411014862.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-12
AI Technical Summary
Traditional component recognition methods are inefficient and cannot meet the needs of modern production and manufacturing. The deep learning model training requirements are high and the calculation is large, so it is impossible to take into account the accuracy and operating speed of the algorithm.
The hybrid domain attention mechanism PCBAM is introduced into the Bneck structure of the MobileNetV3 lightweight neural network model. By connecting the spatial attention module and the channel attention module in parallel, the network structure is optimized to improve the accuracy of image feature extraction and recognition of electronic components.
It improves the accuracy and operating speed of electronic components recognition, reduces the number of model parameters, meets real-time usage requirements, and optimizes the network structure to speed up the recognition speed on the basis of ensuring recognition accuracy.
Smart Images

Figure CN118941920A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image feature recognition, and in particular to an electronic component recognition method based on a hybrid domain attention mechanism. Background Art
[0002] Traditional component identification relies solely on manual visual inspection, but due to the high intensity of work, easy fatigue of the human eye, and low degree of automation, the recognition efficiency is low and cannot meet the needs of current modern production and manufacturing. In addition, with the development of microelectronics technology, electronic components are developing in the direction of more types, smaller size, and miniaturization, and there is an urgent need for fast and accurate automatic identification of components; electronic component identification methods mainly use methods based on pattern recognition and deep learning. The pattern recognition method extracts different features of components and then matches different categories according to these features for judgment. Traditional pattern recognition methods often rely on the performance of feature parameters. Due to the wide variety of components, it is still difficult to propose significant features, which also affects the effectiveness of pattern recognition methods. Compared with traditional classification algorithms, deep learning algorithms can automatically extract the features of different components, reduce the complexity of the algorithm, and improve the recognition rate. However, deep learning model training has high requirements for hardware equipment, and also has disadvantages such as large amount of calculation and slow running speed, which leads to the problem of not being able to balance the accuracy and running speed of the algorithm. Summary of the invention
[0003] Purpose of the invention: In order to overcome the shortcomings of the prior art, the present invention provides an electronic component identification method based on a hybrid domain attention mechanism, and introduces a hybrid domain attention mechanism PCBAM into the Bneck structure of the MobileNetV3 lightweight neural network model to improve the MobileNetV3 lightweight neural network model, accurately extract key information of electronic component image features, and increase the accuracy of the network model in identifying electronic component images.
[0004] Technical solution: To achieve the above-mentioned purpose, the present invention provides an electronic component identification method based on a hybrid domain attention mechanism, including introducing a hybrid domain attention mechanism PCBAM in which a spatial attention module and a channel attention module are connected in parallel in the Bneck structure of the MobileNetV3 lightweight network model; then the Bneck structure is reduced to obtain an improved MobileNetV3 lightweight network model, and the images of electronic components are identified by the improved MobileNetV3 lightweight network model.
[0005] Furthermore, the improved MobileNetV3 lightweight network model for recognizing electronic component images includes the following steps:
[0006] S1-1, acquiring images of electronic components and preprocessing the images;
[0007] S1-2, the preprocessed image is input into the Bneck structure after convolution operation, and the Bneck structure convolves the input image and performs depth-separable convolution to obtain the original input feature map;
[0008] S1-3, input the original input feature map into the hybrid domain attention mechanism PCBAM, and obtain the output feature map;
[0009] S1-4. The output feature map is subjected to convolution and pooling operations to obtain a feature map of the final electronic component, and the electronic component is identified through the feature map of the final electronic component.
[0010] Furthermore, the original input feature map is input into the improved hybrid domain attention mechanism PCBAM to obtain an output feature map, including simultaneously inputting the original input feature map into the channel attention module and the spatial attention module, inputting the original input feature map into the channel attention module to obtain a channel weighted feature map, and inputting the original input feature map into the spatial attention module to obtain a spatial weighted feature map; and weighting the obtained channel weighted feature map, spatial weighted feature map and original input feature map to obtain an output feature map.
[0011] Furthermore, the original input feature map is input into the hybrid domain attention mechanism PCBAM to obtain the output feature map, and the calculation process is as follows:
[0012] F H =M C (F)×M S (F)×F
[0013] In the formula, F is the original input feature map, F H M is the output feature map of the original input feature map after the hybrid domain attention mechanism PCBAM output, C (F) is the channel weighted feature map output by the channel attention module after the original input feature map, M S (F) is the spatial weighted feature map output by the spatial attention module after the original input feature map.
[0014] Furthermore, the channel weighted feature map M C (F) The calculation process is as follows:
[0015]
[0016] F n =AvgPool(F m )
[0017] F m=MaxPool(F), m∈{1, 2, 3, 4}
[0018] In the formula, F m represents the maximum pooling, m represents different pooling sizes, F n represents global mean pooling, MLP represents multi-layer perceptron, and σ represents Sigmoid function.
[0019] Furthermore, the spatial weighted feature map M S (F) The calculation process is as follows:
[0020] M S (F) = σ(f(i) 1×1 (f(i) 3×3 (f(i) 3×3 (f(i) 3×3 (f(i) 1×1 (F))))))
[0021]
[0022] In the formula, σ represents the Sigmoid function, f(i) represents the convolution operation, r represents the expansion rate of the dilated convolution, and k represents the receptive field size.
[0023] Furthermore, the reduction of the Bneck structure includes reducing the number of output channels of the bneck9 module, the bneck10 module and the bneck11 module in the Bneck structure to half of the original number of output channels, and reducing the number of input channels of the bneck9 module of the Bneck structure from the original number of input channels of 48 to 40; and deleting the bneck6 module, the bneck7 module and the bneck8 module in the Bneck structure.
[0024] Beneficial effects: The electronic component recognition method based on the hybrid domain attention mechanism of the present invention further improves the recognition effect of electronic components; the MobileNetV3 lightweight neural network model is selected as the backbone network of the electronic component recognition model, thereby reducing the number of model parameters and improving the running speed of the network model to meet the real-time use requirements; the hybrid domain attention mechanism PCBAM is introduced into the MobileNetV3 lightweight neural network model to extract the key features of the electronic component images, solve the problem of small differences between electronic component images, and improve the accuracy of identifying electronic component images; on the basis of ensuring the network depth and recognition accuracy, the network structure is optimized and reduced, the number of network layers is reduced, and the running speed of the network model is further improved, so that the network model can recognize electronic components faster; the recognition rate of the network model for identifying electronic component images is improved, and the number of parameters of the network model is reduced at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a schematic diagram of the MobileNetV3 network Bneck structure;
[0026] Figure 2 Schematic diagram of the hybrid domain attention mechanism PCBAM structure;
[0027] Figure 3 Schematic diagram of the SE attention mechanism module structure;
[0028] Figure 4 Schematic diagram of the traditional mixed domain attention mechanism CBAM structure;
[0029] Figure 5 This is a comparison chart of the electronic component recognition rates of the improved MobileNetV3 and MobileNetV3 in this article. DETAILED DESCRIPTION
[0030] The present invention will be further described below in conjunction with the accompanying drawings.
[0031] A method for identifying electronic components based on a hybrid domain attention mechanism includes introducing a hybrid domain attention mechanism PCBAM in which a spatial attention module and a channel attention module are connected in parallel in the Bneck structure of a MobileNetV3 lightweight network model; then the Bneck structure is reduced to obtain an improved MobileNetV3 lightweight network model, and images of electronic components are identified by using the improved MobileNetV3 lightweight network model.
[0032] The MobileNetV3 lightweight network model is a lightweight series network proposed by the Google team. Compared with the previous two versions of the MobileNet network, MobileNetV3 has greatly improved the accuracy and greatly reduced the parameters and computational complexity of the model; the backbone network Bneck structure of MobileNetV3 is shown in the attached figure. Figure 1 As shown in the figure, the Bneck structure introduces the inverse residual structure in the MobileNetV2 model. First, 1×1 convolution is used for dimensionality increase, and then 3×3 depth-separable convolution is used for dimensionality reduction. The input feature map is passed through the channel attention module Squeeze and Excitation, referred to as SE, and the feature map is output; the channel attention module mainly plays the role of highlighting valuable features and suppressing inconspicuous feature channels. Finally, the 1×1 convolution kernel is used to reduce the dimension of the features. The implementation process of the SE attention module is shown in the attached figure. Figure 3As shown in the figure, the feature map is first compressed into a 1×1×C vector through global pooling, and then passes through two nonlinear fully connected layers and activation function operations to output a 1×1×C vector. Finally, the obtained vector is multiplied with the feature map of the depthwise separable convolution to obtain the weights of each channel, thereby improving the performance of network recognition.
[0033] Another feature of MobileNetV3 is the improved activation function, which uses the h-swish function instead of the swish function to better map the input to the interval [0-1] and eliminate the potential loss of precision in the quantization process, thereby reducing the amount of computation and improving model performance. The calculation of the h-swish function is as follows:
[0034]
[0035] ReLU(6)min(max(0,x),6)
[0036] The MobileNetV3 model can be divided into two types: Large and Small. Since the present invention mainly studies small sample electronic component data sets, the Small network model is selected.
[0037] According to different usage methods, the attention mechanism can be divided into channel domain, spatial domain and mixed domain; the attention used in the MobileNetV3 network model is a typical channel attention, which mainly judges the importance of each channel feature map by compression and activation, and gives greater weight to important information. This method only considers the relationship between feature map channels and ignores the spatial information of the image, that is, the pixel information that plays an important role in image classification. Therefore, in order to take into account the information of the image channel and space, the image feature extraction ability is further improved. The traditional mixed domain attention mechanism CBAM, Convolutional Block Attention Module, combines channel attention and spatial attention. The feature map of the image is first weighted by channel attention, and then by spatial attention to obtain the output feature map. This is a typical serial structure, such as Figure 4 As shown in the figure, in this implementation process, the channel attention mechanism is used as the input of the spatial attention mechanism, that is, the input of the spatial attention mechanism is not the characteristics of the image itself, but the image channel characteristics extracted by the channel attention, which will interfere with the performance of the spatial attention and thus affect the performance of the entire attention mechanism. Therefore, a hybrid domain attention mechanism PCBAM is proposed, in which the spatial attention module and the channel attention module are connected in parallel. Figure 2 As shown; the hybrid domain attention mechanism PCBAM is used to replace the SE channel attention module.
[0038] The improved MobileNetV3 lightweight network model for recognizing electronic component images includes the following steps:
[0039] S1-1, acquiring images of electronic components and preprocessing the images;
[0040] S1-2, the preprocessed image is input into the Bneck structure after convolution operation, and the Bneck structure convolves the input image and performs depth-separable convolution to obtain the original input feature map;
[0041] S1-3, input the original input feature map into the hybrid domain attention mechanism PCBAM, and obtain the output feature map;
[0042] S1-4. The output feature map is subjected to convolution and pooling operations to obtain a feature map of the final electronic component, and the electronic component is identified through the feature map of the final electronic component.
[0043] The original input feature map is input into the improved hybrid domain attention mechanism PCBAM to obtain an output feature map, including simultaneously inputting the original input feature map into the channel attention module and the spatial attention module, inputting the original input feature map into the channel attention module to obtain a channel weighted feature map, and inputting the original input feature map into the spatial attention module to obtain a spatial weighted feature map; and weighting the obtained channel weighted feature map, spatial weighted feature map and original input feature map to obtain an output feature map.
[0044] The original input feature map is input into the hybrid domain attention mechanism PCBAM to obtain the output feature map. The calculation process is as follows:
[0045] F H =M C (F)×M S (F)×F, where F is the original input feature map, F H M is the output feature map of the original input feature map after the hybrid domain attention mechanism PCBAM output, C (F) is the channel weighted feature map output by the channel attention module after the original input feature map, M S (F) is the spatial weighted feature map output by the spatial attention module after the original input feature map.
[0046] The channel weighted feature map M C (F) The calculation process is as follows:
[0047]
[0048] F n =AvgPool(F m )
[0049] Fm =MaxPool(F), m∈{1,2,3,4
[0050] In the formula, F m represents the maximum pooling, m represents different pooling sizes, F n represents global mean pooling, MLP represents multi-layer perceptron, and σ represents Sigmoid function.
[0051] The spatial weighted feature map M S (F) The calculation process is as follows:
[0052] M S (F) = σ(f(i) 1×1 (f(i) 3×3 (f(i) 3×3 (f(i) 3×3 (f(i) 1×1 (F))))))
[0053]
[0054] In the formula, σ represents the Sigmoid function, f(i) represents the convolution operation, r represents the expansion rate of the dilated convolution, and k represents the size of the receptive field. When r=1, the dilated convolution is the standard convolution. When r>1, the dilated convolution is to insert r-1 zeros between every two adjacent weights in the convolution kernel of the standard convolution. At this time, the size of the receptive field is (k-1)×r+1. The spatial information of different scale features of the image can be obtained by increasing the receptive field.
[0055] In order to reduce the excessive amount of calculation and model instability caused by too many layers of the network model, while ensuring the performance of the model parameters on the electronic component data set, the Bneck structure in the MobileNetV3 lightweight network model is further optimized on the basis of the MobileNetV3 lightweight network model that introduces the hybrid domain attention mechanism PCBAM; the Bneck structure is reduced, including reducing the number of output channels of the bneck9 module, bneck10 module and bneck11 module in the Bneck structure to half of the original number of output channels, and reducing the number of input channels of the bneck9 module of the Bneck structure from the original number of input channels of 48 to 40; and deleting the bneck6 module, bneck7 module and bneck8 module in the Bneck structure; thereby reducing the parameters of the Bneck structure to speed up the operation of the network model. The step size of the bneck9 module in the Bneck structure is 1; the electronic components in the database of the present invention are divided into 12 categories, so the number of output channels of the last layer of the network is modified to 12. After reducing the Bneck structure and modifying the number of output channels of the last layer, the network structure of the improved MobileNetV3 lightweight network model is shown in Table 1 below;
[0056] Table 1 Improved MobileNetV3 Small network structure
[0057]
[0058] Example
[0059] The improved MobileNetV3 lightweight network model using the hybrid domain attention mechanism PCBAM in this scheme is compared with the network model obtained by using other attention mechanisms in the experimental structure of recognition performance, that is, the performance of different attention mechanisms is examined; three typical attention mechanisms, channel attention SE, hybrid domain attention CBAM, and efficient channel attention ECA, are selected for comparative experiments with the hybrid domain attention mechanism PCBAM proposed in this paper. The three typical attention mechanisms, channel attention SE, hybrid domain attention CBAM, and efficient channel attention ECA, are compared with the hybrid domain attention mechanism PCBAM proposed in this paper mainly by verifying the three indicators of Top1, Top5 and training time. The experimental comparison results are shown in Table 2 below:
[0060] Table 2 Recognition results of different attention mechanisms
[0061]
[0062] As can be seen from the table, compared with other attention mechanisms, the PCBAM used in the present invention has achieved good results in Top1 and Top5 recognition rates, and has a higher recognition rate than other attention mechanisms Top1; the recognition rate is improved by 2.1-5% compared with other attention mechanisms Top1. In terms of training time, the ECA method uses the shortest time, but its recognition rate is the lowest. The training time of the PCBAM of the present invention is similar to that of the CBAM, but the recognition rate is improved by nearly 2%, which shows that in terms of both recognition rate and training time, the hybrid domain attention mechanism PCBAM of the present invention has the best performance.
[0063] The performance of the hybrid domain attention mechanism PCBAM method proposed in the present invention is further investigated, and experiments with different channel compression ratios are conducted; the channel compression ratio is an important indicator for measuring the model parameters after adding the attention mechanism. The larger the channel compression ratio, the fewer the model parameters and the lighter the model. The channel compression ratios selected in the experiment are 2, 4, 8, 16, 32, and 64, respectively, to investigate the recognition rate performance of the model when the model parameters are continuously reduced. The experimental results are shown in Table 3:
[0064] Table 3 Experimental results of using different compression ratios in the attention mechanism
[0065]
[0066] As can be seen from Table 3, as the compression ratio increases, the number of model parameters and scale gradually decrease, while the recognition rate of the model does not decrease. When the compression ratio is 64, the accuracy of model recognition is the highest in Top1 and Top5, among which the recognition rate of Top1 increases by 1.83% and the recognition rate of Top5 increases by 0.76%. At this time, the model size is reduced to 4.65MB, achieving a good balance between model size and accuracy. At this time, not only the model size is greatly reduced, but also the training time is reduced, which improves the recognition speed. Therefore, 64 is used as the optimal compression ratio of the channel attention mechanism in PCBAM.
[0067] At the same time, the improved MobileNetV3 lightweight network model obtained by the hybrid domain attention mechanism PCBAM is compared with the recognition rate of the traditional MobileNetV3 algorithm, that is, the recognition accuracy; in the experiment, the improved MobileNetV3 lightweight network model of the present invention and the traditional MobileNetV3 algorithm are used to examine the recognition rates of various electronic components in the database and compare them; the experimental comparison results are shown in the attached figure. Figure 5 As shown. Figure 5It can be seen that after adopting the method of improving the MobileNetV3 lightweight network model of the present invention, the recognition rate of most electronic components increases significantly, among which the recognition rate of the chip diode increases the most, by nearly 10%. This shows that the improved MobileNetV3 lightweight network model not only further simplifies the network structure, but also pays more attention to the detailed features of each component, and can extract the fine-grained features of electronic components more meticulously, thereby improving the recognition effect of the components.
[0068] The above is only a description of the preferred embodiments of the present invention. Ordinary technicians in this technical field can make several modifications and optimizations based on the above disclosure without departing from the above basic principles. These improvements and optimizations should be regarded as the understood protection scope of the present invention.
Claims
1. An electronic component recognition method based on a mixed domain attention mechanism, characterized in that: It includes introducing a hybrid domain attention mechanism PCBAM that connects the spatial attention module and the channel attention module in parallel into the Bneck structure of the MobileNetV3 lightweight network model; then reducing the Bneck structure to obtain an improved MobileNetV3 lightweight network model, and identifying images of electronic components through the improved MobileNetV3 lightweight network model.
2. The electronic component identification method based on the mixed domain attention mechanism according to claim 1 is characterized in that: The improved MobileNetV3 lightweight network model for recognizing electronic component images includes the following steps: S1-1, acquiring images of electronic components and preprocessing the images; S1-2, the preprocessed image is input into the Bneck structure after convolution operation, and the Bneck structure convolves the input image and performs depth-separable convolution to obtain the original input feature map; S1-3, input the original input feature map into the hybrid domain attention mechanism PCBAM, and obtain the output feature map; S1-4. The output feature map is subjected to convolution and pooling operations to obtain a feature map of the final electronic component, and the electronic component is identified through the feature map of the final electronic component.
3. The electronic component identification method based on the mixed domain attention mechanism according to claim 2 is characterized in that: The original input feature map is input into the improved hybrid domain attention mechanism PCBAM to obtain an output feature map, including simultaneously inputting the original input feature map into the channel attention module and the spatial attention module, inputting the original input feature map into the channel attention module to obtain a channel weighted feature map, and inputting the original input feature map into the spatial attention module to obtain a spatial weighted feature map; and weighting the obtained channel weighted feature map, spatial weighted feature map and original input feature map to obtain an output feature map.
4. The electronic component identification method based on the mixed domain attention mechanism according to claim 3 is characterized in that: The original input feature map is input into the hybrid domain attention mechanism PCBAM to obtain the output feature map. The calculation process is as follows: F H =M C (F)×M S (F)×F In the formula, F is the original input feature map, F H is the output feature map of the original input feature map after the hybrid domain attention mechanism PCBAM output, M c (F) is the channel weighted feature map output by the channel attention module after the original input feature map, M S (F) is the spatial weighted feature map output by the spatial attention module after the original input feature map.
5. The electronic component identification method based on the mixed domain attention mechanism according to claim 4 is characterized in that: The channel weighted feature map M C (F) The calculation process is as follows: F n =AygPool(F m ) F m =MaxPool(F),m∈{1,2,3,4} In the formula, F m represents the maximum pooling, m represents different pooling sizes, F n represents global mean pooling, MLP represents multi-layer perceptron, and σ represents Sigmoid function.
6. The electronic component identification method based on the mixed domain attention mechanism according to claim 4 is characterized in that: The spatial weighted feature map M S (F) The calculation process is as follows: M S (F)=σ(f(i) 1×1 (f(i) 3×3 (f(i) 3×3 (f(i) 3×3 (f(i) 1×1 (F)))))) In the formula, σ represents the Sigmoid function, f(i) represents the convolution operation, r represents the expansion rate of the dilated convolution, and k represents the receptive field size.
7. The electronic component identification method based on the mixed domain attention mechanism according to claim 1 is characterized in that: The reduction of the Bneck structure includes reducing the number of output channels of the bneck9 module, the bneck10 module and the bneck11 module in the Bneck structure to half of the original number of output channels, and reducing the number of input channels of the bneck9 module of the Bneck structure from the original number of input channels 48 to 40; and deleting the bneck6 module, the bneck7 module and the bneck8 module in the Bneck structure.
Citation Information
Patent Citations
Electronic component identification method based on lightweight deep migration network
CN115496986A
