Generalized electron microscope image quality enhancement methods, apparatus, and readable media
By constructing an untrained model architecture with dual image-text control and a two-stage training strategy, the problems of high equipment cost, easy sample damage, and unstable model training in aberration-corrected scanning transmission electron microscopy are solved, achieving high-resolution image quality improvement and flexible applicability for diverse material characterization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PEKING UNIV
- Filing Date
- 2026-03-03
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies in aberration-corrected scanning transmission electron microscopy suffer from problems such as high equipment cost, easy sample damage, unstable model training, complex operation, and poor applicability, making it difficult to achieve high resolution and diverse material characterization.
We construct an untrained model architecture with dual-conditional control of image and text, combine diffusion formula and time step control logic, generate datasets through simulation algorithm and optimize the model through two-stage training, and achieve image quality improvement by fusion of implicit diffusion model with ControlNet.
It reduces equipment costs, adapts to the processing of thin and thick samples, improves the stability and controllability of model training, enhances the flexibility and accuracy of image processing, and adapts to the diverse needs of materials research.
Smart Images

Figure CN122155977A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electron microscope image data processing technology, specifically relating to general electron microscope image quality improvement methods, equipment, and readable media. Background Technology
[0002] Aberration-corrected scanning transmission electron microscopy (AC-STEM) has become a core tool in materials research for revealing the laws governing the nanoscale world. Compared to traditional transmission electron microscopy (TEM), the core advantage of AC-STEM lies in its ability to provide atomic-resolution Z-contrast imaging. The sub-angstrom-level electron beam focused by an advanced aberration corrector in AC-STEM makes it highly suitable for characterizing the structure and composition of more refined nanomaterials.
[0003] However, existing technologies have the following shortcomings: traditional techniques to replace aberration correctors each have their own defects; increasing the electron gun acceleration voltage is costly and easily damages the sample; deconvolution methods have poor robustness and are not suitable for thick samples; electron stacking imaging depends on specific datasets, is complex to operate, and has strict requirements on sample thickness; in early deep learning techniques for super-resolution electron microscopy images, regression models focus on low-frequency pattern learning, which is not conducive to high-resolution generation; CycleGAN methods are unstable in training and have insufficient geometric transformation processing capabilities; super-resolution electron microscopy images based on diffusion models have obvious shortcomings, not only having poor universality and only validating their effects in a small number of material images, but also having low controllability due to the large impact of the number of inference steps and the lack of universal parameters. At the same time, the large number of inference steps, the unintuitive calling, and the need for professional computer knowledge make them unusable.
[0004] Therefore, a new method is urgently needed. Summary of the Invention
[0005] The purpose of this invention is to provide a universal method, device, and readable medium for improving the quality of electron microscope images. This method reduces equipment costs and does not cause sample damage from the electron beam, and is suitable for image processing of thin and thick samples. It improves the stability of model training and allows for fine-tuning of super-resolution results, enhancing the model's universality, controllability, and ease of use. At the same time, it enhances the flexibility and accuracy of uncorrected STEM imaging, adapting to the diverse characterization needs of materials research.
[0006] To achieve the above objectives, the present invention provides a general method, apparatus, and readable medium for improving the image quality of electron microscopes, comprising the following steps: S1. Construct a structural image dataset; S2. Using low spatial resolution STEM images as input, build an untrained model architecture with dual image-text control and output the untrained model architecture. S3. Based on the structured dataset of S1 and the untrained model architecture of S2, the first stage of universal training is completed by combining the diffusion formula and time step control logic. Then, the second stage of training is carried out through teacher-student model distillation to optimize inference efficiency and obtain a general electron microscope image quality improvement model. The number of training steps in the first and second stages are preset values, and there are no steps for early stopping based on parameter judgment.
[0007] Preferably, in S1, electron microscope images are generated using a simulation algorithm as the basic samples for constructing the dataset. Electron microscope images with different spatial resolutions are simulated and noise of different intensities is added to the images to construct high-quality-low-quality STEM image pairs. The high-quality image is characterized by high spatial resolution and low noise level, while the low-quality image is characterized by low spatial resolution and high noise level. Furthermore, the image pairs cover two imaging modes: annular dark field and bright field, as well as five types of atomic arrangements: regular lattice, atomic missing defects, heteroatomic embedding, multiphase interface, and completely random arrangement. Normalization and format validation are performed on the synthesized image pairs to output a structured dataset.
[0008] Preferably, the untrained model architecture built by S2 includes an image encoder, a text encoder, a ControlNet module, a U-Net module, and an image decoder, with each module configured in a coordinated manner; The image encoder consists of four serial downsampling blocks, each containing convolution, normalization, and activation layers, used to convert low-quality electron microscope images into latent space features. The text encoder is a lightly tuned pre-trained CLIP model used to encode text cues containing imaging patterns and target resolutions into latent space conditional text features. ; The ControlNet module is built based on the downsampling part and intermediate modules of U-Net and is initialized in conjunction with the parameters of the U-Net module. It is used to receive the latent space features of low-quality images and generate multi-scale image control features to realize structural constraints. The U-Net module adopts the U-Net architecture of the StableDiffusion model, retaining multiple downsampling modules, upsampling modules, and intermediate modules. Each module integrates a self-attention module and a cross-attention module for latent space noise prediction and feature fusion. The image decoder consists of four cascaded upsampling blocks, which correspond one-to-one with the downsampling blocks of the image encoder. It has a built-in deconvolution layer to restore the fused latent space features into a high-quality STEM image. The image encoder, text encoder, and U-Net infrastructure are initialized using pre-trained parameters, while ControlNet is initialized using parameters from the U-Net downsampling module.
[0009] Preferably, in S3, the universality training specifically includes: The training set images are processed by an image encoder to output latent space features. Low-quality features are input into ControlNet for structural constraints, while high-quality images output dual-domain features for noise addition and prediction. Text prompts are input into a text encoder to output latent space conditional text features. Together with the time step, they constitute a dual-condition constraint; High-quality STEM images are read from a structured STEM image dataset and converted into clean latent space features using an image encoder. Simultaneously, random Gaussian noise is generated, and random sampling time steps are performed. According to the cumulative diffusion coefficient The value selection rules determine the current of Value; according to the initial diffusion noise formula for Add noise to obtain the time step Noisy latent features The cumulative diffusion coefficient The value ranges from 0.85 to 0.95; Will Input conditional denoising U-Net, while also adjusting the time steps Embedded U-Net downsampling, upsampling, and intermediate modules. By embedding the built-in cross-attention module of U-Net, dual-condition constraints on time steps and text are achieved; The multi-scale control features output by ControlNet are processed by zero convolution and then incorporated into U-Net skip connections. Noise is then predicted by the conditionally denoising U-Net. Then, a denoising step is performed on the noisy image to obtain the denoised latent features. ; The total loss value is calculated using a spatial-frequency composite loss function. After each training epoch, the processing effect is verified using a validation set and the changes in the composite loss function are monitored. After training is completed according to the pre-set number of training steps, the first-stage model and feature logs are output.
[0010] Preferably, the initial diffusion noise addition formula is: In the formula, The cumulative diffusion coefficient; The diffusion coefficient is the single-time-step diffusion coefficient. It is random Gaussian noise; For time step Hidden features after adding noise; Latent features for high-quality STEM images; Noise weighting coefficient; The calculation formula for the first step of denoising is as follows: ; In the formula, These are the latent features after denoising; The formula for the spatial-frequency two-dimensional composite loss function is as follows: ; ; ; In the formula, This represents the total loss value. Loss of atomic details in the spatial domain; This represents the frequency domain lattice periodicity loss. These are the loss weighting coefficients; This is the noise vector predicted by the model; For Fast Fourier Transform; The square of the L2 norm; for High-quality STEM image in the spatial domain before entering the image encoder; for STEM image after spatial domain denoising after entering the image decoder.
[0011] Preferably, in S3, the teacher-student model distillation training specifically includes: The teacher model is reused as the first-stage model obtained through universal training. The basic module parameters of the teacher model are frozen, and only the callable permissions of the conditional denoising U-Net are retained. The student model is reused as an untrained model architecture built with S2. Only the U-Net basic parameters of the student model are reinitialized, while the parameters of the teacher model are used to initialize the other modules. The total time step sequence of the general training is divided into 5-8 consecutive windows, each containing 2-3 consecutive time steps, and the starting time step of each window is marked. Window termination time step Randomly sample the target time step from each window. ,satisfy .
[0012] Preferably, in the teacher-student model distillation training, the operation of the teacher model specifically includes: Based on the target time step of sampling and window boundary time step Linear interpolation is performed on high-quality latent features to add noise, simulating the continuous gradient change of noise within the window. The formula for linear interpolation and noise addition is: ; In the formula, For the window start time step The corresponding latent features are generated by positive diffusion and noise addition from high-quality latent features. get, Corresponding diffusion coefficient The value ranges from 0.85 to 0.95; For the window termination time step The corresponding latent features are determined by the teacher model. Obtained by reverse diffusion denoising, the reverse diffusion process is as follows: Corresponding window start time step Start to window end time step , Corresponding diffusion coefficient The value ranges from 0.90 to 0.95; The window start time step; The window termination time step; Will Latent space conditional text features Window start time step With window termination time step Inputting a conditional denoising U-Net for the teacher model, and combining it with the multi-scale control features output by ControlNet to perform backdiffusion denoising, simulates the teacher model in... and The reverse diffusion process between them gradually reduces Noise interference, output ; based on and Calculate the target noise of the teacher model And record the noise prediction patterns during the reasoning process.
[0013] Preferably, in the teacher-student model distillation training, the operation of the student model specifically includes: enter , Target time step Low-quality hidden features Perform one step of inference to directly output the prediction noise of the student model. ; The loss between the student model and the teacher model is calculated using the noise L1 one-dimensional distillation loss function, the formula of which is: ; ; In the formula, Target noise for the teacher model Predictive noise of the student model The mean squared error (MSE) loss; The square of the L2 norm; Only the parameters of the ControlNet module and U-Net core module of the student model are updated, while the parameters of the other modules are frozen. After training is completed according to the preset number of training steps, all parameters of the student model are saved to obtain the general model. The preset number of steps for the universal training is 150 epochs, and the preset number of steps for the teacher-student model distillation training is 60 epochs.
[0014] Therefore, by employing the aforementioned general electron microscope image quality improvement method, equipment, and readable medium, the present invention offers the following advantages compared to existing technologies: (1) It can achieve sub-angstrom level imaging of uncorrected STEM electron microscope images without additional hardware, reducing equipment and maintenance costs, without electron beam sample damage, adapting to thin and thick sample processing, easy to operate, and can accurately retain atomic-level information, improve image processing robustness and optimize artifact removal effect. (2) Taking the implicit diffusion model as the core, the integration of ControlNet and CLIP realizes image-text dual condition control, improves the model training stability, generates high-resolution detail features, and can finely constrain and control the structure of electron microscope images to achieve precise control of super-resolution results. (3) By training with large-scale simulated image pairs, combined with a two-stage training strategy and a composite loss function, the general inference steps are optimized, natural language custom target resolution is supported, image processing is completed in the latent space, the universality, controllability and ease of use of the model are greatly improved, the atomic position and brightness information are accurately preserved, and the computational cost and processing speed are reduced. (4) Supports flexible adjustment of target spatial resolution as needed, breaks through the technical limitation of fixed magnification super-resolution, improves the flexibility and accuracy of uncorrected STEM imaging, and adapts to the diverse characterization needs of materials research.
[0015] 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
[0016] Figure 1 This is a schematic diagram of the training process for an embodiment of the general electron microscope image quality improvement method, device, and readable medium of the present invention; Figure 2This is a schematic diagram of a two-stage training process for an embodiment of the general electron microscope image quality improvement method, device, and readable medium of the present invention; Figure 3 This is a schematic diagram of the second-stage teacher-student model distillation training process, which is an embodiment of the general electron microscope image quality improvement method, device and readable medium of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Unless otherwise defined, the technical or scientific terms used in the present invention should have the ordinary meaning understood by those skilled in the art.
[0018] Example 1 like Figures 1-3 As shown, this embodiment provides a general method, device, and readable medium for improving the image quality of an electron microscope. It should be understood that the specific parameters, models, and protocols mentioned in this embodiment are merely examples to help those skilled in the art understand the present invention, and are not intended to limit the present invention.
[0019] The present invention provides a general method, apparatus, and readable medium for improving the quality of electron microscope images, comprising the following steps: S1. Generate electron microscope images through simulation algorithms as the basic samples for constructing the dataset, ensuring that the generated images closely match the spatial resolution and noise characteristics of actual electron microscope imaging. First, electron microscope images at different spatial resolutions are simulated. Then, noise of varying intensities is added to the images to ultimately construct high-quality (high spatial resolution, low noise level) - low-quality (low spatial resolution, high noise level) STEM image pairs. These image pairs cover two imaging modes and five types of atomic arrangements, adapting to imaging scenarios of both light and heavy atoms. Imaging modes include ring dark field (HAADF, high-quality lattice sharp / low-quality noise blurry) and bright field (BF, high-quality light atom sharp edges / low-quality edge blurry). Atomic arrangement includes regular lattice, atomic missing defects, heteroatoms embedded, multiphase interface, and completely random arrangement; Normalize and format-check the synthesized images, divide them into training and validation sets with noise parameter labels in an 8:2 ratio, and output a structured dataset. S2, taking the low spatial resolution STEM image from S1 as input, integrates a conditional denoising module to achieve dual-conditional control of image and text, and dual-domain feature interaction of spatial and frequency domains. The final output is an untrained model architecture containing spatial-frequency interaction logic, which is then passed to S301 as the training basis. Specifically: The image encoder consists of four cascaded downsampling blocks (including convolution, normalization, and activation layers). It receives low-quality electron microscope images and transforms them into latent space features, providing a foundation for subsequent feature processing. Lightweight fine-tuning is performed on a pre-trained CLIP model. Text cues containing imaging patterns and target resolution are received and encoded as latent space conditional text features. This provides textual support for dual-condition control; The ControlNet module is built on the downsampling part and intermediate modules of U-Net and initialized in conjunction with the parameters of the U-Net module. Its core function is to receive the latent space features of low-quality images, generate multi-scale image control features, and realize structural constraints. The U-Net architecture of the StableDiffusion model is adopted, and multiple downsampling modules, upsampling modules and intermediate modules are retained. Each module integrates a self-attention module and a cross-attention module, and the core is responsible for latent space noise prediction and feature fusion. The image decoder consists of four cascaded upsampling blocks, which correspond one-to-one with the downsampling blocks of the image encoder. It has a built-in deconvolution layer that restores the fused latent space features into a high-quality STEM image and calibrates the pixel space mapping accuracy of the denoised features. Among them, the image encoder, text encoder, and U-Net basic structure are initialized with pre-trained parameters; ControlNet is initialized with U-Net downsampling module parameters and outputs the untrained model architecture. S3, based on the structured dataset of S1 and the untrained model architecture of S2, combined with the forward / backward diffusion formula and time step control logic, completes the model training and finally obtains the general model; the number of training steps in the first and second stages are preset, and there is no parameter judgment to stop the steps in advance.
[0020] S301. The first phase involves universal training. The training set images are processed by an image encoder to output latent space features. Low-quality features are used for ControlNet structural constraints, while high-quality images output dual-domain features for noise addition and prediction. Text prompts are input to a text encoder, and the output... Together with the time step, they constitute a dual-condition constraint; High-quality STEM images are read from the structured dataset S1 and converted into clean latent space features by the image encoder S2. Simultaneously, random Gaussian noise is generated, and random sampling time steps are performed. ,according to The value selection rules determine the current of The initial diffusion noise addition formula is: ; In the formula, The cumulative diffusion coefficient has a value of 0.85-0.95. The diffusion coefficient is the single-time-step diffusion coefficient. It is random Gaussian noise; For time steps Hidden features after adding noise; Latent features for high-quality STEM images; Noise weighting coefficient; Will Input the conditional denoising U-Net in S2, and simultaneously set the time step Embed U-Net downsampling, upsampling, and intermediate modules; By embedding the built-in cross-attention module of U-Net, dual constraints of time step and text are achieved; Low-quality features are input into ControlNet to generate multi-scale control features, which are then processed by zero convolution and incorporated into U-Net skip connections; noise is then predicted by conditional denoising U-Net. And perform a denoising step on the noisy image, the calculation formula is: ; In the formula, These are the latent features after denoising; A composite loss function with spatial and frequency dimensions is adopted, and the formula is as follows: ; ; ; In the formula, This represents the total loss value. Loss of atomic details in the spatial domain; This represents the frequency domain lattice periodicity loss. This is the loss weighting coefficient, with a value ranging from 0.1 to 1.0; This is the predicted noise vector; For Fast Fourier Transform; The latent features output by the model are the latent features recovered by one-step denoising of the noisy image using the predicted noise. The square of the L2 norm; for High-quality STEM image in the spatial domain before entering the image encoder; for STEM image after spatial domain denoising following entry into the image decoder; After each training epoch, the processing effect is verified using a validation set (including dual-mode and 5 types of atomic arrangements), and the change of the composite loss function is monitored. In this embodiment, the first stage training steps are preset to 150 epochs. After training is completed according to the set number of steps, the first stage model and feature log are output. S302, The second phase involves teacher-student model distillation training; The teacher model reuses the first-stage model of S301, freezes the basic module parameters, and retains only the callable permissions of the conditional denoising U-Net; The student model reuses the S2 architecture, only re-initializing the basic parameters of U-Net, while the remaining modules (image encoder, ControlNet) are initialized using the teacher model parameters, reducing the amount of training. The total time step sequence of the first stage training is divided into 5-8 consecutive windows, each containing 2-3 consecutive time steps. The time steps at the window boundaries are denoted as... (Window start time step) (Window termination time step); Randomly sample one target time step from each window. ( ), serving as the "current time step" for teacher-student model inference, ensures that sampling covers all windows and avoids insufficient training in local time steps; The teacher model performs multi-step inference based on two steps: forward diffusion for noise addition and backward diffusion for denoising, ultimately outputting the termination time step. Corresponding hidden features and based on Further calculations yielded the target noise. Specifically: Based on sampling and window boundaries Linear interpolation is performed on the high-quality latent features input to the teacher model to add noise, simulating the continuous gradient change of noise within the window, as shown in the following formula: ; In the formula, For the window start time step The corresponding latent features are generated by positive diffusion and noise addition from high-quality latent features. get, Corresponding diffusion coefficient The value ranges from 0.85 to 0.95; For the window termination time step The corresponding latent features are determined by the teacher model. Obtained by reverse diffusion denoising, the reverse diffusion process is as follows: Corresponding window start time step Start to window end time step , Corresponding diffusion coefficient The value ranges from 0.90 to 0.95; The window start time step; The window termination time step; Will Latent space conditional text features Window start time step With window termination time step Inputting a conditional denoising U-Net for the teacher model, and combining it with the multi-scale control features output by ControlNet to perform backdiffusion denoising, simulates the teacher model in... and The reverse diffusion process between them gradually reduces Noise interference, output This includes the following sub-steps: S30201, Input , (Time step position encoding, sine function generation) ; S30202, Conditional Denoising U-Net Based on Model Parameters ,enter , , Post-predicted noise vector The Sigmoid activation constraint is applied in the interval 0 to 1; the conditional mean and fixed variance are calculated, and the formula for the conditional mean is: ; ; In the formula, The mean; The model parameters for conditional denoising U-Net; To be based on time steps Noise-adding features For input; The noise vector predicted by the conditionally denoised U-Net; For the first The single-time-step diffusion coefficient at each time step; The multiplication symbol is used from the first time step to the second time step. Multiply the single-step diffusion coefficients of each time step; The formula for fixed variance is: ; In the formula, For a certain time step of back diffusion The fixed variance; S30203. Denoising features are obtained through Gaussian sampling, using the following formula: ; In the formula, Standard Gaussian noise; U-Net for Conditional Denoising Based on Parameters The mean output function; Time step in reverse diffusion The fixed standard deviation; Repeat steps S30202-S30203 until the time step finally drops to... Output .
[0021] based on and The target noise of the teacher model is calculated using the following formula: ; In the formula, This is the diffusion coefficient scaling factor; This is the noise calibration coefficient; for Corresponding latent features; The target noise for the teacher model; The formula for its definition is: ; ; In the formula, for The corresponding diffusion coefficient; for The corresponding diffusion coefficient; Simultaneously record the noise prediction patterns during the reasoning process; The student model uses one-step reasoning, specifically: Student model input , Time step Low quality characteristics The student model performs one inference step and directly outputs the student model's prediction noise. This enables "efficient reasoning with fewer steps"; The loss of the student model and the teacher model is calculated using the noise L1 one-dimensional distillation loss function, and the formula is as follows: ; ; In the formula, Target noise for the teacher model Predictive noise of the student model The mean squared error (MSE) loss; It is the square of the L2 norm.
[0022] Only update the parameters of the ControlNet module and U-Net core module of the student model to learn the structural constraints and noise prediction capabilities of the teacher model; keep the other modules frozen. In this embodiment, the second stage training steps are preset to 60 epochs. After the training is completed according to the set number of steps, all parameters of the student model are saved, which is the general electron microscope image quality improvement model; all parameters of the student model are saved.
[0023] Therefore, this invention employs the aforementioned general electron microscope image quality enhancement method, equipment, and readable medium. This method reduces equipment costs and avoids electron beam sample damage, making it suitable for image processing of both thin and thick samples. It improves model training stability and finely controls super-resolution results, comprehensively enhancing the model's universality, controllability, and ease of use. At the same time, it enhances the flexibility and accuracy of uncorrected STEM imaging, adapting to the diverse characterization needs of materials research.
[0024] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0025] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A general method for improving the image quality of an electron microscope, characterized in that, Includes the following steps: S1. Construct a structural image dataset; S2. Using low spatial resolution STEM images as input, build an untrained model architecture with dual image-text control and output the untrained model architecture. S3. Based on the structured dataset of S1 and the untrained model architecture of S2, the first stage of universal training is completed by combining the diffusion formula and time step control logic. Then, the second stage of training is carried out through teacher-student model distillation to optimize inference efficiency and obtain a general electron microscope image quality improvement model. The number of training steps in the first and second stages are preset values, and there are no steps for early stopping based on parameter judgment.
2. The general method for improving the image quality of an electron microscope according to claim 1, characterized in that, In S1, electron microscope images are generated using simulation algorithms as the basic samples for constructing the dataset. Electron microscope images with different spatial resolutions are simulated and noise of different intensities is added to the images to construct high-quality-low-quality STEM image pairs. The high-quality image is characterized by high spatial resolution and low noise level, while the low-quality image is characterized by low spatial resolution and high noise level. The image pairs cover two imaging modes: annular dark field and bright field, as well as five types of atomic arrangements: regular lattice, atomic missing defects, heteroatomic embedding, multiphase interface, and completely random arrangement. Normalization and format validation are performed on the synthesized image pairs to output a structured dataset.
3. The general method for improving the image quality of an electron microscope according to claim 2, characterized in that, The untrained model architecture built by S2 includes an image encoder, a text encoder, a ControlNet module, a U-Net module, and an image decoder, with each module configured in a coordinated manner. The image encoder consists of four serial downsampling blocks, each containing convolution, normalization, and activation layers, used to convert low-quality electron microscope images into latent space features. The text encoder is a lightly tuned pre-trained CLIP model used to encode text cues containing imaging patterns and target resolutions into latent space conditional text features. ; The ControlNet module is built based on the downsampling part and intermediate modules of U-Net and is initialized in conjunction with the parameters of the U-Net module. It is used to receive the latent space features of low-quality images and generate multi-scale image control features to realize structural constraints. The U-Net module adopts the U-Net architecture of the StableDiffusion model, retaining multiple downsampling modules, upsampling modules, and intermediate modules. Each module integrates a self-attention module and a cross-attention module for latent space noise prediction and feature fusion. The image decoder consists of four cascaded upsampling blocks, which correspond one-to-one with the downsampling blocks of the image encoder. It has a built-in deconvolution layer to restore the fused latent space features into a high-quality STEM image. The image encoder, text encoder, and U-Net infrastructure are initialized using pre-trained parameters, while ControlNet is initialized using parameters from the U-Net downsampling module.
4. The general method for improving the image quality of an electron microscope according to claim 3, characterized in that, In S3, the specific components of the universal training include: The training set images are processed by an image encoder to output latent space features. Low-quality features are input into ControlNet for structural constraints, while high-quality images output dual-domain features for noise addition and prediction. Text prompts are input into a text encoder to output latent space conditional text features. Together with the time step, they constitute a dual-condition constraint; High-quality STEM images are read from a structured STEM image dataset and converted into clean latent space features using an image encoder. Simultaneously, random Gaussian noise is generated, and random sampling time steps are performed. According to the cumulative diffusion coefficient The value selection rules determine the current of Value; according to the initial diffusion noise formula Add noise to obtain the time step Noisy latent features The cumulative diffusion coefficient The value ranges from 0.85 to 0.95; Will Input conditional denoising U-Net, while also adjusting the time steps Embedded U-Net downsampling, upsampling, and intermediate modules. By embedding the built-in cross-attention module of U-Net, dual-condition constraints on time steps and text are achieved; The multi-scale control features output by ControlNet are processed by zero convolution and then incorporated into U-Net skip connections. Noise is then predicted by the conditionally denoising U-Net. Then, a denoising step is performed on the noisy image to obtain the denoised latent features. ; The total loss value is calculated using a spatial-frequency composite loss function. After each training epoch, the processing effect is verified using a validation set and the changes in the composite loss function are monitored. After training is completed according to the pre-set number of training steps, the first-stage model and feature logs are output.
5. A general method for improving the image quality of an electron microscope according to claim 4, characterized in that, The initial diffusion noise addition formula is: In the formula, The cumulative diffusion coefficient; The diffusion coefficient is the single-time-step diffusion coefficient. It is random Gaussian noise; For time step Hidden features after adding noise; Latent features for high-quality STEM images; Noise weighting coefficient; The calculation formula for the first step of denoising is as follows: ; In the formula, These are the latent features after denoising; The formula for the spatial-frequency two-dimensional composite loss function is as follows: ; ; ; In the formula, This represents the total loss value. Loss of atomic details in the spatial domain; This represents the frequency domain lattice periodicity loss. These are the loss weighting coefficients; This is the noise vector predicted by the model; For Fast Fourier Transform; The square of the L2 norm; for High-quality STEM image in the spatial domain before entering the image encoder; for STEM image after spatial domain denoising after entering the image decoder.
6. The general method for improving the image quality of an electron microscope according to claim 5, characterized in that, In S3, the teacher-student model distillation training specifically includes: The teacher model is reused as the first-stage model obtained through universal training. The basic module parameters of the teacher model are frozen, and only the callable permissions of the conditional denoising U-Net are retained. The student model is reused as an untrained model architecture built with S2. Only the U-Net basic parameters of the student model are reinitialized, while the parameters of the teacher model are used to initialize the other modules. The total time step sequence of the general training is divided into 5-8 consecutive windows, each containing 2-3 consecutive time steps, and the starting time step of each window is marked. Window termination time step Randomly sample the target time step from each window. ,satisfy .
7. A general method for improving the image quality of an electron microscope according to claim 6, characterized in that, In the aforementioned teacher-student model distillation training, the specific operations of the teacher model include: Based on the target time step of sampling and window boundary time step Linear interpolation is performed on high-quality latent features to add noise, simulating the continuous gradient change of noise within the window. The formula for linear interpolation and noise addition is: ; In the formula, For the window start time step The corresponding latent features are generated by positive diffusion and noise addition from high-quality latent features. get, Corresponding diffusion coefficient The value ranges from 0.85 to 0.95; For the window termination time step The corresponding latent features are determined by the teacher model. Obtained by reverse diffusion denoising, the reverse diffusion process is as follows: Corresponding window start time step Start to window end time step , Corresponding diffusion coefficient The value ranges from 0.90 to 0.95; The window start time step; The window termination time step; Will Latent space conditional text features Window start time step With window termination time step Inputting a conditional denoising U-Net for the teacher model, and combining it with the multi-scale control features output by ControlNet to perform backdiffusion denoising, simulates the teacher model in... and The reverse diffusion process between them gradually reduces Noise interference, output ; based on and Calculate the target noise of the teacher model And record the noise prediction patterns during the reasoning process.
8. A general method for improving the image quality of an electron microscope according to claim 7, characterized in that, In the aforementioned teacher-student model distillation training, the specific operations of the student model include: enter , Target time step Low-quality hidden features Perform one step of inference to directly output the prediction noise of the student model. ; The loss between the student model and the teacher model is calculated using the noise L1 one-dimensional distillation loss function, the formula of which is: ; ; In the formula, Target noise for the teacher model Predictive noise of the student model The mean squared error (MSE) loss; The square of the L2 norm; Only the parameters of the ControlNet module and U-Net core module of the student model are updated, while the parameters of the other modules are frozen. After training is completed according to the preset number of training steps, all parameters of the student model are saved to obtain the general model. The preset number of steps for the universal training is 150 epochs, and the preset number of steps for the teacher-student model distillation training is 60 epochs.
9. A computer device, characterized in that, include: A processor configured to be coupled to memory, read and execute instructions and / or program code in the memory to perform the method as described in any one of claims 1-8.
10. A computer-readable medium, characterized in that, The computer-readable medium stores computer program code that, when executed on a computer, causes the computer to perform the method as described in any one of claims 1-8.