Aluminum alloy mark identification method based on lightweight spectrum attention network

By combining Gram field transformation and lightweight spectral attention network, converting and processing XRF spectral data, the problems of inefficiency and insufficient accuracy of traditional aluminum alloy grade identification methods are solved, and efficient, accurate and lossless aluminum alloy grade identification is achieved.

CN119513576AActive Publication Date: 2025-02-25UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 16 Cites 0 Cited by

Patent Information

Application Number
CN202411652117.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-02-25
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

Traditional aluminum alloy grade identification methods have problems such as inefficiency, high cost and great destructiveness. As the types of aluminum alloys increase, it is difficult to accurately distinguish different grades from appearance or simple physical tests.

Method used

The method based on Gram field transformation and lightweight spectral attention network is adopted to convert the one-dimensional XRF spectrum into a two-dimensional spectrum. The important information of the spectrum is paid to the lightweight spectral attention module and redundant information is suppressed. The lightweight spatial self-attention network (LSAFormer) is designed in combination with the ShuffleNet structure to identify aluminum alloy grades.

Benefits of technology

It improves the accuracy and robustness of aluminum alloy grade identification, realizes fast, lossless and intelligent aluminum alloy grade identification, reducing the complexity and calculation amount of the identification process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513576A_ABST
    Figure CN119513576A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of spectrum technology and deep learning, and provides an aluminum alloy mark recognition method based on a lightweight spectrum attention network, which is used for improving the accuracy and robustness of aluminum alloy mark recognition. The method comprises the following steps: firstly, converting a one-dimensional XRF spectrum into a two-dimensional spectrogram through Grubby field transformation so as to enrich spatial information and amplify spectrum detail differences; then, a lightweight spectrum attention module is provided, and the module reduces the calculation amount through simple adaptive calculation, pays attention to important information of a spectrogram and inhibits redundant information; and finally, on the basis of a lightweight spatial attention module, a ShuffleNet structure is combined to design a lightweight spatial self-attention network, accurate recognition of the aluminum alloy mark is realized, and the accuracy and robustness of aluminum alloy mark recognition are effectively improved. Moreover, the aluminum alloy mark identification method is used as an end-to-end deep learning model, and the mark of the alloy can be accurately identified without complex preprocessing of a sample.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of spectral technology and deep learning technology, and specifically provides an aluminum alloy grade recognition method based on Gram field transform combined with a lightweight spectral attention network. Background Art

[0002] As a lightweight, high-strength metal material, aluminum alloy has been widely used in aerospace, automobile manufacturing, building structures and other fields. There are many grades of aluminum alloy, and each grade has different alloy composition and performance, suitable for different application scenarios. Correctly identifying the grade of aluminum alloy is crucial to ensure that the material properties meet the specified engineering requirements; however, the traditional aluminum alloy grade identification method has some limitations, and a more intelligent and efficient identification method is needed.

[0003] Traditional aluminum alloy grade identification usually relies on chemical analysis and mechanical property testing, which is often time-consuming, costly, and destructive. For example, chemical analysis requires dissolving samples and using techniques such as spectral analysis to determine the alloy composition, while mechanical property testing requires operations such as stretching or compressing the material. These methods are not only inefficient, but also unsuitable for large-scale rapid screening and online testing. In addition, with the increasing variety of aluminum alloy materials, it is difficult to accurately distinguish different aluminum alloy grades based on appearance or simple physical tests alone. Therefore, it is of great practical significance to develop a fast, non-destructive, and intelligent aluminum alloy grade identification method.

[0004] In recent years, with the development of spectral technology and machine learning algorithms, intelligent identification methods based on spectral analysis have gradually become a hot topic of research. For example, laser induced breakdown spectroscopy (LIBS) and X-ray fluorescence spectroscopy (XRF) technologies can quickly obtain the chemical composition information of materials by analyzing the spectrum generated on the surface of the material. Combined with machine learning algorithms, the spectral data can be deeply analyzed to realize the intelligent identification of aluminum alloy grades. However, aluminum alloy grade identification still faces some challenges; first, the chemical composition differences between different aluminum alloy grades may be small, resulting in overlapping spectral features, which increases the difficulty of identification; second, factors such as the surface state and oxide layer thickness of aluminum alloy materials may also affect the stability and accuracy of spectral signals; in addition, the XRF spectra of aluminum alloys of different grades are extremely similar, and it is challenging to distinguish the alloy types directly from the one-dimensional spectra. The background interference and matrix effect in the one-dimensional XRF spectra will also affect the decision accuracy; finally, the existing machine learning algorithms may have problems such as overfitting and insufficient generalization when processing high-dimensional spectral data. In order to overcome these problems, it is necessary to further develop more advanced data processing and feature extraction methods to improve the accuracy and robustness of the recognition method; in addition, the use of advanced machine learning techniques such as deep learning can better mine the complex patterns in spectral data and improve the intelligent recognition capabilities of aluminum alloy grades. Summary of the invention

[0005] The purpose of the present invention is to provide an aluminum alloy grade recognition method based on a lightweight spectral attention network to improve the accuracy and robustness of aluminum alloy grade recognition; firstly, the present invention converts the one-dimensional XRF spectrum into a two-dimensional spectrum through the Gram field transform (GAF) to enrich the spatial information and amplify the spectral detail differences; then, the present invention proposes a lightweight spectral attention module, which focuses on the important information of the spectrum and suppresses redundant information through lightweight adaptive calculation; finally, based on the lightweight spatial attention module, a lightweight spatial self-attention network (LSAFormer) is designed in combination with the ShuffleNet structure to realize the accurate recognition of aluminum alloy grades.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] A method for aluminum alloy grade recognition based on lightweight spectral attention network, characterized by comprising the following steps:

[0008] Obtain the XRF one-dimensional spectrum information of the aluminum alloy sample of the prior grade, encode the XRF one-dimensional spectrum information using Gram angle difference field transformation to obtain the Gram angle difference field (GADF);

[0009] The Gram angle difference field of the aluminum alloy sample is used as input, and the prior grade of the aluminum alloy sample is used as a label to form a training set;

[0010] Construct a lightweight spectral attention network and complete the training. The lightweight spectral attention network includes: a sequentially connected convolution module (Conv stem), a patch embedding layer (Patch embedding), a first lightweight spectral attention module (LSA), a first patch conversion layer (Patch merge), a second lightweight spectral attention module (LSA), a second patch conversion layer (Patch merge), a third lightweight spectral attention module (LSA), a maximum pooling layer (AvgPool) and a classification head (Classification head);

[0011] The XRF one-dimensional spectrum information of the aluminum alloy to be tested is obtained and converted into the Gram angle difference field, which is input into the trained lightweight spectral attention network, and then the lightweight spectral attention network outputs the brand recognition result.

[0012] Furthermore, the specific process of Gram angle difference field transformation is:

[0013] First, the XRF one-dimensional spectrum information is normalized to obtain the normalized spectrum sequence Expressed as represents the spectral intensity of the i-th channel in the normalized spectral sequence, and n represents the number of channels of the XRF one-dimensional spectral information;

[0014] Then, the normalized spectral sequence is subjected to the piecewise aggregation approximation algorithm (PAA). Perform dimensionality reduction processing to obtain a reduced-dimensional spectrum sequence Expressed as represents the spectral intensity of the i-th channel in the dimension-reduced spectral sequence, and L represents the number of channels after dimension reduction by the segmented aggregation approximation algorithm;

[0015] Then, the dimension-reduced spectral sequence Transform to polar coordinates: φ i Indicates the angle value;

[0016] Finally, the Gram angle difference field (GADF) is calculated:

[0017]

[0018] Here, GADF stands for Gram Angle Difference Field.

[0019] Furthermore, in the lightweight spectral attention network, the input of the convolution module is marked as C in , the output is marked as C out , the convolution module is specifically expressed as:

[0020] C out =GELU(BN 2d (PConv(Conv 2d (C in ))))

[0021] Among them, Conv 2d represents two-dimensional convolution, PConv represents point convolution, BN 2d represents two-dimensional batch normalization and GELU represents the GELU activation function.

[0022] Furthermore, in the lightweight spectral attention network, the input of the Patch embedding layer is labeled as Pe in , the output is marked as Pe out , the Patch embedding layer is specifically expressed as:

[0023] P out =Norm(proj(Pe in ))

[0024] Among them, proj represents Patch embedding and Norm represents normalization.

[0025] Furthermore, in the lightweight spectral attention network, the input of the lightweight spectral attention module is marked as L in , output marked as L out , then the lightweight spectral attention module is specifically expressed as:

[0026]

[0027] Among them, Norm means normalization, LFFN means lightweight feedforward enhancement module, LMHA means lightweight multi-head self-attention module, represents matrix addition;

[0028] Furthermore, the input of the lightweight multi-head self-attention module (LMHA) is labeled as LM in , the output is marked as LM out , the lightweight multi-head self-attention module is specifically expressed as:

[0029] Q,K,V=BN 1d (Conv 1d (LM in ))

[0030]

[0031] LM out =PConv(W)

[0032] Among them, BN1d Represents one-dimensional batch normalization, Conv 1d represents a single convolution, Sigmoid represents the sigmoid activation function, PConv represents point convolution, represents matrix multiplication; K T represents the transpose of the K matrix; W represents the weight matrix, which is used to represent the importance distribution in space.

[0033] Furthermore, the input of the lightweight feedforward enhancement module (LFFN) is marked as LF in , output mark is LF out , the lightweight feedforward enhancement module is specifically expressed as:

[0034] LF out =GELU(PConv(GELU(PConv(LF in ))))

[0035] Among them, PConv represents point convolution and GELU represents GELU activation function.

[0036] Furthermore, in the lightweight spectral attention network, the input of the Patch conversion layer is marked as Pm in , output marked as Pm out , the Patch conversion layer is specifically expressed as:

[0037] Pm out =PConv(Pm in )

[0038] Among them, PConv represents point convolution.

[0039] Furthermore, in the lightweight spectral attention network, the classification head includes: two fully connected layers (FCLayer) and a softmax classifier connected in sequence.

[0040] Furthermore, during the training process of the lightweight spectral attention network, the loss function is set to the cross entropy loss function, and the Adam optimizer is used to complete the training of the lightweight spectral attention network.

[0041] Based on the above technical solution, the beneficial effects of the present invention are:

[0042] The present invention proposes an aluminum alloy grade recognition method based on Gram field transform combined with a lightweight spectral attention network. Firstly, the one-dimensional XRF spectrum is converted into a two-dimensional spectrum through Gram field transform (GAF) to enrich the spatial information and amplify the spectral detail differences; then, a lightweight spectral attention module is proposed, which reduces the amount of calculation, pays attention to the important information of the spectrum and suppresses redundant information through simple adaptive calculation; finally, on the basis of the lightweight spatial attention module, a lightweight spatial self-attention network (LSAFormer) is designed in combination with the ShuffleNet structure to realize the accurate recognition of aluminum alloy grades, and effectively improve the accuracy and robustness of aluminum alloy grade recognition; and, as an end-to-end deep learning model, the aluminum alloy grade recognition method of the present invention can accurately identify the alloy grade without complex preprocessing of the sample. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 It is a schematic diagram of the flow of the aluminum alloy grade recognition method based on Gram field transform combined with lightweight spectral attention network in the present invention.

[0044] Figure 2 It is a structural schematic diagram of the lightweight spatial spectral attention module and the lightweight spectral attention network in the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and beneficial effects of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0046] This embodiment provides an aluminum alloy grade recognition method based on Gram field transform combined with lightweight spectral attention network, and its process is as follows: Figure 1 As shown, the specific steps include:

[0047] Step 1. Obtain XRF one-dimensional spectrum information of the aluminum alloy sample of the prior grade;

[0048] Several aluminum alloy materials of a priori grades are obtained, and standard samples are made after grinding, drying and other treatments. The XRF one-dimensional spectrum sequence of the standard samples is obtained using a handheld energy dispersive X-ray fluorescence spectrometer; the original spectrum sequence of each standard sample is expressed as X = {x1, x2, ..., x i ,...,x n}, where n represents the number of channels (i.e., the sequence length, n = 1000), xi represents the spectral intensity of the i-th channel in the original spectral sequence, i = 1, 2, ..., n;

[0049] Step 2. Use Gram angle difference field transform to encode the XRF one-dimensional spectrum information to obtain the encoding feature;

[0050] First, the XRF one-dimensional spectrum sequence is normalized and scaled to the range of [0,1]. The normalization process is specifically expressed as:

[0051]

[0052] in, Represents the spectral intensity of the i-th channel in the normalized spectral sequence, that is, the spectral intensity x i The normalized result of ; min(X) and max(X) represent the minimum and maximum values ​​of the original spectral sequence X respectively;

[0053] After the above normalization process, the original spectral sequence X is normalized to obtain the normalized spectral sequence Expressed as

[0054] Then, the normalized spectral sequence is subjected to the piecewise aggregation approximation algorithm (PAA). Perform dimensionality reduction processing; PAA is a feature extraction algorithm based on segmented sequence averaging. It first divides the sequence into segments of equal length, and then uses the segment average to represent the value of all data in the segment. It is specifically expressed as:

[0055]

[0056] in, represents the spectral mean of the i-th segment in the dimension-reduced spectral sequence, and the length of each segment is n represents the length of the sequence after normalization, and L represents the length of the sequence after dimensionality reduction using the segmented aggregation approximation algorithm.

[0057] Normalized spectral sequence After the above dimensionality reduction process, the reduced dimensionality spectrum sequence is obtained Expressed as The dimension-reduced spectral sequence can still reflect the overall trend of the original spectral sequence and smooth the noise to varying degrees, thereby improving the performance of the classifier;

[0058] Then, the one-dimensional spectrum sequence in the rectangular coordinate system after dimensionality reduction is transformed into the polar coordinate system, which is specifically expressed as:

[0059]

[0060] Among them, φ i Indicates the angle value;

[0061] Finally, by calculating the sine value of the angle difference between different points, the Gram angle difference field (GADF) is obtained, which is specifically expressed as:

[0062]

[0063] Among them, GADF represents the Gram angle difference field, and the main diagonal of the matrix is ​​composed of the original spectrum sequence, which can maintain the sequence of the spectrum signal;

[0064] Step 3. Take the Gram angle difference field of the aluminum alloy sample as input and the prior grade of the aluminum alloy sample as a label to form a data set, and divide the data set into a training set and a test set in a ratio of 8:2;

[0065] Step 4. Build a lightweight spectral attention network;

[0066] Lightweight spectral attention network such as Figure 2 As shown, it includes: a convolutional module (Conv stem), a Patch embedding layer (Patch embedding), a first lightweight spectral attention module (LSA), a first Patch conversion layer (Patch merge), a second lightweight spectral attention module (LSA), a second Patch conversion layer (Patch merge), a third lightweight spectral attention module (LSA), a maximum pooling layer (AvgPool) and a classification head (Classification head) connected in sequence;

[0067] The input data of the lightweight spectral attention network is the Gram angular difference field (GADF) encoded by the Gram field transform, that is, a two-dimensional spectral matrix. It first passes through the convolution module (Conv stem) to realize the preliminary feature extraction and spatial dimension control, and compresses the size of the spatial feature map (dimension C is 64) to obtain the spectral feature map I0; after the preliminary feature extraction, the spectral feature map I0 is positionally encoded through the Patch embedding layer (Patch embedding) and sent to the lightweight spectral attention module. Through the autocorrelation calculation between the feature maps, the important areas in the two-dimensional image space of the aluminum alloy are roughly focused on to obtain the spectral feature output I1; the spectral feature output I1 passes through the first Patch conversion layer (Patchmerge), the second lightweight spectral attention module (LSA), the second Patch conversion layer (Patch merge), and the third lightweight spectral attention module (LSA), which maps the feature map to a higher spatial dimension and a smaller spatial size, completes feature refinement while focusing on finer features. The dimensions are 128 and 256 respectively, and the spectral feature output I2 is obtained; the spectral feature output I2 integrates the features through the maximum pooling layer, and then completes the classification through the classification head to obtain the recognition result;

[0068] Furthermore, the convolutional module (Conv stem) is as follows Figure 2 As shown in (a), the input of the convolution module is marked as Cin , the output is marked as C out , then the convolution module is specifically expressed as:

[0069] C out =GELU(BN 2d (PConv(Conv 2d (C in ))))

[0070] Among them, Conv 2d represents two-dimensional convolution, PConv represents point convolution, BN 2d represents two-dimensional batch normalization, GELU represents the GELU activation function;

[0071] Furthermore, the Patch embedding layer is as follows Figure 2 As shown in (b), the input of the Patch embedding layer is marked as Pe in , the output is marked as Pe out , then the Patch embedding layer is specifically expressed as:

[0072] P out =Norm(proj(Pe in ))

[0073] Among them, proj means Patch embedding, and Norm means normalization;

[0074] Furthermore, the lightweight spectral attention module (LSA) is Figure 2 As shown in (c), the standard Transformer encoder architecture is used to obtain the attention feature map through cheap convolution calculation and autocorrelation calculation, and then the attention calculation is performed on the input feature map, which can adaptively focus on the important information of the encoded two-dimensional spectral matrix and suppress redundant information. Finally, the nonlinearity of the model is increased through a lightweight feedforward neural network to achieve the purpose of mining deep spectral features and improving classification performance.

[0075] Specifically, the input of the lightweight spectral attention module is marked as L in , output marked as L out , then the lightweight spectral attention module is specifically expressed as:

[0076]

[0077] Among them, Norm means normalization, LFFN means lightweight feedforward enhancement module, LMHA means lightweight multi-head self-attention module, represents matrix addition;

[0078] Furthermore, the lightweight multi-head self-attention module (LMHA) is Figure 2 As shown in (d), the input of the lightweight multi-head self-attention module (LMHA) is marked as LM in , the output is marked as LM out , then the lightweight multi-head self-attention module is specifically expressed as:

[0079] Q,K,V=BN 1d (Conv 1d (LM in ))

[0080]

[0081] LM out =PConv(W)

[0082] Among them, BN 1d Represents one-dimensional batch normalization, Conv 1d represents a single convolution, Sigmoid represents the sigmoid activation function, PConv represents point convolution, represents matrix multiplication; K T represents the transpose of the K matrix; W represents the weight matrix, which is used to represent the importance distribution in space;

[0083] In the lightweight multi-head self-attention module (LMHA), in order to perform multi-head autocorrelation calculation, the query matrix Q, key matrix K and value matrix V in the spectral space must be generated first; the multi-head autocorrelation calculation calculates the similarity score between each spectral element and other spectral elements through the Q, K, and V matrices in the two-dimensional spectral space, and then generates a new representation of the spectral features through a normalization method, that is: the similarity matrix of the spectral features is obtained by the dot product of the Q matrix and the K matrix, and then the features are normalized into probability distributions through an activation function, and finally weighted into the V matrix to obtain a spatial attention map; in the lightweight spectral attention module (LSA), the spatial attention map output by the lightweight multi-head self-attention module is connected to the input feature map through residual learning, which can effectively prevent feature degradation; in addition, the lightweight feedforward enhancement network LFFN is used to enhance the network's expressiveness;

[0084] Furthermore, the lightweight feedforward enhancement module (LFFN) is Figure 2 As shown in (f), the input of the lightweight feedforward enhancement module (LFFN) is marked as LF in , output mark is LF out , then the lightweight feedforward enhancement module is specifically expressed as:

[0085] LF out =GELU(PConv(GELU(PConv(LF in ))))

[0086] Among them, PConv represents point convolution, GELU represents GELU activation function;

[0087] Furthermore, the Patch merge layer is as follows Figure 2 As shown in (e), the input of the Patch conversion layer is marked as Pm in , output marked as Pm out , then the Patch conversion layer is specifically expressed as:

[0088] Pm out =PConv(Pm in )

[0089] Among them, PConv represents point convolution;

[0090] Furthermore, the classification head includes: two fully connected layers (FCLayer) and a softmax classifier connected in sequence; the two fully connected layers are FCLayer1 and FCLayer2, the number of neurons in FCLayer1 is 32, and the number of neurons in FCLayer2 is 8, which is the number of output categories;

[0091] Step 5. Set the loss function and use the Adam optimizer to train the lightweight spectral attention network;

[0092] The training data is sent to the lightweight spectral attention network for training. The batch size of the training process is 60, the number of iterations is 100, and the network is optimized by the Adam optimizer. The loss function is the cross entropy loss function, specifically:

[0093]

[0094] Among them, p(x m ) represents the true distribution, q(x m ) represents the predicted distribution, M represents the number of categories;

[0095] Step 6. Use steps 1 to 2 to obtain the Gram angle difference field (GADF) of the aluminum alloy to be identified, input it into the trained lightweight spectral attention network, and the lightweight spectral attention network outputs the brand recognition result.

[0096] The beneficial effects of the present invention are described in detail below in conjunction with simulation tests.

[0097] In this embodiment, accuracy, precision, recall and F1-score are introduced as evaluation indicators of classification performance. The closer the value of each indicator is to 1, the better the classification performance of the surface model. The calculation formulas of the above indicators are:

[0098]

[0099] Among them, TP is true positive, TN is true negative, FP is false positive, and FN is false negative;

[0100] At the same time, the number of parameters and the amount of calculation are selected to measure the complexity of the model. The parameters (Params) reflect the spatial complexity of the model, and the number of operations (MACs) represents the time complexity of the model. The lower their values, the lower the model complexity.

[0101] In this embodiment, a total of 2190 sets of 8 different grades of alloy spectrum data were collected. i ,...,x 1000}, after Gram angle difference field transformation, the Gram angle difference field (GADF) of each group of spectral data is obtained as a two-dimensional spectral matrix; the training set and the test set are divided into training set and test set in a ratio of 8:2, with 1752 samples in the training set and 438 samples in the test set; after the lightweight spectral attention network is trained with the training set, the test set is used for testing; the test is repeated five times to obtain the standard deviation of the mean, and the test results are Accuracy: 97.44% ± 0.33, Precision: 97.50% ± 0.33, Recall: 97.61% ± 0.26, F1-score: 97.52% ± 0.11, Params: 3.21M, MACs: 0.59G.

[0102] Furthermore, the lightweight spectral attention network (LSAFormer) in this embodiment is compared with other advanced classification models, including: one-dimensional comparison methods (PCA-SVM, 1D-CNN, DeepSpectra, SpectraNet-32, MLP and LucasVGGNet-16); two-dimensional comparison methods (ResT, LightViT, EfficientV1, EfficientV2 and ResNet18); the comparison results of the one-dimensional method using one-dimensional spectral data as input are shown in the figure. As shown in Table 1, the Train_Acc of PCA-SVM, 1D-CNN, DeepSpectra, SpectraNet-32, MLP and LucasVGGNet-16 are 84.84%, 79.85%, 88.15%, 79.99%, 95.41% and 98.02%, respectively, and the Test_Acc are 84.93%±1.44, 91.10%±3.13, 91.87%±1.31, 92.23%±1.44, 92.83%±1.02 and 93.74%±1.10, respectively. The comparison results of two-dimensional GADF spectral data as input are shown in Table 2. The Train_Acc of ResT, LightViT, EfficientV1, EfficientV2 and ResNet18 are 94.82%, 97.74%, 98.47%, 99.01%, 99.15%, and the Test_Acc are 94.33%±1.41, 95.66%±1.04, 96.98%±0.63, 96.43%±0.58, 96.80%±0.72, respectively.

[0103] Table 1

[0104] Model Train_Acc Test_Acc Precision Recall F1-score PCA-SVM 84.84% 84.93%±1.44 84.61%±1.64 84.71%±1.29 83.74%±1.43 1D-CNN 79.85% 91.10%±3.13 92.71%±1.86 93.80%±2.75 91.26%±2.57 DeepSpectra 88.15% 91.87%±1.31 93.87%±1.78 90.94%±2.77 90.37%±3.01 SpectraNet-32 79.99% 92.23%±1.44 90.82%±4.97 93.40%±5.00 90.71%±4.56 MLP 95.41% 92.83%±1.02 92.76%±1.37 93.05%±1.07 92.77%±1.14 LucasVGGNet-16 98.02% 93.74%±1.10 94.49%±2.56 94.57%±3.29 93.88%±2.81

[0105] Table 2

[0106] Model Train_Acc Test_Acc Precision Recall F1-score Params MACs ResT 94.82% 94.33%±1.41 94.15%±1.21 94.47%±2.07 94.14%±1.52 9.99M 1.47G LightViT 97.74% 95.66%±1.04 95.72%±1.14 95.53%±1.52 95.56%±1.33 8.11M 0.72G EfficientV1 98.47% 96.98%±0.63 96.78%±1.06 97.04%±0.61 96.84%±0.85 4.02M 0.39G EfficientV2 99.01% 96.43%±0.58 96.50%±0.89 96.15%±1.09 96.22%±0.84 20.19M 2.88G ResNet18 99.15% 96.80%±0.72 96.62%±1.08 96.96%±0.86 96.73%±0.93 11.54M 1.76G LSAFormer 99.76% 97.44%±0.33 97.50%±0.33 97.61%±0.26 97.52%±0.11 3.21M 0.59G

[0107] It can be seen from Tables 1 and 2 that the lightweight spectral attention network proposed in the present invention achieves the best overall classification performance; in addition, due to the lightweight computing method and network structure, LSAFormer also shows great advantages in model complexity and is expected to be deployed and applied on mobile terminals.

[0108] In summary, the present invention first converts the one-dimensional XRF spectrum into a two-dimensional spectrum through Gram field transformation to enrich the spatial information and amplify the difference in spectral details, and then designs a lightweight spectral attention network (LSAFormer) to achieve accurate identification of aluminum alloys of different grades; the classification accuracy is improved, indicating that LSAFormer effectively pays attention to the important information of the spectrum and suppresses redundant information. In addition, the lightweight calculation method and network structure reflect the superiority of the method of the present invention.

[0109] The above description is only a specific implementation mode of the present invention. Any feature disclosed in this specification, unless otherwise stated, can be replaced by other alternative features that are equivalent or have similar purposes; all the disclosed features, or all the steps in the methods or processes, except for mutually exclusive features and / or steps, can be combined in any way.

Claims

1. A method for aluminum alloy grade recognition based on lightweight spectral attention network, characterized in that: The following steps are involved: Obtain the XRF one-dimensional spectrum information of the aluminum alloy sample of the prior grade, encode the XRF one-dimensional spectrum information using Gram angle difference field transformation to obtain the Gram angle difference field (GADF); The Gram angle difference field of the aluminum alloy sample is used as input, and the prior grade of the aluminum alloy sample is used as a label to form a training set; Construct a lightweight spectral attention network and complete the training. The lightweight spectral attention network includes: a sequentially connected convolution module (Conv stem), a patch embedding layer (Patch embedding), a first lightweight spectral attention module (LSA), a first patch conversion layer (Patch merge), a second lightweight spectral attention module (LSA), a second patch conversion layer (Patch merge), a third lightweight spectral attention module (LSA), a maximum pooling layer (AvgPool) and a classification head (Classification head); The XRF one-dimensional spectrum information of the aluminum alloy to be tested is obtained and converted into the Gram angle difference field, which is input into the trained lightweight spectral attention network, and then the lightweight spectral attention network outputs the brand recognition result.

2. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 1 is characterized in that: The specific process of Gram angle difference field transformation is: First, the XRF one-dimensional spectrum information is normalized to obtain the normalized spectrum sequence Expressed as represents the spectral intensity of the i-th channel in the normalized spectral sequence, and n represents the number of channels of the XRF one-dimensional spectral information; Then, the normalized spectral sequence is subjected to the piecewise aggregation approximation algorithm (PAA). Perform dimensionality reduction processing to obtain a reduced-dimensional spectrum sequence Expressed as represents the spectral intensity of the i-th channel in the dimension-reduced spectral sequence, and L represents the number of channels after dimension reduction by the segmented aggregation approximation algorithm; Then, the dimension-reduced spectral sequence Transform to polar coordinates: φ i Indicates the angle value; Finally, the Gram angle difference field (GADF) is calculated: Here, GADF represents the Gram Angle Difference Field.

3. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 1 is characterized in that: In the lightweight spectral attention network, the input of the convolution module is marked as C in , the output is marked as C out , the convolution module is specifically expressed as: C out =YELLOW(BN 2d (PConv(Conv 2d (C in )))) in, Conv 2d represents two-dimensional convolution, PConv represents point convolution, BN 2d represents two-dimensional batch normalization and GELU represents the GELU activation function.

4. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 1 is characterized in that: In the lightweight spectral attention network, the input of the Patch embedding layer is marked as Pe in , the output is marked as Pe out , the Patch embedding layer is specifically expressed as: On out =Norm(proj(Pe in )) Among them, proj represents Patch embedding and Norm represents normalization.

5. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 1 is characterized in that: In the lightweight spectral attention network, the input of the lightweight spectral attention module is marked as L in , output marked as L out , then the lightweight spectral attention module is specifically expressed as: Among them, Norm means normalization, LFFN means lightweight feedforward enhancement module, LMHA means lightweight multi-head self-attention module, Represents matrix addition.

6. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 5 is characterized in that: The input of the lightweight multi-head self-attention module (LMHA) is labeled as LM in , the output is marked as LM out , the lightweight multi-head self-attention module is specifically expressed as: Q,K,V=BN 1d (Conv 1d (LM in )) LM out =PConv(W) Among them, BN 1d Represents one-dimensional batch normalization, Conv 1d represents a single convolution, Sigmoid represents the sigmoid activation function, PConv represents point convolution, represents matrix multiplication; K T represents the transpose of the K matrix; W represents the weight matrix, which is used to represent the importance distribution in space.

7. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 5 is characterized in that: The input of the lightweight feedforward enhancement module (LFFN) is marked as LF in , output mark is LF out , the lightweight feedforward enhancement module is specifically expressed as: LF out =GELU(PConv(GELU(PConv(LF in )))) Among them, PConv represents point convolution and GELU represents GELU activation function.

8. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 1 is characterized in that: In the lightweight spectral attention network, the input of the Patch conversion layer is marked as Pm in , output marked as Pm out , the Patch conversion layer is specifically expressed as: Pm out =PConv(Pm in ) Among them, PConv represents point convolution.

9. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 1 is characterized in that: In the lightweight spectral attention network, the classification head includes: two fully connected layers (FCLayer) and a softmax classifier connected in sequence.

10. The aluminum alloy grade recognition method based on lightweight spectral attention network according to claim 1 is characterized in that: During the training process of the lightweight spectral attention network, the loss function is set to the cross entropy loss function, and the Adam optimizer is used to complete the training of the lightweight spectral attention network.

Citation Information

Patent Citations

  • Near-infrared spectrum diesel vehicle license plate identification method based on SMOTE and deep learning

    CN112613536A

  • Image-level hyperspectral image classification method

    CN114781534A

  • Bearing fault diagnosis method based on lightweight neural network and dimension expansion

    CN115761398A

  • Non-intrusive load identification method based on Grubrum angle difference field feature fusion

    CN116127409A

  • Hyperspectral image classification method based on spectrum-space self-attention and Transform network

    CN117315481A