The invention relates to a method for automatic focusing and astigmatism correction for a microscope.
In the case of microscopy, in particular electron microscopy, the parameters of the microscope, in particular the parameters regarding image quality, are often controlled manually, that is by the user of the microscope. However, adjusting the parameters for every probe may be a very time-consuming process.
As an improvement, electron microscopy may rely on automation and control algorithms to ensure a higher image quality with minimal human intervention.
However, currently used focus and astigmatism correction algorithms usually try to explicitly model image formation and subsequently aberration correction, and many suffer from long processing times, as well as problematic generalization to untested settings.
The high resolution of electron microscopy (EM), and the ability to image every sample detail remain unrivaled. A key component of automated EM is to maintain high-quality images over the entire acquisition process, which can involve millions of individual images and operations over long periods. This makes manual microscope parameter adjustments largely impossible. Tight constraints on algorithm execution time budgets, aberration correction convergence speeds and low-electron dose budgets to avoid sample artefacts pose a great challenge to automatic defocus and astigmatism correction algorithms despite their necessity, especially in high-throughput electron microscopy.
Existing solutions in the area of scanning electron microscopy (SEM) are usually based on explicit physical models of the electron beam and its interaction with the sample. Measurements, in this case images, with known perturbations are taken, followed by focus and stigmation parameter inference to estimate the wavefront aberrations. While such physically grounded approaches should lead in theory to excellent generalization properties, that is the ability to operate successfully on different microscopes or samples with no or minimal or adaptations, they contain in practice many parameters that require careful tuning.
Here, a method is introduced which is mainly a data-driven method for aberration correction in scanning electron microscopy, wherein the method works in very low signal-to-noise ratio conditions, reduces processing times by more than an order-of-magnitude in comparison to the state of the art, rapidly converges in a large aberration range, and can be recalibrated to different microscopes or challenging samples in an automated fashion by non-experts.
In particular, a machine-learning based focusing and stigmation correction method for scanning electron microscopy. The proposed algorithm has nearly instant inference time, rapid convergence, operates on low-electron dose noisy images and has a ready-to-use procedure to re-calibrate it to novel machines and samples without requiring expert knowledge, guaranteeing convergence in all usage scenarios.
The object of the invention is to provide a method for automatic focus and astigmatism correction for electron microscopy, wherein the method is fast and robust when used.
The problem is solved by the method according to claim 1. The further dependent claims provide preferred embodiments. Also, a method for generating training data of a machine-learning modeling model used for a microscope setup is provided according to claim 13. Also, the problem is solved by a computing system according to claim 15.
According to the invention, provided is a method for automatic focusing and astigmatism correction for a specific microscope setup, in particular an electron microscope. The microscope being at least adjustable in the following microscope parameters, a working distance, a stigmator in a x-direction and a stigmator in a y-direction, and with the method comprising the steps:
In general, the image of a flat specimen or sample in a microscope, in particular a scanning electron microscope is optimally captured when the size of the spot of the electron beam is below the sampling distance. Commonly, three parameters, which are the working distance, and orthogonal stigmators, herein referred to as stig x and stig y, can be adjusted by electron microscope operators to directly control the spot shape and bring it below the pixel size at the beam-specimen interaction point, leading consequently to sharp image formation.
Advantageously, the microscope or the microscope setup may be a scanning electron microscope (SEM) or an environmental scanning electron microscope (ESEM). It may also be a scanning transmission electron microscope (STEM) or a transmission electron microscope (TEM), albeit with a different image formation principle, meaning that instead of the parameters working distance and stigmator settings additionally or alternatively different microscope parameters have to be controlled.
The method as proposed has, as an input, two images each with a known working distance perturbation around the current microscope working distance and stigmator settings; the current working distance and stigmator settings are relating to a specific image which may be taken by the microscope. It is noted that the current working distance and stigmator settings provide an image of the sample which is typically out-of-focus.
Further, the method requires at least two perturbed test images to allow the retrieval of magnitude and direction of the correction term. According to a preferred embodiment, the correction term comprises a correction direction.
According to the preferred embodiments of the invention, the perturbations may be of different type with respect to each other. In particular, the first perturbation and the second perturbation are either both positive perturbations or both negative perturbations, or the first perturbation is a positive perturbation, and the second perturbation is a negative perturbation.
Further preferably, an absolute value of the first perturbation and the second perturbation are either identical or different to each other. In particular, the perturbations have preferably the same absolute value when one perturbation is positive and the other one is negative. However, it may be the case that one perturbation is positive and the other one is negative, the perturbations having different absolute values. In the case of one perturbation being positive and the other one being negative, the important fact is that these perturbations lead to an asymmetry with respect to a sharpness of the subareas of the image pairs, meaning that one subarea of an image patch pair is sharper than the other, thereby resulting in a correction direction of the correction term. In the case of an in-focus initial setting and an antisymmetric perturbation in the working distance parameter, the test images inherit the same blur distortions (due to the symmetry of pure defocus). For an initial setting that is out-of focus, the asymmetry in distortion of the test images can be exploited by the method to infer a correction vector towards in-focus parameter settings (working distance and stigmator settings).
The asymmetry should still be exploitable if the perturbations have the same sign, meaning both perturbations are positive or negative. However, if both perturbations have the same sign, the absolute values of the perturbations have to be different from each other. If the perturbations had the same absolute value, no direction would be conceivable since no image patch pair could be formed because the same perturbed image is captured twice.
However, there are some requirements to the perturbations in view of the present invention. First, it is noted that the invention is not limited to two perturbations; in fact, it may be the case that multiple perturbations are used, with a total number greater than two. Preferably, the total number of perturbations is constant, and more preferably preset, for the inventive method. Moreover, it is possible that the magnitude and the direction are constant as well. The direction may be given by the signs of the perturbations.
Moreover, the absolute values of the perturbations have to be comparable to the target parameter range, meaning that the order of magnitude of the perturbations is comparable or less than the order of magnitude of the correction of the working distance and stigmator settings. Furthermore, the perturbations should be sufficiently different with respect to the target parameter range.
According to a preferred embodiment of the invention, the sizes of the i-th subarea of the first image and the i-th subarea of the second image are substantially identical. In the sense of the present invention, “substantially” relates to a difference in size by at most 10%, preferably 5%, of the size of the respective subarea. Most preferably, the sizes of the i-th subareas are identical. As an example, the test image size may be 1024×768 with a pixel size of 10 nm, wherein the size of a subarea may be a square with 512×512 or 256×256 or even 128×128, wherein further sizes may be possible. However, it was found that a smaller size of the subareas may result in lower convergence speeds. It is to be understood that the size of the image, the pixel size and the size of the subareas can have different values than the values presented. However, it should be understood that the size of a subarea is smaller than the size of the whole image.
According to a further preferred embodiment, the position of the i-th subarea of the first image with respect to the first image being is either substantially identical or different to the i-th subarea of the second image with respect to the second image.
According to further preferred embodiment of the invention, the i-th subarea of the first image and the (i+1)-th subarea of the first image may overlap partially. However, it may also be possible that the subareas do not overlap, or only a part of the subareas overlap. This is due to the fact that the subarea may be selected randomly and independently.
According to a further preferred embodiment of the invention the output correction term is a return value of a function. More preferably, the function is combining all i-th correction terms into one output correction term.
As an example, as such a function may be considered a mean value of all the correction terms; or a median of all the correction terms. Further alternatively the function may be a computer function, such as for example the RANSAC algorithm or the like, which are highly robust with respect to outliers.
According to a further preferred embodiment of the invention, the method steps a)-e) are repeated at least once. Advantageously, the method is stopped when a termination condition is met.
Preferably, the termination condition may be an absolute difference between the current working distance and stigmator settings and the adjusted working distance and stigmator settings with the absolute difference smaller than a first threshold. Also, preferably the termination condition is a sharpness indication indicating a sharpness of the image with the sharpness indication exceeding a second threshold; or preferably and after a predefined number of repetitions of method steps a)-e). It may be the case that the termination condition is a combination of the presented possibilities to further specify the termination condition.
During development of the inventive method, it could be shown that typically the method converges after three or four iteration steps, that is repetitions of the method.
According to a further preferred embodiment of the invention, method step c) is carried out by using a machine-learning modeling method with machine-learning modeling method settings. Advantageously, the machine-learning modeling method is a deep learning method. Preferably, at least one machine-learning modeling method setting are the weights of the machine-learning modeling method.
The machine-learning modeling method receives as an input the multiple input patch pairs and uses adjustable weights to transform the inputs into one correction term to the working distance and stigmator settings. The machine-learning modeling method preferably comprises a sequence of convolutional and fully connected layers for a non-linear feature extraction of the inputs and transformation to the target domain.
According to a further preferred embodiment of the invention, the machine-learning modeling method weights the i-th output term to each i-th input patch pair with an i-th weighting factor, the i-th weighting factor depending on a by the machine-learning modeling model predicted importance of the i-th input patch pair on the final output correction term.
During the method development, it was noticed that specimen or samples may contain regions or areas with little usable information for an auto-focus algorithm, such as blood vessels in tissue, which show only blank epoxy resin of a sample holder, but no contrast that could be used by an AF algorithm and thereby lead to suboptimal results. Therefore, it was reasoned that these areas should have less weight in any auto focus determination, which was realized by incorporating the i-th weighting factor into the architecture that leads to a new set of outputs of the method to independently weigh each auto focus estimate. These new method outputs are loosely regularized scores, preferably only in terms of weight decay, that are used as weighting factors already during machine-learning model training.
Two different granularities for weighting were tested, first on the level of the input image patches, which are the crops of the larger input image pair acquired by the microscope, and second on the level of individual pixels, leading to a scoring of every location in an input image. Both approaches were more robust toward specimen regions with little contrast information, illustrating that the method does not require conventional image processing to prefilter low contrast regions.
As an example, the output of the processing step is still a correction term which has been extended by the weighing factor:
ΔFi=(Δi,wd,Δi,stigx,Δi,stigy,si)
which can be processed to the output correction term:
According to a preferred embodiment, the training method comprising the steps of:
In particular, the weights of the machine-learning modeling method are adjusted, in particular by using a backpropagation method.
Also, it may be possible to use other techniques/methods than a backpropagation method or even a combination of different methods.
It is noted that the training method described above results in a model specialized on the microscope that was used for the training data generation.
However, it may be the case that a transfer to a different microscope setup with vastly different imaging settings, such as landing energy, beam current, overall working distance range, rotated image acquisition, may lead the method to failure and divergence instead of convergence.
Therefore, a method for generating training data for a machine-learning modeling model is presented, which is independent of the microscope setup and the microscope settings.
Method for generating training data of a machine-learning modeling model used for a microscope setup, in particular an electron microscope, wherein the method is independent of the microscope setup and microscope settings, the microscope being at least adjustable in the following microscope parameters, a working distance, a stigmator in a x-direction and a stigmator in a y-direction, the method comprising the steps:
According to the method for generating the training data, images are obtained based on a movement of the sample only in x-direction and y-direction.
According to a further preferred embodiment of the invention, the optimization method is a classical optimization. An example for an optimization method may be a simplex method or a downhill-simplex method. The advantage of such downhill-simplex method is that it is a very robust and simple. The disadvantage may be the slow convergence speed; however, the method for generating training data creates a minimal set of training data for the new microscope setup such that the presented method for autofocusing is tuned correctly to the new microscope setup such that the method for autofocusing is converging based on the set of training data.
Further, the presented method for generating training data uses the score value representing the sharpness of an image, wherein the score value is directionless and therefore independent of the microscope setup parameters, except for a scaling factor. The scale is taken into account by adjusting the termination threshold according to a).
Further advantages, aims and properties of the present invention will be described by way of the appended drawings and the following description.
In the drawings:
In general, the image of a flat specimen in a microscope setup 1, preferably a scanning electron microscope, is optimally captured when the size of the spot of the electron beam is below the sampling distance. Also, the microscope setup 1 comprises a sample holder 1′ on which a sample 1″ can be arranged.
Commonly, three parameters of the microscope setup 1, namely working distance wd and orthogonal stigmators stigx, stigy, hereinafter also referred to as stigmator in x-direction and y-direction, can be adjusted by microscope operators to directly control the spot shape of the electron beam and bring it below the pixel size at the beam-specimen interaction point, leading consequently to sharp image formation.
In
The method according to the invention, as briefly shown in
In
The method according to the invention first captures the first image 2 and the second image 3 which form the basis for the subsequent method steps.
According to the method, n subareas 7, 9 of the first image 2 and n subareas 8, 10 of the second image 3 are selected, with n≥1, and wherein an i-th subarea 7, 9 of the first image 2 and an i-th subarea 8, 10 of the second image 3 form an i-th input patch pair, 1≤i≤n.
In
Preferably, some or all subareas of one image 2, 3 are overlapping.
In
The image patch pairs form the input data for the processing step, wherein based on each i-th image patch pair a correction term ΔFi 12 to the current working distance and stigmator setting is estimated.
The processing step is carried out by a processing unit 11, wherein preferably the processing unit 11 comprises at least one processor 13 and a memory 14, wherein preferably the memory 14 is coupled to the at least one processor 13 and the memory being designed to store processor-executable commands which, the commands being executable by the at least one processor 13. In particular, the at least one processor 13 may be at least one of a CPU or a CPU and a GPU.
Particularly preferable, the processing step is carried out by the use of a machine-learning modeling method, wherein further preferably the machine-learning modeling method is a deep learning method, the machine-learning method being trainable by training data.
As on output of the processing step, a correction term ΔFi for each of the image patch pairs is obtained, wherein all the correction terms ΔFi are combined by a function, the output of the function being the output correction term ΔF. The output correction term comprises of a correction to the working distance and the stigmators, ΔF=(Δwd,Δstigx,Δstigy).
Subsequently, the output correction term is applied to the current working distance and the stigmator settings, thereby correcting the current settings.
More preferably, in order to improve the overall result of the method, the method steps are repeated at least once, and the method is stopped or terminated when a termination condition is met.
Preferably, the termination condition may be an absolute difference between the current working distance and stigmator settings and the adjusted working distance and stigmator settings with the absolute difference smaller than a first threshold; or wherein preferably the termination condition is a sharpness indication indicating a sharpness of the image with the sharpness indication exceeding a second threshold; or after a predefined number of repetitions of method steps.
After adjusting the working distance and the stigmator settings, the result is a focused or in-focus image 15.
To assess the model, the modeling method has been trained by a training method, wherein the training method comprises the steps of
The training method is briefly shown in
To assess different subareas of the sample, the sample is moved in the x-direction and y-direction to capture different areas of the sample. Preferably, the sample areas are different to each other. Also preferably, the areas are at most partially overlapping.
The working distance and stigmator settings (parameters i) or values of the focused or in-focus image are changed by adding uniformly and independently sampled deltas Δi˜U(ai,bi) to generate a set of distorted images together with the corresponding target values. More specifically, −Δi being the target value for each parameter, that leads back to the in-focus image setting.
As an example, to train the modeling method, the method has been trained for about 44 hours on a single GPU on a set of 32 sample locations with different aberration parameters, in total n=32*10=320 input image pairs, wherein 10 is the number of aberration parameters.
The model has been tested on location-aberration image pairs that were not part of the training data. The method for autofocusing rapidly converges toward the target ΔF values within three iterations, as can be seen in
In particular,
Also, the impact of input alignment has been examined and it was found that the model performs well also in the extreme case that the patches in an input pair did not share the same offset, but were chosen randomly. To quantify the error for a larger range of initial defocus (working distance) values, the remaining ΔF has been measured after the first iteration. As expected, stigmation values were stable, and the remaining working distance error was closer to the target values for smaller initial deviations. Apart from the ability of correcting image aberrations with high accuracy, a well performing auto-focus method should add as little as possible computational overhead over the test image acquisition times. Therefore, the processing time of the method to microscope image acquisition time for CPU-only and GPU-based inference has been compared and run directly on the microscope control computer. As an example for such a control computer, an Intel Xeon CPU E5-2609 v2 with 2.50 GHz and 4 threads and 16 GB RAM together with a NVIDIA T1000 has been used. GPU-based inference was about an order of magnitude faster than CPU-only processing, especially for larger input images patches. Importantly, processing times of the method according to the invention did not add substantial overhead, even for the little optimized CPU-only mode, which will allow widespread deployment of the algorithm to standard microscope computers without hardware modifications.
In
However, during the development of the invention, it was noticed that many specimen contain regions with little usable information for an auto-focus algorithm, such as blood vessels in tissue, which show only blank epoxy resin, but no contrast that could be used by an autofocus method and thereby lead to suboptimal results, as shown in
It was reasoned that these areas should have less weight in any auto focus determination, which was realized by incorporating the i-th weighting factor into the architecture that leads to a new set of outputs of the method to independently weigh each auto focus estimate.
These new outputs are loosely regularized scores that are used as weighting factors already during machine-learning model training.
The new output can be expressed by ΔFi=(Δi,wd,Δi,stigx,Δi,stigy,si).
Two different granularities for weighting have been tested, first on the level of the input image patches, that are the crops of the larger input image pair acquired by the microscope. The crops together with the weight or score are shown in
Secondly, on the level of individual pixels, leading to a scoring of every location in an input image, as shown in
Both approaches were more robust toward specimen regions with little contrast information, illustrating that the method according to the invention does not require conventional image processing to prefilter low contrast regions.
To test to which degree the method according to the invention suffers from overfitting to its remarkably small training set, it was evaluated first on unseen samples and second on an entirely different microscope, with different imaging settings.
Surprisingly, the method according to the invention generalized almost perfectly to novel samples, even when trained only on image data of a single specimen, as presented in
Therefore, a method for generating training data for a machine-learning modeling model is presented, which is independent on the microscope setup and the microscope settings.
It is noted that when the original model is applied on a new setup its correction output can instead also be transformed into the coordinate frame of the new setup, preferably without additional retraining.
Method for generating training data of a machine-learning modeling model used for a microscope setup, in particular an electron microscope, is proposed, wherein the method is independent of the microscope setup and microscope settings, the microscope being at least adjustable in microscope parameters a working distance, a stigmator in a x-direction and a stigmator in a y-direction, the method comprising the steps:
According to the method for generating the training data, images are obtained based on a movement of the sample only in x-direction and y-direction.
Using such a method for generating new training data for a different microscope setup, a new minimal training dataset was created, for n=10 locations corresponding to 31% of the original training set for a microscope setup where the method according to the invention had diverged. Model fine-tuning (recalibration) has been performed in a reasonable short time interval; for example, in one example, fine-tuning took less than 2 hours on a single GPU, and restored the ability to estimate ΔF with the original convergence speed, as shown in
All the features disclosed in the application documents are claimed as being essential to the invention if, individually or in combination, they are novel over the prior art.
Number | Date | Country | Kind |
---|---|---|---|
21212051.3 | Dec 2021 | EP | regional |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/EP2022/083891 | 11/30/2022 | WO |