Beta liquid multi-channel spectrometer processing method based on transformer

By using a Transformer-based multichannel energy spectrum processing method, the problems of low efficiency, insufficient accuracy, and weak anti-interference ability in existing technologies are solved, achieving efficient and accurate nuclide detection and meeting the real-time requirements of nuclear power plant leak monitoring.

CN122194227APending Publication Date: 2026-06-12XIAN CNNC NUCLEAR INSTRUMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610659697.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-14
Publication Date
2026-06-12

Smart Images

  • Figure CN122194227A_ABST
    Figure CN122194227A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on Transform's β liquid multichannel energy spectrum processing method, belong to artificial intelligence auxiliary nuclear instrument data technical field.The coding layer of the energy spectrum data prediction model of the present application adopts the multistage MCFormer module stacking structure, realizes local channel feature extraction, long-distance dependence capture and timing feature fusion in stages, avoid the inefficiency of traditional algorithm processing by channel, improve processing efficiency and accurately capture energy spectrum characteristics.The decoding layer replaces the multi-head attention of 2 MCFormer modules with cross-attention, improves the resolution accuracy of overlapping peaks, weakens the influence of noise and baseline drift, and reduces the misjudgment rate.Batch embedding layer generates timing features and fuses them, adapting to the timing characteristics of energy spectrum.The output layer is processed by a fully connected layer and L-Softmax, and combined with a threshold determination to avoid the defects of conventional Transformer output results that are not convenient to apply, meeting the actual detection needs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence-assisted nuclear instrument data technology, specifically relating to a Transformer-based method for processing β-liquid multichannel energy spectrometers. Background Technology

[0002] In the field of nuclear physics detection, scintillation detectors, with their high sensitivity and fast response characteristics, have become the core device for particle energy measurement. Traditional nuclide energy spectrum analysis mainly relies on manual feature extraction and statistical matching algorithms, such as methods based on background subtraction, peak shape fitting, and nuclide library matching. These methods have significant shortcomings in multichannel data processing and are difficult to meet practical detection needs. First, multi-channel parallel processing is inefficient. Traditional methods require processing pulse signals one channel at a time, which cannot fully utilize the hardware's parallel computing capabilities, making it difficult to meet the real-time requirements of scenarios such as nuclear power plant leak monitoring. Second, the accuracy of overlapping peak resolution is insufficient. In complex scenarios, when multiple nuclide energy peaks overlap, traditional algorithms struggle to accurately separate their contributions, resulting in a high misjudgment rate. Third, the resistance to noise and baseline drift is weak. Detector signals are easily affected by environmental noise and electronic drift. Traditional linear processing methods cannot effectively distinguish between real pulses and noise, leading to a significant decrease in signal-to-noise ratio in low count rate scenarios. Fourth, the correction of cascade coincidence additive effects is difficult. Existing correction algorithms have high computational complexity and are difficult to dynamically adapt to changing detection environments.

[0003] To address some of the aforementioned issues, Convolutional Neural Networks (CNNs), with their feature extraction capabilities, have been applied to nuclear spectroscopy and particle recognition. By extracting local spatial / temporal features through convolutional kernels, they improve the ability to recognize complex waveforms. However, CNNs have inherent limitations: the kernel size is fixed, the receptive field is limited to a local area, making it difficult to model long sequences or long-range dependencies between multiple channels. Furthermore, they require additional preprocessing for sequence data, are prone to missing global context when processing large-scale, multi-channel correlated data, and are sensitive to data noise or variations; the correction effect depends heavily on the quality of the training set.

[0004] The self-attention mechanism introduced by the Transformer architecture enables global context modeling, can process long sequence inputs in parallel, and preserves sequence information through positional encoding. Theoretically, it is more suitable for modeling long-distance dependencies and multi-channel interactions. Compared with CNN, it has a natural advantage in global modeling and is more suitable for signal processing with strong channel correlation and temporal evolution characteristics, such as multi-channel energy spectrum.

[0005] However, directly applying Transformer to β-liquid scintillation multichannel energy spectrum data processing still faces many intractable technical challenges: 1) Long sequence lengths: Multichannel spectra typically have thousands of channels, making direct calculation of the full attention matrix highly time-space complex; 2) Local features are easily diluted: While global attention can capture long-range dependencies, it may weaken key morphological features such as local peak shape and full width at half maximum (FWHM); 3) Noise and drift interference: Energy spectrum data are often accompanied by baseline drift, noise impulses, and other interferences, and global attention may amplify the noise effect; 4) Insufficient fusion of temporal information: The position encoding of traditional Transformer is mostly static, making it difficult to flexibly fuse dynamic temporal information such as measurement time and count rate changes.

[0006] In summary, existing methods for processing β-liquid scintillation multichannel energy spectrum data suffer from low efficiency, insufficient accuracy, weak anti-interference capability, and poor temporal fusion. Summary of the Invention

[0007] The technical problem to be solved by the present invention is to provide a β liquid multichannel energy spectrum processing method based on Transformer to address the shortcomings of the prior art. The method has a novel and reasonable design, which takes into account both global dependency capture and local feature extraction, improves the efficiency, accuracy and anti-interference ability of energy spectrum data processing, and meets the actual needs of nuclide detection.

[0008] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows: The Transformer-based β-liquid multichannel energy dispersive spectroscopy method includes the following steps: S1. Use a scintillation detector to measure the nuclide energy spectrum of the sample under test to obtain raw multichannel energy spectrum data; preprocess the raw multichannel energy spectrum data. S2. Construct an energy spectrum data prediction model based on the Transformer network. The Transformer network includes an input layer, a batch embedding layer, an encoding layer, a feature fusion layer, a decoding layer, and an output layer. The input layer is used to receive preprocessed multichannel energy spectrum data and convert it into batched sequence data. The batch embedding layer receives the batched sequence data output by the input layer, performs positional encoding on it, generates an embedding feature sequence of [B,L,D] dimensions, and inputs it into the encoding layer; The encoding layer comprises a first stage, a second stage, and a third stage arranged sequentially. Each stage is constructed by stacking MCFormer modules that include a multi-head attention mechanism. The first stage is used to extract local channel features from the embedded feature sequence. The second stage is used to capture long-distance dependencies between channels. The third stage is used to fuse the output features of the second stage with temporal features and further encode them to output the third stage feature data. The temporal features are generated by the batch embedding layer. The feature fusion layer is used to perform layer normalization and feedforward neural network transformation on the feature data of the third stage in sequence, and output fused features. The decoding layer consists of two stacked MCFormer modules, which are used to perform cross-attention interaction between the fused features and the target sequence, and output a decoded feature vector to achieve matching between the nuclide label sequence and the input energy spectrum features. The output layer is used to process the decoded feature vector through a fully connected layer and output the probability of existence of various nuclides. Based on the probability of existence of various nuclides, by comparing it with a preset probability threshold, when the probability of existence of a nuclide is greater than or equal to the preset probability threshold, the corresponding nuclide is determined to exist, and the position of the nuclide data in the energy spectrum is determined according to the determination result, and the type and content of each nuclide are output. S3. Use historical multichannel energy spectrum data as input to the energy spectrum data prediction model, and use the nuclide type and probability value corresponding to each channel data as the label of the energy spectrum data prediction model to conduct supervised training of the model. S4. Use the pre-processed multichannel energy spectrum data of the sample to be tested as the input of the trained energy spectrum data prediction model, and output the corresponding nuclide types and probability values ​​to realize the detection of nuclides in the sample to be tested.

[0009] Furthermore, the preprocessing includes data cleaning and normalization; Normalization employs a baseline correction method to process the data, where the correction formula is:

[0010] in, For the first The energy value after correction. The original channel number. The value ranges from 0 to 4095; For scale coefficients, The value ranges from 0.1 to 0.5. The value ranges from 0 to 5; for The residual error value of the channel. The value ranges from -0.5 to 0.5 keV.

[0011] Furthermore, the temporal features are generated by the batch embedding layer through two-dimensional sine / cosine coding of the batch sequence data output from the input layer. For each time step T and channel L, a unique D-dimensional position vector is generated, resulting in temporal feature values ​​of [B,L,D] dimensions.

[0012] Furthermore, the embedded feature sequence output from the batch embedding layer to the coding layer is obtained by adding the position-encoded embedded feature sequence to the additional features element by element; The additional features are calculated based on the quenching index of the energy spectrum, which includes the mean channel address, the centroid channel address, and the peak-to-valley ratio of the energy spectrum.

[0013] Furthermore, the MCFormer module consists of four parallel processing branches, a first normalization layer, a multilayer perceptron (MLP), and a second normalization layer. The four parallel processing branches include: The original scale branch is used to perform multi-head self-attention computation on the input features; The double-scale branch is used to sequentially perform double downsampling, multi-head self-attention calculation, and double upsampling on the input features; The quad-scale branch is used to sequentially perform quad-downsampling, multi-head self-attention calculation, and quad-upsampling on the input features; The residual identity branch is used to directly pass input features; The output features of the four parallel processing branches are added element by element in the first residual addition unit, and after multi-scale feature fusion, they are output to the first normalization layer. The features normalized by the first normalization layer are input into the multilayer perceptron (MLP), and after nonlinear feature transformation, they are output to the second normalization layer. The features normalized by the second normalization layer are residually connected with the output features of the first normalization layer to output enhanced features.

[0014] Furthermore, in the coding layer, the first stage stacks four MCFormer modules, whose multi-head attention mechanism introduces a local window mechanism, and the window size is set according to the full width at half maximum (FWHM) of the energy spectrum; the second stage stacks four MCFormer modules, and the window size of its multi-head attention mechanism is the length L of the complete sequence; the third stage stacks two MCFormer modules, which receive the fused features after the feature data of the second stage and the temporal features are added element by element along the feature dimension, and output the feature data of the third stage.

[0015] Furthermore: the total loss function of the energy spectrum data prediction model is the sum of the cross-entropy loss function and the zoom loss function; the model is optimized by minimizing the total loss function.

[0016] Furthermore, the expression for the cross-entropy loss function is:

[0017] in, The total number of nuclide categories, To determine whether a true label for a type c nuclide exists, It is 0 or 1. The first prediction model for energy spectrum data. The probability of a nuclide; The expression for the zoom loss function is as follows:

[0018] in, , This is the weighting coefficient for positive and negative samples. =1; is the modulation factor.

[0019] Furthermore, the output layer uses the L-Softmax activation function to perform angular interval transformation on the logic values ​​output by the fully connected layer. After transformation, the probability distribution of various nuclides is obtained by Softmax. Angular interval transformation refers to: transforming the cosine value of the target class Replace with ,in, The angle between the target class weight vector and the input decoded feature vector in the fully connected layer; It is the target class cosine replacement value after angular interval transformation, in order to learn a larger classification margin; It is an integer used to prevent gradient vanishing; non-target class logical values ​​remain unchanged.

[0020] Furthermore, the preset probability threshold is 0.75.

[0021] Compared with the prior art, the present invention has the following advantages: This invention constructs an energy spectrum data prediction model based on a Transformer network. The encoding layer adopts a multi-stage MCFormer module stacking structure. The first stage focuses on local channel feature extraction, the second stage captures long-range dependencies, and the third stage fuses temporal features. This avoids the inefficiency of traditional algorithms processing channel by channel and overcomes the shortcomings of conventional Transformer global attention diluting local features and CNN's difficulty in modeling long-range dependencies. It achieves parallel processing of multi-channel data, significantly improving processing efficiency, while accurately capturing local peak shapes and cross-channel global correlations in the energy spectrum. The decoding layer replaces the multi-head attention mechanism with a cross-attention mechanism through two MCFormer modules. Combined with layer normalization and feedforward neural network transformation in the feature fusion layer, it strengthens the interaction matching between fused features and target sequences, effectively improving the accuracy of overlapping peak resolution. At the same time, it reduces the impact of environmental noise and baseline drift on the processing results, solving the problems of weak anti-interference ability of traditional algorithms and CNN's sensitivity to noise, and reducing the nuclide misclassification rate. The input sequence is positionally encoded through a batch embedding layer, generating temporal feature values ​​in the [B, L, D] dimensions. Combined with the temporal feature fusion design in the third stage of the encoding layer, the model is better adapted to the temporal evolution characteristics of multi-channel energy spectrum data, further improving the accuracy of nuclide detection. The output layer processes the decoded feature vector through a fully connected layer and L-Softmax, and determines the presence of nuclides based on preset probability thresholds, outputting the nuclide type and content. This avoids the limitation of conventional Transformers applied to energy spectrum processing, where the output results are difficult to use directly for actual detection, meeting the practical needs of scenarios such as nuclear power plant leak monitoring.

[0022] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0023] Figure 1 This is a schematic flowchart of the Transformer-based β-liquid multichannel energy dispersive spectroscopy method of the present invention.

[0024] Figure 2 This is a schematic diagram of the improved Transformer network structure according to an embodiment of the present invention.

[0025] Figure 3 This is a schematic diagram of the MCF structure according to an embodiment of the present invention.

[0026] Figure 4 This is a performance comparison chart of the improved Transformer network and the original VisionTransformer network according to an embodiment of the present invention.

[0027] Figure 5 This is a multi-energy nuclide energy spectrum according to an embodiment of the present invention.

[0028] Figure 6This is the energy spectrum of a tritium-carbon mixed β nuclide according to an embodiment of the present invention. Detailed Implementation

[0029] Example of a Transformer-based β-liquid multichannel energy dispersive spectroscopy processing method: like Figure 1-6 As shown, the present invention includes a Transformer-based β-liquid multichannel energy dispersive spectroscopy (EDS) method, comprising the following steps: S1. The sample to be tested is subjected to nuclide energy spectrum measurement using a scintillation detector to obtain raw multichannel energy spectrum data; the raw multichannel energy spectrum data is then preprocessed. Preferably, a Cr135 liquid scintillation instrument is used as the scintillation detector. The measured data is stored in a three-dimensional raw matrix format of channel-count value-timestamp, i.e., each data unit contains: channel number 0 to 4095, particle count of the corresponding channel, measurement timestamp, and other information.

[0030] Raw data acquisition often contains a large amount of interference, making preprocessing crucial for ensuring the accuracy of subsequent processing. During the measurement, the liquid scintillation instrument acquires the pulse height spectrum of the sample and distributes the signal to three 4096 energy channels for accumulation. The acquired data includes the count sequence for each channel and the corresponding timestamp.

[0031] The preprocessing described above includes data cleaning and normalization. Normalization employs a baseline correction method, where the correction formula is:

[0032] in, For the first The energy value after correction. The original channel number. The value ranges from 0 to 4095; For scale coefficients, The value ranges from 0.1 to 0.5. The value ranges from 0 to 5; for The residual error value of the channel. The value ranges from -0.5 to 0.5 keV.

[0033] S2. Construct an energy spectrum data prediction model based on the Transformer network. The Transformer network includes an input layer, a batch embedding layer, an encoding layer, a feature fusion layer, a decoding layer, and an output layer.

[0034] The aforementioned input layer is used to receive preprocessed multichannel energy spectrum data and convert it into batched sequence data.

[0035] The batch embedding layer receives the batched sequence data output from the input layer, performs positional encoding on it, generates an embedding feature sequence of [B,L,D] dimensions, and inputs it into the encoding layer. Specifically, the embedding feature sequence output from the batch embedding layer to the encoding layer is obtained by adding the positionally encoded embedding feature sequence to additional features element by element. The additional features are calculated based on the quenching index of the energy spectrum, which includes the mean channel address, centroid channel address, and peak-to-valley ratio of the energy spectrum. The mean channel address, centroid channel address, and peak-to-valley ratio are concatenated into a quenching index vector, which is then mapped to an additional feature vector with the same dimension D as the embedding features through a feedforward neural network. The additional feature vector is then copied and extended along the sequence length dimension L to obtain an extended additional feature tensor with the same dimensions [B,L,D] as the embedding feature sequence, and then added element by element.

[0036] The changes in data dimensions during the process of transforming raw data into time-series features are shown in Table 1 below: Table 1

[0037] The aforementioned encoding layer comprises a first stage, a second stage, and a third stage arranged sequentially. Each stage is constructed using stacked MCFormer modules incorporating a multi-head attention mechanism. For example, Figure 3 As shown in the figure For the module's input, The output of the module; the MCFormer module consists of 4 parallel processing branches, a first normalization layer, a multilayer perceptron (MLP), and a second normalization layer; the 4 parallel processing branches include: The original scale branch is used to perform multi-head self-attention computation on the input features; The double-scale branch is used to sequentially perform double downsampling, multi-head self-attention calculation, and double upsampling on the input features; The quad-scale branch is used to sequentially perform quad-downsampling, multi-head self-attention calculation, and quad-upsampling on the input features; The residual identity branch is used to directly pass input features; The output features of the four parallel processing branches are added element-wise in the first residual addition unit. After multi-scale feature fusion, the features are output to the first normalization layer. The features normalized by the first normalization layer are input to the multilayer perceptron (MLP), where they undergo nonlinear feature transformation and are output to the second normalization layer. The features normalized by the second normalization layer are residually concatenated with the output features of the first normalization layer to output enhanced features.

[0038] 1) The first stage is used for local channel feature extraction of the embedded feature sequence. Specifically, in the coding layer, the first stage stacks four MCFormer modules, whose multi-head attention mechanism introduces a local window mechanism. The window size is set according to the full width at half maximum (FWHM) of the energy spectrum. The window size W is set according to the ratio of the FWHM of the target energy peak to the channel density in the energy spectrum of the nuclide to be measured. When the energy scale is refined to 0.05 keV per channel and the target nuclide... 3 When the full width at half maximum (FWHM) of the energy peak H is approximately 0.2 keV, it corresponds to about 4 channels. Therefore, W=4 is set so that the local attention window exactly covers the FWHM range of the energy peak, achieving accurate local feature extraction. Each MCFormer module has a window size of 4, and performs multi-scale local feature extraction through four parallel branches: original scale, double scale, quadruple scale, and residual identity. The input dimension is (1024, 4), and the output dimension remains unchanged. This stage mainly captures the local morphological features such as peak shape and FWHM of adjacent channels in the energy spectrum. Here, adjacent channels refer to the range of 1 to 2 channels on either side of the current channel, i.e., a total of 3 or 5 channels.

[0039] 2) The second stage is used to capture long-range dependencies between channels. This stage stacks four MCFormer modules, with the window size of its multi-head attention mechanism being the length L of the complete sequence. In this stage, attention weights between all 1024 channels are calculated using a self-attention mechanism to capture global dependencies between non-adjacent channels, such as the correlation between the Compton plateau and the full-energy peak. The output dimension remains (1024, 4). 3) The third stage fuses the output features of the second stage with the temporal features and further encodes them to output the third-stage feature data. The third stage stacks two MCFormer modules, receiving the fused features obtained by element-wise addition of the second-stage feature data and the temporal features along the feature dimension, and outputs the third-stage feature data. In this stage, combined with the temporal position encoding in the batch embedding layer, a self-attention mechanism is used to model the evolution trend of the feature sequence with energy, strengthening the perception of the overall energy spectrum contour. The output is encoded feature data with a dimension of (1024, 4). By using the temporal encoding corresponding to the channel number as explicit input to participate in the self-attention calculation, the model can dynamically adjust the feature representation according to changes in channel order or temporal order, thereby modeling the evolution trend of the energy spectrum with the energy axis or measurement time.

[0040] The temporal features are generated by the batch embedding layer through two-dimensional sine / cosine coding of the batch sequence data output from the input layer. For each time step T and channel L, a unique D-dimensional position vector is generated, resulting in temporal feature values ​​of [B,L,D] dimensions.

[0041] Specifically, in the batch embedding layer, for each time step t (t=0,1,…,T) 1) and each channel number i (i=0,1,…,L) 1) Generate a unique temporal location encoding vector Ptime(t,i)∈ , It is the set of all ordered arrays consisting of D real number components. The encoding formula uses two-dimensional sine / cosine encoding: Ptime(t,i,2N)=sin( )+sin( ) Ptime(t,i,2N+1)=cos( )+cos( ) Where N is the dimension pair index, used to traverse the dimension pairs of the embedded vector, N=0,1,2,…, 2N is the even-numbered dimension index, representing the even-numbered position dimension in the embedding vector, 2N∈{0,2,4…,D-2}, and 2N+1 is the cardinal-numbered dimension index, representing the odd-numbered position dimension in the embedding vector, 2N+1∈{1,3,5…,D-1}.

[0042] In the batch embedding layer, not only are the channel numbers encoded using sine / cosine position coding, but the measurement timestamps are also encoded as periodic vectors, forming a temporal position coding. The fused features are then passed through layer normalization and a feedforward neural network sequentially to obtain the final fused features. This approach allows the model to retain the original temporal information in deep features, enhancing its adaptability to dynamic changes.

[0043] The changes in data dimensions in the three stages of the encoding layer are shown in Table 2 below: Table 2

[0044] The aforementioned feature fusion layer is used to sequentially perform layer normalization and feedforward neural network transformation on the feature data of the third stage, outputting fused features. The feedforward neural network contains 256 neurons and outputs fused features with dimensions of (1024, 256).

[0045] The decoding layer consists of two stacked MCFormer modules, used to perform cross-attention interaction between the fused features and the target sequence, outputting a decoded feature vector to achieve matching between the nuclide label sequence and the input energy spectrum features; that is, the multi-head attention mechanism in the two MCFormer modules is replaced with a cross-attention mechanism. Specifically, the cross-attention module uses the current decoder state as the query and the encoded feature data output by the encoding layer as the key and value to perform attention calculations, realizing the interaction between the target sequence and the input energy spectrum features. The target sequence of the decoder is a nuclide category label sequence, for example:3 H, 14 C, etc.

[0046] The output layer processes the decoded feature vectors through a fully connected layer, outputting the probability of presence of various nuclides. Based on these probabilities, a comparison is made with a preset probability threshold. When the probability of a nuclide is greater than or equal to the preset probability threshold, the presence of the corresponding nuclide is determined. The position of the nuclide data in the energy spectrum is then determined based on the determination result, and the type and abundance of each nuclide are output. Preferably, the preset probability threshold is 0.75. The types of nuclides in this application include... 3 H, 14 C and the other three categories.

[0047] The output layer employs the L-Softmax activation function, performing an angular interval transformation on the logic values ​​output by the fully connected layer. After the transformation, the predicted probabilities for each nuclide are obtained through Softmax. The nuclide probability distribution is composed of the predicted probabilities corresponding to all categories. Angular interval transformation refers to: transforming the cosine value of the target class... Replace with ,in, The angle between the target class weight vector and the input decoded feature vector in the fully connected layer; It is the target class cosine replacement value after angular interval transformation, in order to learn a larger classification margin; It is an integer used to prevent gradient vanishing; non-target class logical values ​​remain unchanged.

[0048] S3. Use historical multichannel energy spectrum data as input to the energy spectrum data prediction model, and use the nuclide type and probability value corresponding to each channel as the label for the energy spectrum data prediction model to conduct supervised training. Collect 1000 sets of historical multichannel energy spectrum data as the training set, with each set containing 1024 energy spectrum information and corresponding nuclide type labels. 3 H, 14 (C or hybrid); using the Adam optimizer, with an initial learning rate of 0.0001, a batch size of 8, and 200 training epochs.

[0049] The total loss function of the above energy spectrum data prediction model is the sum of the cross-entropy loss function and the zoom loss function; the model is optimized by minimizing the above total loss function.

[0050] The expression for the cross-entropy loss function is:

[0051] in, The total number of nuclide categories, To determine whether a true label for a type c nuclide exists, It is 0 or 1. The first prediction model for energy spectrum data. The probability of a nuclide; The expression for the zoom loss function is as follows:

[0052] in, , This is the weighting coefficient for positive and negative samples. =1; This is the modulation factor. The parameters are set as α=0.75, β=0.25, γ=2.0, and δ=1.0.

[0053] S4. The pre-processed multichannel energy dispersive spectroscopy data of the sample to be tested is used as input to the trained energy dispersive spectroscopy prediction model, which outputs the corresponding nuclide types and probability values ​​to achieve the detection of nuclides in the sample. For example: the pre-processed multichannel energy dispersive spectroscopy data of the sample to be tested is input into the trained model, and the model outputs the nuclide types as follows: 3 H (probability 0.92) and 14 C (probability 0.88). Compared with the traditional Gaussian fitting method, this method can more accurately separate the contributions of the two nuclides when dealing with overlapping peaks, improving the identification accuracy by about 15%.

[0054] This application enhances the extraction of local spectral features by introducing a local attention mechanism to restrict the interaction between adjacent channels or time segments when calculating attention; and by designing a time-aware positional encoding, the measurement timestamp is encoded as a periodic feature, enabling the model to perceive the trend of energy spectrum changes over time.

[0055] To verify the effectiveness of the improved Transformer model proposed in this invention, the following comparative experiment was designed: 1) Comparison Model: Original VisionTransformer (ViT) (Reference: Gu Wei. Research on Gamma Radionuclide Identification Method Based on Deep Learning [D]. Anhui University of Science and Technology, 2025. DOI:10.26918 / d.cnki.ghngc.2025.000749.): Treats multi-channel spectral data as a one-dimensional sequence input and uses standard global attention.

[0056] 2) CNN baseline model (Reference: Luo Geng, Shi Rui, Zeng Shuxin, et al. Nuclide identification method based on two-dimensional convolutional neural network of kernel pulse peak sequence [J]. Nuclear Technology, 2025, 48(03): 125-137.): adopts multi-scale convolutional structure (similar to Inception) to extract local features, followed by fully connected classification layer.

[0057] 3) Traditional Gaussian fitting method: a multi-nucleus analytical method based on peak shape fitting and library matching.

[0058] 4) This invention is based on an energy spectrum data prediction model constructed using an improved Transformer network.

[0059] The datasets in all four methods all use tritium (³H) and carbon (¹H) 4 C) Mixed energy dispersive spectroscopy data, including 10,000 samples, divided into training, validation, and test sets in an 8:1:1 ratio. The evaluation metrics for the comparative experiments were accuracy, precision, and recall. The experimental results are shown in Table 3 below: Table 3

[0060] like Figure 4 As shown in the results analysis, the improved Transformer of this invention significantly outperforms other comparative models in terms of accuracy, precision, and recall, especially in recall, indicating a better ability to identify difficult samples such as low-activity nuclides and overlapping peaks. Compared with the original ViT, the improved model achieves a performance improvement of approximately 4-7 percentage points with the same number of parameters, demonstrating that the local attention and dynamic weighting mechanisms effectively enhance the model's ability to perceive local energy spectrum features and key channels. In terms of inference efficiency, the improved Transformer is slightly better than the original ViT and much faster than the traditional Gaussian fitting method, meeting the requirements for real-time processing. On test subsets with uneven proportions of mixed nuclides, the improved Transformer still maintains a recall rate of over 97%, while the traditional method drops to approximately 70%, further verifying its robustness. Figure 4 In the diagram, "iterations" represents the number of iterations. The red line represents the improved performance of the Transformer, while the green line represents the unimproved performance. After 60 iterations, the two lines converge, but the red line is slightly higher than the green line.

[0061] The above description is merely a preferred embodiment of the present invention and does not constitute any limitation on the present invention. Any simple modifications, alterations, or equivalent structural changes made to the above embodiments based on the technical essence of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for processing β-liquid multichannel energy dispersive spectroscopy based on Transformer, characterized in that: The method includes the following steps: S1. Use a scintillation detector to measure the nuclide energy spectrum of the sample under test to obtain raw multichannel energy spectrum data; preprocess the raw multichannel energy spectrum data. S2. Construct an energy spectrum data prediction model based on the Transformer network. The Transformer network includes an input layer, a batch embedding layer, an encoding layer, a feature fusion layer, a decoding layer, and an output layer. The input layer is used to receive preprocessed multichannel energy spectrum data and convert it into batched sequence data. The batch embedding layer receives the batched sequence data output by the input layer, performs positional encoding on it, generates an embedding feature sequence of [B,L,D] dimensions, and inputs it into the encoding layer; The encoding layer includes a first stage, a second stage, and a third stage arranged sequentially. Each stage is constructed by stacking MCFormer modules that include a multi-head attention mechanism. The first stage is used to extract local channel features from the embedded feature sequence. The second stage is used to capture long-distance dependencies between channels; the third stage is used to fuse the output features of the second stage with the temporal features and further encode them to output the third stage feature data; the temporal features are generated by the batch embedding layer; The feature fusion layer is used to perform layer normalization and feedforward neural network transformation on the feature data of the third stage in sequence, and output fused features. The decoding layer consists of two stacked MCFormer modules, which are used to perform cross-attention interaction between the fused features and the target sequence, and output a decoded feature vector to achieve matching between the nuclide label sequence and the input energy spectrum features. The output layer is used to process the decoded feature vector through a fully connected layer and output the probability of existence of various nuclides. Based on the probability of existence of various nuclides, by comparing it with a preset probability threshold, when the probability of existence of a nuclide is greater than or equal to the preset probability threshold, the corresponding nuclide is determined to exist, and the position of the nuclide data in the energy spectrum is determined according to the determination result, and the type and content of each nuclide are output. S3. Use historical multichannel energy spectrum data as input to the energy spectrum data prediction model, and use the nuclide type and probability value corresponding to each channel data as the label of the energy spectrum data prediction model to conduct supervised training of the model. S4. Use the pre-processed multichannel energy spectrum data of the sample to be tested as the input of the trained energy spectrum data prediction model, and output the corresponding nuclide types and probability values ​​to realize the detection of nuclides in the sample to be tested.

2. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 1, characterized in that: The preprocessing includes data cleaning and normalization; Normalization employs a baseline correction method to process the data, where the correction formula is: in, For the first The energy value after correction. The original channel number. The value ranges from 0 to 4095; For scale coefficients, The value ranges from 0.1 to 0.

5. The value ranges from 0 to 5; for The residual error value of the channel. The value ranges from -0.5 to 0.5 keV.

3. The β-liquid multichannel energy dispersive spectroscopy method based on Transformer according to claim 1, characterized in that: The temporal features are generated by the batch embedding layer through two-dimensional sine / cosine coding of the batch sequence data output from the input layer. For each time step T and channel L, a unique D-dimensional position vector is generated, resulting in temporal feature values ​​of [B,L,D] dimensions.

4. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 1, characterized in that: The batch embedding layer outputs the embedded feature sequence to the coding layer, which is obtained by adding the position-encoded embedded feature sequence to the additional features element by element. The additional features are calculated based on the quenching index of the energy spectrum, which includes the mean channel address, the centroid channel address, and the peak-to-valley ratio of the energy spectrum.

5. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 1, characterized in that: The MCFormer module consists of four parallel processing branches, a first normalization layer, a multilayer perceptron (MLP), and a second normalization layer. The four parallel processing branches include: The original scale branch is used to perform multi-head self-attention computation on the input features; The double-scale branch is used to sequentially perform double downsampling, multi-head self-attention calculation, and double upsampling on the input features; The quad-scale branch is used to sequentially perform quad-downsampling, multi-head self-attention calculation, and quad-upsampling on the input features; The residual identity branch is used to directly pass input features; The output features of the four parallel processing branches are added element by element in the first residual addition unit, and after multi-scale feature fusion, they are output to the first normalization layer. The features normalized by the first normalization layer are input into the multilayer perceptron (MLP), and after nonlinear feature transformation, they are output to the second normalization layer. The features normalized by the second normalization layer are residually connected with the output features of the first normalization layer to output enhanced features.

6. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 1, characterized in that: In the encoding layer, the first stage stacks four MCFormer modules, and its multi-head attention mechanism introduces a local window mechanism, with the window size set according to the full width at half maximum (FWHM) of the energy spectrum; the second stage stacks four MCFormer modules, and the window size of its multi-head attention mechanism is the length L of the complete sequence; the third stage stacks two MCFormer modules, which receive the fused features after the feature data of the second stage and the temporal features are added element-wise along the feature dimension, and output the feature data of the third stage.

7. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 1, characterized in that: The total loss function of the energy spectrum data prediction model is the sum of the cross-entropy loss function and the zoom loss function; the model is optimized by minimizing the total loss function.

8. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 7, characterized in that: The expression for the cross-entropy loss function is: in, The total number of nuclide categories, To determine whether a true label for a type c nuclide exists, It is 0 or 1. The first prediction model for energy spectrum data. The probability of a nuclide; The expression for the zoom loss function is as follows: in, , This is the weighting coefficient for positive and negative samples. =1; is the modulation factor.

9. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 7, characterized in that: The output layer uses the L-Softmax activation function to perform angular interval transformation on the logic values ​​output by the fully connected layer. After transformation, the probability distribution of various nuclides is obtained by Softmax. Angular interval transformation refers to: transforming the cosine value of the target class Replace with ,in, The angle between the target class weight vector and the input decoded feature vector in the fully connected layer; It is the target class cosine replacement value after angular interval transformation, in order to learn a larger classification margin; It is an integer used to prevent gradient vanishing; non-target class logical values ​​remain unchanged.

10. The Transformer-based β-liquid multichannel energy dispersive spectroscopy method according to claim 1, characterized in that: The preset probability threshold is 0.75.