Method and System for Training Homogeneous Gamma-Ray Spectrum Data

CN122361494BActive Publication Date: 2026-08-14HEFEI YINGWU INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-10
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

这导致在谱峰重叠严重、信噪比较低或训练样本有限的情况下,元素含量分析的准确性和稳定性受到制约

Benefits of technology

(1)本发明通过将已知元素的特征峰位置道址和峰幅度预期值共同编码生成同时包含位置信息和幅度信息的查询向量,构成查询矩阵,并利用查询矩阵与能谱特征数据进行注意力交互,从而能够将核物理先验知识主动引入预测模型,使预测模型关注能谱中的特征峰区域。相比于仅基于测量数据本身的传统方法,本发明能够在谱峰重叠严重、信噪比低或训练样本有限的情况下,提高元素含量分析的准确性和稳定性,同时减少对大规模有标签样本的依赖。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122361494B_ABST
    Figure CN122361494B_ABST
Patent Text Reader

Abstract

This application discloses a method and system for training homologous gamma-ray spectral data, belonging to the field of gamma-ray spectral data processing technology. The method includes: acquiring gamma-ray spectral data of the analyte and extracting feature data; acquiring characteristic peak information of the target element; encoding and fusing the characteristic peak information to generate a query vector for each characteristic peak; combining the query vectors of all characteristic peaks into a query matrix; calculating attention-enhanced features based on the query matrix and feature data using an attention mechanism; inputting the attention-enhanced features into a regression network for elemental content prediction, calculating the prediction loss, and updating the network parameters. This approach can fully utilize prior knowledge of nuclear physics, significantly improving the accuracy and stability of elemental content analysis when there is severe peak overlap, low signal-to-noise ratio, or insufficient samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of gamma spectrum data processing technology, and more specifically, to a method and system for training homologous and heterogeneous gamma spectrum data. Background Technology

[0002] Prompt Gamma Neutron Activation Analysis (PGNAA) is a nuclear analysis technique used for elemental composition detection. It has been applied in material composition detection in industries such as coal, cement, mining, and metallurgy.

[0003] In real-world industrial scenarios, energy dispersive spectroscopy (EDS) data commonly suffers from severe peak overlap, strong background interference, and low signal-to-noise ratio (SNR). Furthermore, the cost of preparing standard samples is high, resulting in insufficient sample size for supervised training. Most related analytical methods rely solely on fitting or learning from the measurement data itself, failing to effectively incorporate known characteristic peak positions and amplitude information into the analysis process. This leads to limitations in the accuracy and stability of elemental content analysis when faced with severe peak overlap, low SNR, or limited training samples. Summary of the Invention

[0004] Therefore, it is necessary to provide a training method and system for homologous gamma spectral data to address the above problems, thereby improving the accuracy and stability of elemental content analysis.

[0005] This application provides a method for training homologous gamma-ray spectral data, including: Acquire gamma-ray spectrum data of the substance being tested, and extract feature data of the gamma-ray spectrum data through a feature extraction network; Obtain characteristic peak information of the target element; the target element includes at least one known element of the substance being measured, and the characteristic peak information includes the peak position address and peak amplitude value corresponding to each characteristic peak of the known element; The characteristic peak information is encoded and fused to generate a query vector for each characteristic peak; the query vector contains both the peak location address information and the peak amplitude value information of the characteristic peak. Combine the query vectors of all feature peaks into a query matrix; Based on the query matrix and feature data, attention-enhanced features are calculated using an attention mechanism. The attention-enhanced features are input into the regression network to predict the element content, and the predicted element content value is obtained. Calculate the loss between the predicted and actual values, and update the network parameters based on the loss.

[0006] In one optional implementation, encoding and fusing based on feature peak information to generate a query vector for each feature peak includes: Sine-encoded position vectors are obtained by performing sinusoidal position encoding on the peak position address; Amplitude embedding encoding is performed on the peak amplitude value to obtain the amplitude encoding vector; The position encoding vector and amplitude encoding vector corresponding to the same feature peak are added together to generate the query vector of the feature peak.

[0007] In one optional implementation, sinusoidal position encoding is performed on the peak position address to obtain a position encoding vector, including: Multiple frequencies are set, and these frequencies form a geometric series; Calculate the product of the peak position channel address and each of the multiple frequencies, and calculate the sine and cosine values ​​of all products; The sine and cosine values ​​corresponding to each frequency are grouped together, and the groups are arranged in order of frequency from low to high. They are then concatenated to form a position encoding vector.

[0008] In one optional implementation, amplitude embedding encoding is performed on the peak amplitude value to obtain an amplitude encoding vector, including: adding 1 to the peak amplitude value and taking the logarithm to obtain the logarithmic value; The numerical input to the multilayer perceptron network is mapped to obtain the amplitude encoding vector; the output dimension of the multilayer perceptron network is the same as the dimension of the position encoding vector.

[0009] In one optional implementation, attention-enhanced features are calculated using an attention mechanism based on the query matrix and feature data, including: Multiply the feature data by the first weight matrix and the second weight matrix respectively to obtain the key matrix and the value matrix; The query matrix is ​​used as the query input of the attention mechanism, the key matrix is ​​used as the key input of the attention mechanism, and the value matrix is ​​used as the value input of the attention mechanism. The product of the query matrix and the transpose of the key matrix is ​​calculated, and the product result is scaled and normalized to obtain the attention weight matrix. Multiplying the attention weight matrix by the value matrix yields the attention-enhanced features.

[0010] In one optional implementation, gamma-ray spectrum data of the analyte is acquired, and feature data of the gamma-ray spectrum data is extracted using a feature extraction network, including: Obtain a raw gamma spectrum of the substance being tested; The original gamma spectrum is reversibly transformed to map it to the transform domain. The transformation result is then filtered or random noise is added in the transform domain. Finally, an inverse transformation is performed to generate the augmented spectrum. The augmented energy spectrum was used as gamma energy spectrum data, and feature data of the gamma energy spectrum data were extracted by a feature extraction network.

[0011] In one optional implementation, gamma-ray spectrum data of the analyte is acquired, and feature data of the gamma-ray spectrum data is extracted using a feature extraction network, including: Obtain a raw gamma spectrum of the substance being tested; The original gamma spectrum is augmented to generate an augmented spectrum. The original gamma spectrum and the augmented spectrum are stacked in the channel dimension to form multi-channel energy spectrum data; Multi-channel energy spectrum data is used as gamma energy spectrum data, and feature data of gamma energy spectrum data is extracted by feature extraction network.

[0012] In one optional implementation, gamma-ray spectrum data of the analyte is acquired, and feature data of the gamma-ray spectrum data is extracted using a feature extraction network, including: The substance being tested is measured multiple times independently, and each measurement yields a raw gamma spectrum; A portion of the raw gamma spectrum obtained from multiple independent measurements is randomly selected and stacked along the channel dimension to form a multi-channel input tensor; the number of rows in the multi-channel input tensor is the number of selected raw gamma spectra, and the number of columns is the number of energy channels in each raw gamma spectrum; Select one raw gamma spectrum from multiple independent measurements as the target raw spectrum; augment the target raw spectrum to generate an augmented spectrum; stack the target raw spectrum and the augmented spectrum in the channel dimension to form multi-channel energy spectrum data. The first feature data is obtained by extracting feature data of the multi-channel input tensor through the first feature extraction network; the second feature data is obtained by extracting feature data of the multi-channel energy spectrum data through the second feature extraction network. The first feature data and the second feature data are concatenated along the channel dimension to obtain the fused feature data; the fused feature data is then used as the feature data extracted by the feature extraction network.

[0013] Furthermore, this application also provides a training system for homologous gamma-ray spectrum data, used to implement the above-mentioned method for training homologous gamma-ray spectrum data. The system includes: The data acquisition module is used to acquire the gamma spectrum data of the substance being tested, and to extract the feature data of the gamma spectrum data through a feature extraction network. Obtain characteristic peak information of the target element; the target element includes at least one known element of the substance being measured, and the characteristic peak information includes the peak position address and peak amplitude value corresponding to each characteristic peak of the known element; The attention mechanism module is used to encode and fuse based on the feature peak information to generate a query vector for each feature peak; the query vector contains both the peak location address information and the peak amplitude value information of the feature peak. Combine the query vectors of all feature peaks into a query matrix; Based on the query matrix and feature data, attention-enhanced features are calculated using an attention mechanism. The prediction module is used to input attention-enhanced features into the regression network to predict element content and obtain the predicted element content value. The training module is used to calculate the loss between the predicted and the true values ​​and to update the network parameters based on the loss.

[0014] In another aspect, this application also provides an electronic device, comprising: The memory and processor are interconnected and communicate with each other. The memory stores computer instructions, and the processor executes the computer instructions to carry out the above-mentioned homologous heterogeneous gamma spectrum data training method.

[0015] Compared to existing technologies, the advantages of this application are: (1) This invention generates a query vector containing both position and amplitude information by encoding the known characteristic peak locations and expected peak amplitude values ​​of elements. This query vector forms a query matrix, which is then used to interact with the energy spectrum feature data through attention. This allows prior knowledge of nuclear physics to be actively introduced into the prediction model, enabling the model to focus on the characteristic peak regions in the energy spectrum. Compared to traditional methods based solely on the measurement data, this invention improves the accuracy and stability of elemental content analysis even in situations with severe peak overlap, low signal-to-noise ratio, or limited training samples, while reducing reliance on large-scale labeled samples.

[0016] (2) This invention performs sinusoidal position encoding on the peak location address and amplitude embedding encoding on the peak amplitude value, and then adds the two to generate a query vector, so that the query vector carries both the channel address information and the expected intensity information of the feature peak. This explicit fusion method ensures that the position encoding and amplitude encoding are aligned in the vector space, which facilitates the subsequent attention mechanism to effectively utilize the two types of prior knowledge and improves the utilization efficiency of physical priors.

[0017] (3) This invention performs multiple independent measurements on the same substance, stacks a portion of the energy spectrum into a homologous multichannel tensor, and stacks another target energy spectrum and its augmented spectrum into another multichannel data. Then, the two feature extraction networks extract features respectively and splice and fuse them. This simultaneously utilizes the statistical information from multiple independent measurements and the local correlation information between the original gamma energy spectrum and the augmented energy spectrum, making the fused features richer and thus improving the accuracy of element content prediction. Attached Figure Description

[0018] Figure 1 A flowchart of a method for training homologous gamma spectral data according to an embodiment of this application; Figure 2This is a schematic diagram of a feature extraction network structure provided in an embodiment of this application; Figure 3 This is a schematic diagram of the predictive model structure provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0019] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the specific embodiments of this application are described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.

[0020] In industrial settings such as coal, cement, mining, and metallurgy, elemental composition analysis of materials or slurries is required. Promptly emitted gamma neutron activation analysis (PGNAA) utilizes a neutron source to irradiate the analyte, detecting the characteristic gamma rays generated by the reaction of atomic nuclei with neutrons. This allows for the simultaneous analysis of multiple elemental contents without damaging the sample. However, real-world industrial environments are complex, with significant fluctuations in material composition, high equipment and environmental noise, and expensive standard sample preparation, resulting in a very limited number of samples available for supervised training. Traditional analytical algorithms based on characteristic peak fitting and machine learning methods that directly input single-measurement energy spectra into neural networks suffer from significantly reduced accuracy in cases of severe peak overlap and low signal-to-noise ratio. Furthermore, neither fully utilizes prior information from nuclear physics, thus limiting the noise resistance and generalization ability of the prediction model.

[0021] Therefore, in order to solve the above problems, this application provides a method for training homologous gamma spectral data. Figure 1 A flowchart of a method for training homologous gamma spectral data according to an embodiment of this application is shown. (Refer to...) Figure 1 As shown, the method includes the following steps: S1. Obtain the gamma spectrum data of the substance being tested, and extract the feature data of the gamma spectrum data through a feature extraction network.

[0022] In this invention, acquiring gamma-ray spectral data of the analyte and extracting feature data from it forms the basis for subsequent attention mechanisms and elemental content prediction. Depending on different application requirements and data conditions, this invention provides several optional implementation methods. The following three specific embodiments provide detailed descriptions, each fully illustrating the complete process from data acquisition to feature extraction.

[0023] In one specific embodiment, acquiring gamma-ray spectrum data of the analyte and extracting feature data of the gamma-ray spectrum data through a feature extraction network includes: acquiring a raw gamma-ray spectrum of the analyte; performing a reversible transformation on the raw gamma-ray spectrum to map it to the transform domain; filtering or adding random noise to the transformation result in the transform domain; performing an inverse transformation to generate an augmented spectrum; using the augmented spectrum as gamma-ray spectrum data and extracting feature data of the gamma-ray spectrum data through a feature extraction network.

[0024] Specifically, the analyte is subjected to a complete neutron irradiation and energy spectrum acquisition using a PGNAA device to obtain a raw gamma spectrum. This raw gamma spectrum is denoted as... The shape is [1 ], The number of energy channels. Indicates the measurement sequence number, each element ( ) indicates the first Gamma ray count for each energy channel.

[0025] The raw gamma spectrum is augmented to expand the training dataset without increasing the number of actual sample measurements. The data augmentation steps are as follows: (1) Select one or more reversible transformation algorithms This includes, but is not limited to, frequency domain filtering (such as Fourier transform) and invertible transforms such as wavelet transform, mapping the original gamma spectrum to the transform domain. The process is represented as follows: ; In the formula: This is the result of mapping the original gamma spectrum to the transform domain.

[0026] (2) In the transform domain, the transformation result Perform filtering operations or add random noise, assuming you need to generate For augmented variants, the processing procedure is expressed as follows: ; ;

[0027] ; In the formula: For the first Transform domain results; For the first Index of the transform domain result; This is a filtering algorithm; This is added random noise. The above processing methods can be used in random combinations.

[0028] (3) Perform an inverse transform on each transform domain result to obtain the augmented energy spectrum. This process is expressed as: ; ;

[0029] ; This generates multiple augmented energy spectra: ; for The inverse transform of .

[0030] These augmented spectra have consistent peak positions and relative intensity relationships with the original gamma spectra, and contain fluctuations within a physically reasonable range.

[0031] Subsequently, these augmented energy spectra are used as input data for a feature extraction network, which extracts the feature data of the augmented energy spectra. The feature extraction network can be any network structure capable of extracting high-dimensional features, such as a convolutional neural network consisting of one-dimensional convolutional layers, batch normalization layers, and activation functions.

[0032] In actual measurements, the original gamma spectrum is affected by random fluctuations in neutron source emission, detector electronic noise, and environmental radiation fluctuations, and a single measurement result usually contains random noise. In this embodiment, while keeping the channel positions of characteristic peaks and the relative intensities between peaks unchanged, the noise components in the spectrum are changed to generate multiple augmented spectra with the same characteristic peak identifiers as the original spectrum but different noise patterns. These augmented spectra are used as input data for the feature extraction network, thus expanding the training dataset without adding actual sample measurements; and in subsequent training, the prediction model can be exposed to a variety of reasonable spectral shape changes, thereby having a stronger tolerance to random noise and system drift in real measurements.

[0033] Optionally, in another embodiment, acquiring gamma spectrum data of the analyte and extracting feature data of the gamma spectrum data through a feature extraction network includes: acquiring a raw gamma spectrum of the analyte; augmenting the raw gamma spectrum to generate an augmented spectrum; stacking the raw gamma spectrum and the augmented spectrum in the channel dimension to form multi-channel spectrum data; using the multi-channel spectrum data as gamma spectrum data, and extracting feature data of the gamma spectrum data through a feature extraction network.

[0034] The difference between this embodiment and the previous embodiment is that the augmented energy spectrum is not used as a separate sample. Instead, the original gamma energy spectrum and the augmented energy spectrum are stacked into a multi-channel energy spectrum data, which is used as the input to the feature extraction network.

[0035] Specifically, the original gamma spectrum The shape is [1 Multiple augmented energy spectra were obtained through the augmentation process. , The number of augmented energy spectra generated for each original energy spectrum. The shape of each augmented spectrum is also [1]. Stacking along the channel dimension (i.e., the first dimension) yields a shape of [2]. Multichannel energy spectrum data (when using only one augmented energy spectrum) or in shape Multichannel energy spectrum data (using (When considering an augmented spectrum), or by combining all original spectra and their augmented spectra into a larger set, represented as: ; Multichannel energy spectrum data is used as input data for the feature extraction network.

[0036] The first layer of a feature extraction network typically uses a 1×1 convolution or a regular one-dimensional convolution. Its input channels are the number of stacked layers, and the output channels can be set to 16 or 32. Learnable linear weighted fusion is performed on multiple channel values ​​at each energy address. Then, the network layers continue to extract deeper features, ultimately outputting feature data.

[0037] The original gamma spectrum represents the ground-state signal in the actual measurement, while the augmented spectrum represents the perturbation signal within the physically permissible range. This embodiment stacks the original and augmented spectra in the channel dimension to form multi-channel energy spectrum data. This allows the feature extraction network to learn how to combine the stable components in the original gamma spectrum with the wave patterns in the augmented spectrum to extract common features that are insensitive to perturbations. This approach forces the prediction model to focus on the commonalities between the original and augmented spectra, suppressing overfitting to specific noise patterns and thus reducing overfitting during training.

[0038] Preferably, in another embodiment, the gamma-ray spectrum data of the analyte is acquired, and feature data of the gamma-ray spectrum data is extracted using a feature extraction network, including: The substance being tested is measured multiple times independently, and each measurement yields a raw gamma spectrum; A portion of the raw gamma spectrum obtained from multiple independent measurements is randomly selected and stacked along the channel dimension to form a multi-channel input tensor; the number of rows in the multi-channel input tensor is the number of selected raw gamma spectra, and the number of columns is the number of energy channels in each raw gamma spectrum; Select one raw gamma spectrum from multiple independent measurements as the target raw spectrum; augment the target raw spectrum to generate an augmented spectrum; stack the target raw spectrum and the augmented spectrum in the channel dimension to form multi-channel energy spectrum data. The first feature data is obtained by extracting feature data of the multi-channel input tensor through the first feature extraction network; the second feature data is obtained by extracting feature data of the multi-channel energy spectrum data through the second feature extraction network. The first feature data and the second feature data are concatenated along the channel dimension to obtain the fused feature data; the fused feature data is then used as the feature data extracted by the feature extraction network.

[0039] This embodiment utilizes statistical information from multiple measurements of the same source, as well as local correlation information between the original gamma spectrum and the augmented spectrum. The specific steps are as follows: (1) Multiple independent measurements The content of the same component in the tested substance is determined using a PGNAA device. Each measurement is performed independently, with a certain time interval between each measurement to ensure that the random noise and system fluctuations experienced by each measurement are independent of each other. Each measurement yields a raw gamma spectrum, denoted as the nth. The energy spectrum obtained from the measurement is , . After independent measurement The original gamma energy spectrum, this The energy spectra constitute the original gamma energy spectrum set: .

[0040] (2) Constructing a homogeneous multi-channel input tensor from Randomly selected from the original gamma spectrum indivual( ), will select The original gamma spectra are stacked along the channel dimension to form a multichannel input tensor. The number of rows in this multichannel input tensor is equal to the number of selected original gamma spectra. The column number represents the number of energy channels in each original gamma spectrum. A multi-channel input tensor contains multiple independent sampling results of the same substance under the same conditions.

[0041] (3) Constructing multi-channel energy spectrum data from One original gamma spectrum is randomly selected from the original energy spectra as the target original energy spectrum. The augmentation method described in the above embodiment is used to augment the target original energy spectrum to generate an augmented energy spectrum.

[0042] The original energy spectrum and the augmented energy spectrum of the target are stacked in the channel dimension to form a multi-channel energy spectrum data with the shape [2]. ].

[0043] (4) Dual-stream feature extraction The dual-stream feature extraction uses a first feature extraction network to extract feature data from the multi-channel input tensor as the first feature data; and a second feature extraction network to extract feature data from the multi-channel energy spectrum data as the second feature data.

[0044] The first and second feature extraction networks are two independent feature extraction networks. Their structures can be the same or different, and the network parameters of these two feature extraction networks are learned independently to adapt to the feature distribution of different types of inputs.

[0045] (5) Feature fusion The first and second feature data are concatenated along the channel dimension to obtain fused feature data, which serves as the final output feature data. This fused feature data simultaneously contains statistical information from multiple independent measurements, as well as comparative information between the original gamma spectrum and the augmented spectrum. The fused feature data is then used as the final output feature data of the entire feature extraction network.

[0046] Reference Figure 2 As shown, the feature extraction network structure of one embodiment of the present invention includes a first feature extraction network Net1, a second feature extraction network Net2, a concatenation module Concat, a backbone network Backbone, and a regression network Head Net. Net1 processes multi-channel energy spectrum data from multiple stacked measurements of the same source, while Net2 processes multi-channel data from the stacking of the original energy spectrum and its augmented energy spectrum. The outputs of both are concatenated by Concat and then fed into the Backbone for further feature extraction. Finally, the Head Net outputs the predicted elemental content values. Net1, Net2, and the Backbone can all be composed of one-dimensional convolutional layers, batch normalization layers, and activation function layers.

[0047] In this embodiment, the first feature data is extracted by stacking multiple independent measurements of the same substance's energy spectra into a multi-channel tensor. Adaptive weighted fusion of each channel reduces random noise variance while preserving stable characteristic peak information. The second feature data is extracted by stacking the original gamma spectrum and the augmented spectrum along the channel dimension, extracting features consistent with physical perturbations. Finally, two independent feature extraction networks extract the two feature data separately and concatenate them along the channel dimension to form fused feature data. This fused feature data simultaneously includes the signal features after statistical noise reduction from multiple measurements, as well as the perturbation consistency features of the original gamma spectrum and the augmented spectrum. Compared to the previous embodiment, this embodiment, under the condition of obtaining multiple independent measurements, further suppresses random noise by extracting the first feature data, resulting in a higher signal-to-noise ratio for the final fused feature data, making it particularly suitable for industrial scenarios with extremely low signal-to-noise ratios.

[0048] S2. Obtain the feature peak information of the target element; encode and fuse the feature peak information to generate a query vector for each feature peak; combine the query vectors of all feature peaks into a query matrix.

[0049] In this invention, the target element includes at least one known element of the substance being tested. The characteristic peak information includes the peak position address and peak amplitude value corresponding to each characteristic peak of the known element. For example, in coal analysis, known elements may include iron (Fe), silicon (Si), and calcium (Ca); in cement analysis, they may include calcium (Ca), silicon (Si), aluminum (Al), and iron (Fe).

[0050] Each known element typically has one or more characteristic peaks, each corresponding to a specific gamma-ray energy, which corresponds to a specific channel address in the energy spectrum; the peak amplitude value represents the expected count of the characteristic peak under noise-free ideal conditions and is proportional to the element content.

[0051] Specifically, the query vector contains both the peak location address information and the peak amplitude value information of the feature peak.

[0052] The positions and amplitudes of characteristic peaks of known elements are established prior knowledge in nuclear physics. By encoding this prior knowledge into query vectors, the network can actively focus on characteristic peak regions in the energy spectrum during training, thereby improving the accuracy of elemental content prediction. More importantly, in subsequent actual predictions, analysis can be performed only on unknown elements or regions independent of known peaks, thus reducing computational load, avoiding interference from known characteristic peaks, and further improving detection efficiency and accuracy.

[0053] Specifically, the query vector for each feature peak is generated by encoding and fusing the feature peak information, including: sinusoidal position encoding of the peak location address to obtain the position encoding vector; amplitude embedding encoding of the peak amplitude value to obtain the amplitude encoding vector; and adding the position encoding vector and amplitude encoding vector corresponding to the same feature peak to generate the query vector of the feature peak.

[0054] In one specific embodiment, the characteristic peak information is first represented as a vector.

[0055] Suppose that there are a total of known elements to be analyzed in the substance being tested. Species. For the first Types of elements ( The positions of all characteristic peaks of this element constitute a position vector. The amplitude values ​​corresponding to all characteristic peaks constitute an amplitude vector. Position vector and magnitude vector The lengths of both vectors are equal to the number of energy channels in the energy spectrum. Furthermore, both vectors have non-zero values ​​only at the channel addresses where the characteristic peaks are located; all other positions are zero.

[0056] For example, if the first The two characteristic peaks of the element are located at the address index. and The corresponding amplitudes are respectively and Then the position vector In the index The value at that location is ,exist The value at that location is The value at other positions is 0; magnitude vector In the index The value at that location is In the index The value at that location is The value at other positions is 0. Therefore, the position vector and magnitude vector They are represented as follows: ; ; In this invention, each characteristic peak is processed independently, denoted as the... The first element The peak location address of each characteristic peak is Peak amplitude value .in It is a non-negative integer. It is a positive real number.

[0057] In one specific embodiment, the peak position channel address is sinusoidally position encoded to obtain a position encoding vector, including: setting multiple frequencies, the multiple frequencies forming a geometric series; calculating the product of the peak position channel address and each of the multiple frequencies, and calculating the sine and cosine values ​​of all products; grouping the sine and cosine values ​​corresponding to each frequency into a group, arranging each group in ascending order of frequency value, and sequentially concatenating them to form a position encoding vector.

[0058] Specifically, the peak location address for each characteristic peak Perform sinusoidal positional encoding to obtain the positional encoding vector. Let the dimension of the encoding vector be... For dimensional indexes Calculate separately: ; ; In the formula: This represents the location encoding function, used to convert the track address value... Scalar values ​​mapped to a higher-dimensional space; and These represent the positions of even and odd indices in the encoding vector, respectively. By alternating between sine and cosine encoding, the encoding vectors of different addresses have a distinguishable periodic pattern. This represents the dimension value of the data points in the encoding vector, with a value range of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 3 ...4, 5, 1, 2, d]. The calculated sine and cosine values ​​are then processed according to... Arranged in ascending order, forming a length of... The vector, which is the position encoding vector of the feature peak, is denoted as . .

[0059] In one specific embodiment, amplitude embedding encoding is performed on the peak amplitude value to obtain an amplitude encoding vector, including: adding 1 to the peak amplitude value and taking the logarithm to obtain a logarithmic value; inputting the logarithmic value into a multilayer perceptron network for mapping to obtain the amplitude encoding vector.

[0060] Specifically, the peak amplitude value of each characteristic peak Amplitude embedding coding is performed to obtain the amplitude coding vector.

[0061] First, regarding the peak amplitude value Add 1 and take the logarithm to get the logarithmic value. Then, the numerical values ​​are input into a multilayer perceptron (MLP) network for mapping to obtain an amplitude encoding vector, represented as: ; In the formula: This represents the encoded amplitude encoding vector; These are the learnable parameters for a multilayer perceptron network. This represents matrix multiplication.

[0062] Specifically, the output dimension of the multilayer perceptron network is the same as the dimension of the position encoding vector.

[0063] In one specific embodiment, the position encoding vector corresponding to the same feature peak is added to the amplitude encoding vector to generate a query vector for the feature peak. , represented as: ; Query vector It also carries the location and intensity information of the characteristic peaks.

[0064] In one specific embodiment, the query vectors of all feature peaks are combined into a query matrix.

[0065] Iterate through all feature peaks of all known elements to generate a query vector corresponding to each feature peak. Then stack these query vectors row-wise to form a two-dimensional matrix, denoted as the query matrix. , represented as: ; Each row of the query matrix corresponds to a feature peak, and each column corresponds to a dimension of the encoding vector.

[0066] Through the above encoding process, the network can generate query vectors with clear physical meaning by utilizing prior knowledge of known elements during the training phase. In the subsequent attention mechanism, these query vectors will guide the network to actively focus on regions in the energy spectrum corresponding to known feature peaks, thereby improving the accuracy and stability of element content prediction.

[0067] Specifically, this invention encodes the feature peak positions and amplitudes of known elements during the training phase to generate a query vector. In actual prediction, since the query matrix contains feature peak information of known elements, the attention-enhanced features generated based on the query matrix also incorporate the feature peak information of known elements. Therefore, the prediction model can incorporate prior features of known elements during the processing of the attention-enhanced features. This allows the prediction model to more accurately identify information related to known elements. Furthermore, when the energy spectrum also contains other unknown elements, because the known elements can be accurately identified, the prediction model is less susceptible to interference from the feature peak signals of known elements when detecting unknown elements. This enables prediction based on cleaner data, thereby improving the accuracy and efficiency of prediction.

[0068] S3. Based on the query matrix and feature data, attention-enhanced features are calculated using an attention mechanism.

[0069] Specifically, based on the query matrix and feature data, attention-enhanced features are calculated using an attention mechanism, including: Multiply the feature data by the first weight matrix and the second weight matrix respectively to obtain the key matrix and the value matrix; The query matrix is ​​used as the query input of the attention mechanism, the key matrix is ​​used as the key input of the attention mechanism, and the value matrix is ​​used as the value input of the attention mechanism. The product of the query matrix and the transpose of the key matrix is ​​calculated, and the product result is scaled and normalized to obtain the attention weight matrix. Multiplying the attention weight matrix by the value matrix yields the attention-enhanced features.

[0070] In a specific embodiment, the feature data obtained in step S1 is denoted as Feature data It is a two-dimensional matrix with the shape [number of channels, number of energy addresses].

[0071] First, the feature data Multiply by the first weight matrix respectively Second weight matrix The key matrix is ​​obtained. Sum matrix , respectively represented as: ; ; In the formula: and Both are learnable parameter matrices that are continuously updated during training. Key matrix Used to calculate similarity with the query matrix, value matrix Used to carry feature content that needs to be extracted with attention weighting.

[0072] Then, query matrix The key matrix serves as the query input for the attention mechanism. The value matrix serves as the key input to the attention mechanism. The values ​​are used as input to the attention mechanism. The product of the query matrix and the transpose of the key matrix is ​​calculated, and the product is scaled and normalized to obtain the attention weight matrix. The attention weight matrix is ​​then multiplied by the value matrix to obtain the single-head attention output. , represented as: ; In the formula: This represents the product of the query matrix and the transpose of the key matrix; Scaling factor Key matrix The dimension of each key vector in the matrix is ​​adjusted, and scaling the product result can prevent the dot product value from becoming too large, causing the Softmax function to enter the gradient saturation region. The Softmax function normalizes each row of the product result matrix so that the sum of the weights of each row is 1.

[0073] To ensure shared information across different representation subspaces, this invention employs a multi-head attention mechanism. Specifically, the query matrix, key matrix, and value matrix are respectively... Several different linear transformations, each using a different learnable weight matrix. Let the index of the head be... , No. The query, key, and value linear transformation matrices for each head are respectively , , For each transformed result, perform the above scaling dot product cross-attention calculation to obtain the... A person's attention , represented as: ; In the formula: This represents the scaled dot product cross attention function, and then this The outputs of each head are concatenated along the channel dimension to obtain the output of multi-head attention. , represented as: ; In the formula: This indicates a splicing operation at the channel dimension.

[0074] To alleviate the vanishing gradient problem in deep networks and accelerate training, this invention adds a residual connection after the multi-head attention output, followed by layer normalization. Specifically, the feature data... The sum is added to the multi-head attention output, and then the sum is layer-normalized to obtain the final attention-enhanced feature. , represented as: ; In the formula: Presentation layer normalization operation.

[0075] For each query vector (each feature peak), the features at each position in the value matrix are summed according to the attention weights, thereby concentrating the feature information of the energy spectrum region related to the feature peak into the output of the query vector.

[0076] Through the above process, the attention enhancement features are finally obtained. It integrates physical prior-guided query information with deep features of the energy spectrum.

[0077] S4. Input the attention-enhanced features into the regression network to predict the element content and obtain the predicted element content value.

[0078] Specifically, after obtaining the attention-enhanced features, they are input into a regression network for element content prediction. The input dimension of the regression network matches the feature dimension of the attention-enhanced features, and the output dimension of the regression network equals the number of element types to be predicted, with each dimension corresponding to the predicted content value of one element.

[0079] The regression network can be a single-layer or multi-layer fully connected network. This regression network maps attention-enhanced features to predicted content values ​​for each element.

[0080] Since the attention-enhanced features are already guided by physical priors to focus on known feature peak regions, the regression network can learn the mapping relationship between element content and energy spectrum features more accurately, thereby improving the accuracy of prediction.

[0081] S5. Calculate the loss between the predicted value and the true value, and update the network parameters based on the loss.

[0082] Specifically, during the training phase, for each training sample, the loss between the predicted value and the true value is calculated. The loss function is typically the mean squared error (MSE) or the mean absolute error (MAE).

[0083] After calculating the loss between the predicted and true values, the gradients of all trainable parameters in the prediction model are calculated using the backpropagation algorithm.

[0084] Specifically, the prediction model is a complete end-to-end structure that takes raw gamma-ray spectral data as input and outputs predicted elemental content values. Trainable parameters include: parameters of the feature extraction network, the first weight matrix, the second weight matrix, the linear transformation matrices in the multi-head attention mechanism, the parameters of the multilayer perceptron network, and the parameters of the regression network. An optimizer then updates these parameters based on gradients to minimize the loss function.

[0085] Figure 3 A schematic diagram of the structure of a prediction model provided in an embodiment of this application is shown. (Refer to...) Figure 3 As shown, the prediction model includes a feature extraction network, an attention mechanism module, and a regression network. Feature extraction networks Net1 and Net2 extract features from homologous multi-channel data and augmented multi-channel data, respectively, and fuse them to obtain a feature vector F. Based on feature vector F, key vector K and value vector V are extracted. The physical encoding module generates a query vector Q by sequentially encoding the element feature peak information through sinusoidal position encoding and amplitude embedding encoding. The attention module performs scaling dot product cross-attention, multi-head fusion, residual connections, and layer normalization based on the query vector Q, key vector K, and value vector V, outputting attention-weighted features. The regression network Head Net predicts the element content based on these features.

[0086] Through multiple iterations of training, the network gradually learns an accurate mapping from energy spectrum data to elemental content. Once training is complete, the network can be used to predict the elemental content of real samples.

[0087] Through multiple iterations of training, the entire prediction model gradually learns an accurate mapping from energy spectrum data to elemental content. Once trained, the prediction model can be used to predict the elemental content of actual samples.

[0088] The training method of this invention, by introducing physical prior encoding and attention mechanisms, can effectively suppress noise and enhance features under limited sample conditions, resulting in faster convergence and stronger generalization ability of the prediction model. Simultaneously, since the query matrix only contains feature peak information of known elements, when encountering unknown elements during actual prediction after training, the feature peak information of the unknown element can be used to generate a new query vector according to the same encoding method and added to the query matrix or used separately. This allows prediction of the content of the unknown element without retraining the entire prediction model, thereby reducing the cost of expanding the prediction model and avoiding interference from known peaks in the detection of unknown peaks, thus improving detection efficiency and accuracy.

[0089] Furthermore, this application also provides a training system for homologous gamma-ray spectrum data, used to implement the above-mentioned method for training homologous gamma-ray spectrum data. The system includes: The data acquisition module is used to acquire the gamma spectrum data of the substance being tested, and to extract the feature data of the gamma spectrum data through a feature extraction network. Obtain characteristic peak information of the target element; the target element includes at least one known element of the substance being measured, and the characteristic peak information includes the peak position address and peak amplitude value corresponding to each characteristic peak of the known element; The attention mechanism module is used to encode and fuse based on the feature peak information to generate a query vector for each feature peak; the query vector contains both the peak location address information and the peak amplitude value information of the feature peak. Combine the query vectors of all feature peaks into a query matrix; Based on the query matrix and feature data, attention-enhanced features are calculated using an attention mechanism. The prediction module is used to input attention-enhanced features into the regression network to predict element content and obtain the predicted element content value. The training module is used to calculate the loss between the predicted and the true values ​​and to update the network parameters based on the loss.

[0090] In another aspect, this application also provides an electronic device, comprising: The memory and processor are interconnected and communicate with each other. The memory stores computer instructions, and the processor executes the computer instructions to carry out the above-mentioned homologous heterogeneous gamma spectrum data training method.

[0091] Reference Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of an electronic device provided in an optional embodiment of the present invention. This electronic device can be a computer device used to execute the above-described method. Figure 4 As shown, the electronic device includes one or more processors 10, a memory 20, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processor can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces).

[0092] The processor 10 may further include a hardware chip. This hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0093] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0094] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the use of the electronic device based on the display of a mini-program landing page. Furthermore, the memory 20 may include high-speed random access memory (RAM), and may also include non-transient memory, such as at least one disk storage device, flash memory device, or other non-transient solid-state storage device. The memory 20 may include volatile memory, such as RAM; the memory may also include non-volatile memory, such as flash memory, hard disk, or solid-state drive; the memory 20 may also include combinations of the above types of memory.

[0095] The electronic device also includes a communication interface 30 for communicating with other devices or communication networks.

[0096] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0097] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0098] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A method for training homologous gamma-ray spectral data, characterized in that, The method includes: Gamma spectrum data of the substance being tested is acquired, and feature data of the gamma spectrum data is extracted using a feature extraction network. Obtain characteristic peak information of the target element; the target element includes at least one known element of the substance being tested, and the characteristic peak information includes the peak position address and peak amplitude value corresponding to each characteristic peak of the known element; The characteristic peak information is encoded and fused to generate a query vector for each characteristic peak; the query vector contains both the peak location address information and the peak amplitude value information of the characteristic peak. Combine the query vectors of all feature peaks into a query matrix; Based on the query matrix and the feature data, attention-enhanced features are calculated using an attention mechanism. The attention-enhanced features are input into a regression network to predict element content, and the predicted element content values ​​are obtained. Calculate the loss between the predicted value and the actual value, and update the network parameters based on the loss; The step of encoding and fusing the feature peak information to generate a query vector for each feature peak includes: The peak position address is sinusoidally position-coded to obtain a position-coded vector; The peak amplitude value is subjected to amplitude embedding encoding to obtain an amplitude encoding vector; The position encoding vector corresponding to the same feature peak is added to the amplitude encoding vector to generate the query vector of the feature peak; The step of calculating attention-enhanced features based on the query matrix and the feature data using an attention mechanism includes: The feature data are multiplied by the first weight matrix and the second weight matrix respectively to obtain the key matrix and the value matrix; Using the query matrix as the query input of the attention mechanism, the key matrix as the key input of the attention mechanism, and the value matrix as the value input of the attention mechanism, the product of the query matrix and the transpose of the key matrix is ​​calculated, and the product result is scaled and normalized to obtain the attention weight matrix. Multiplying the attention weight matrix by the value matrix yields the attention enhancement feature.

2. The method for training homologous gamma-ray spectral data according to claim 1, characterized in that, The step of performing sinusoidal position encoding on the peak position address to obtain a position encoding vector includes: Multiple frequencies are set, and the multiple frequencies form a geometric series; Calculate the product of the peak position channel address and each of the plurality of frequencies, and calculate the sine and cosine values ​​of all products; The sine and cosine values ​​corresponding to each frequency are grouped together, and the groups are arranged in order of frequency value from low to high. They are then concatenated to form the position encoding vector.

3. The method for training homologous gamma-ray spectral data according to claim 1, characterized in that, The step of performing amplitude embedding encoding on the peak amplitude value to obtain an amplitude encoding vector includes: adding 1 to the peak amplitude value and taking the logarithm to obtain a logarithmic value; The logarithmic input is mapped to the multilayer perceptron network to obtain the amplitude encoding vector; the output dimension of the multilayer perceptron network is the same as the dimension of the position encoding vector.

4. The method for training homologous gamma-ray spectral data according to any one of claims 1 to 3, characterized in that, The process of acquiring the gamma-ray spectrum data of the analyte, and extracting feature data from the gamma-ray spectrum data using a feature extraction network, includes: Obtain a raw gamma spectrum of the substance being tested; The original gamma spectrum is reversibly transformed to map it to the transform domain. In the transform domain, the transformation result is filtered or random noise is added. Then, the inverse transformation is performed to generate the augmented spectrum. The augmented energy spectrum is used as gamma energy spectrum data, and feature data of the gamma energy spectrum data is extracted by a feature extraction network.

5. The method for training homologous gamma-ray spectral data according to any one of claims 1 to 3, characterized in that, The process of acquiring the gamma-ray spectrum data of the analyte, and extracting feature data from the gamma-ray spectrum data using a feature extraction network, includes: Obtain a raw gamma spectrum of the substance being tested; The original gamma spectrum is augmented to generate an augmented spectrum; The original gamma spectrum and the augmented spectrum are stacked in the channel dimension to form multi-channel energy spectrum data; The multi-channel energy spectrum data is used as gamma energy spectrum data, and feature data of the gamma energy spectrum data is extracted by a feature extraction network.

6. The method for training homologous gamma-ray spectral data according to any one of claims 1 to 3, characterized in that, The process of acquiring the gamma-ray spectrum data of the analyte, and extracting feature data from the gamma-ray spectrum data using a feature extraction network, includes: The substance being tested is measured multiple times independently, and each measurement yields a raw gamma spectrum; A portion of the raw gamma spectrum obtained from the multiple independent measurements is randomly selected and stacked along the channel dimension to form a multi-channel input tensor; the number of rows in the multi-channel input tensor is the number of selected raw gamma spectra, and the number of columns is the number of energy channels in each raw gamma spectrum; Select one of the original gamma spectra obtained from the multiple independent measurements as the target original energy spectrum; augment the target original energy spectrum to generate an augmented energy spectrum; stack the target original energy spectrum and the augmented energy spectrum in the channel dimension to form multi-channel energy spectrum data; The first feature data is obtained by extracting feature data of the multi-channel input tensor through a first feature extraction network; the second feature data is obtained by extracting feature data of the multi-channel energy spectrum data through a second feature extraction network. The first feature data and the second feature data are concatenated along the channel dimension to obtain fused feature data; the fused feature data is used as the feature data extracted by the feature extraction network.

7. A training system for homologous gamma-ray spectral data, used to implement the training method for homologous gamma-ray spectral data according to any one of claims 1 to 6, characterized in that, The system includes: The data acquisition module is used to acquire the gamma spectrum data of the substance being tested, and to extract the feature data of the gamma spectrum data through a feature extraction network. Obtain characteristic peak information of the target element; the target element includes at least one known element of the substance being tested, and the characteristic peak information includes the peak position address and peak amplitude value corresponding to each characteristic peak of the known element; The attention mechanism module is used to encode and fuse the feature peak information to generate a query vector for each feature peak; the query vector simultaneously contains the peak position address information and peak amplitude value information of the feature peak. Combine the query vectors of all feature peaks into a query matrix; Based on the query matrix and the feature data, attention-enhanced features are calculated using an attention mechanism. The prediction module is used to input the attention-enhanced features into the regression network to predict the element content and obtain the predicted element content value. The training module is used to calculate the loss between the predicted value and the true value, and update the network parameters based on the loss.

8. An electronic device, characterized in that, include: A memory and a processor are interconnected, the memory stores computer instructions, and the processor executes the computer instructions to perform the homologous gamma spectral data training method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Gamma-ray spectrum data processing method and device, equipment and medium

    CN121955055A

  • Gamma-ray spectrum filtering method and system based on mixed deep learning architecture

    CN122042723A