Method for focusing scanning electron microscope, electronic equipment and storage medium
By using a combination of global gradient difference algorithm and gradient descent method/traversal method on the scanning electron microscope, the problems of low focus efficiency and poor clarity evaluation in the prior art are solved, and a more efficient and robust focus effect is achieved, suitable for complex noise and diversified sample environments.
Patent Information
- Application Number
- CN202411806596.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-15
AI Technical Summary
When the initial focus position deviates far from the ideal focus point, the search steps for coarse focus positioning significantly increase, resulting in a decrease in focus efficiency. In complex noise and diversified sample environments, the clarity evaluation method based on image variance and gradient performs poorly, and has low robustness and accuracy.
The preset global gradient difference algorithm is used to calculate the image sharpness, and the gradient descent method and/or traversal method are used to determine the optimal focus value within the preset focus value interval. By gradually adjusting the focus value and collecting images, efficient focus of the scanning electron microscope is achieved.
It improves the imaging effect of scanning electron microscope in complex noise and diverse sample environments, enhances focus efficiency and robustness, can more accurately adapt to the characteristics of different samples, and provides stronger technical support for nano-level precision imaging.
Smart Images

Figure CN119835545A_ABST
Abstract
Description
Technical Field
[0001] The present application generally relates to the field of image processing technology. More specifically, the present application relates to a method for focusing a scanning electron microscope, an electronic device and a computer-readable storage medium. Background Art
[0002] In modern microscopy, the autofocus algorithm is a key technology for obtaining clear microscopic images, which enables microscopic vision systems to be widely used in many scientific fields such as medical research, electronic chip manufacturing, and bioengineering. This technology automatically controls the focusing mechanism by receiving the light reflected by the object and using the calculation processing inside the sensor and imaging device to ensure the clear presentation of the image on the detector.
[0003] The performance of autofocus technology is determined by the following two key factors: the image clarity evaluation method, which evaluates the clarity of the image based on image variance and gradient; and the iterative optimization strategy, which finds the best focus point by continuously adjusting the focus value. Existing autofocus methods usually adopt a combination of coarse focus positioning and fine focus positioning. However, when the initial focus point position deviates far from the ideal focus, the number of search steps for coarse focus positioning increases significantly, resulting in a significant reduction in the efficiency of autofocus. Although the speed can be increased by manually increasing the focus step size and reducing the number of search steps, how to judge whether the initial focus point position is far away becomes another problem. In addition, the image noise in scanning electron microscope imaging is complex and the sample types are diverse. The existing image clarity evaluation method based on image variance and gradient performs poorly in such a complex environment. It is difficult to cope with the variable characteristics and complex noise interference of different samples. The robustness and accuracy are low, which limits its wide applicability in practical applications.
[0004] In view of this, there is an urgent need to provide a solution for focusing the scanning electron microscope so as to show higher robustness and accuracy when dealing with complex noise and diverse samples, and to improve the focusing efficiency and imaging effect of the scanning electron microscope. Summary of the invention
[0005] In order to at least solve one or more of the technical problems mentioned above, the present application proposes a solution for focusing a scanning electron microscope in the following aspects.
[0006] In a first aspect, the present application provides a method for focusing a scanning electron microscope, comprising: successively adjusting the focus value of the scanning electron microscope along a preset direction, and collecting images formed by adjusting the focus value each time to obtain multiple images; using a preset global gradient difference algorithm to calculate the clarity of each image to obtain multiple image clarity; and based on the successively adjusted focus values and the multiple image clarity, using a gradient descent method and / or a traversal method to determine the optimal focus value within a preset focus value range to complete the focusing of the scanning electron microscope.
[0007] In some embodiments, using a preset global gradient difference algorithm to calculate the clarity of an image includes: using a Gaussian filter to perform a smoothing operation on the image to obtain a smoothed image; performing X-direction difference and Y-direction difference on a preset Gaussian kernel to obtain an X-direction gradient kernel and a Y-direction gradient kernel; using the X-direction gradient kernel and the Y-direction gradient kernel to perform a convolution operation on the smoothed image to obtain a gradient amplitude of each pixel in the smoothed image; and calculating a global standard deviation based on the gradient amplitude of each pixel, and determining the global standard deviation as the image clarity of the image.
[0008] In some embodiments, determining the optimal focus value within a preset focus value interval using the gradient descent method includes: determining a target focus value for the next adjustment using the gradient descent method based on the successively adjusted focus values and the multiple image sharpnesses, and acquiring a target image formed by the target focus value, wherein the target focus value is within the preset focus value interval; calculating the sharpness of the target image using the preset global gradient difference algorithm to obtain the target image sharpness; determining a first difference and a second difference between the target image sharpness and the image sharpness corresponding to the first two adjusted focus values; determining whether the first difference and the second difference are both greater than a preset threshold; and determining the target focus value as the optimal focus value when the first difference is less than the preset threshold or the second difference is less than the preset threshold.
[0009] In some embodiments, the method further includes: when both the first difference and the second difference are greater than a preset threshold, continuing to execute the focus value based on the successive adjustments and the multiple image sharpnesses, using the gradient descent method to determine the target focus value for the next adjustment, and acquiring the target image formed by the target focus value.
[0010] In some embodiments, based on the successively adjusted focus values and the multiple image sharpnesses, determining the target focus value for the next adjustment using the gradient descent method includes: normalizing the multiple image sharpnesses to obtain multiple normalized image sharpnesses; fitting the successively adjusted focus values and the multiple normalized image sharpnesses using the least squares method to obtain an image sharpness function, wherein the image sharpness function is used to represent the relationship between the focus value and the image sharpness; calculating the gradient of the image sharpness function; determining an adaptive learning rate based on the gradient and using an adaptive gradient algorithm; and determining the target focus value for the next adjustment based on the focus value of the last adjustment and the adaptive learning rate.
[0011] In some embodiments, determining the optimal focus value within a preset focus value range using a traversal method includes: determining the maximum image clarity among the multiple image claritys, and determining whether the maximum image clarity corresponds to the first adjustment or the last adjustment in the successive adjustments; when the maximum image clarity corresponds to the first adjustment or the last adjustment in the successive adjustments, determining multiple new focus values as the focus values of the successive adjustment scanning electron microscope according to a preset step size, and continuing to execute the acquisition of images formed by each adjustment of the focus value to obtain multiple images; and when the maximum image clarity does not correspond to the first adjustment or the last adjustment in the successive adjustments, determining the focus value corresponding to the maximum image clarity as the optimal focus value.
[0012] In some embodiments, when the maximum image clarity corresponds to the first adjustment in the successive adjustments, determining multiple new focus values according to a preset step size includes: increasing the focus value corresponding to the first adjustment by a preset overlapping step size to obtain a left starting focus value; and taking the left starting focus value as a starting point, determining multiple new focus values according to the preset step size along the opposite direction of the preset direction.
[0013] In some embodiments, when the maximum image clarity corresponds to the last adjustment in the successive adjustments, determining multiple new focus values according to a preset step size includes: reducing the focus value corresponding to the last adjustment by a preset overlapping step size to obtain a right-side starting focus value; and taking the right-side starting focus value as a starting point, along the preset direction, determining multiple new focus values according to the preset step size.
[0014] In some embodiments, determining multiple new focus values according to the preset step size along the opposite direction of the preset direction includes: determining whether the currently determined new focus value is less than the minimum value in the preset focus value range; and if the currently determined new focus value is less than the minimum value, determining that the currently determined new focus value is equal to the minimum value.
[0015] In some embodiments, determining multiple new focus values along the preset direction according to the preset step size includes: determining whether the currently determined new focus value is greater than the maximum value in the preset focus value range; and if the currently determined new focus value is greater than the maximum value, determining that the currently determined new focus value is equal to the maximum value.
[0016] In a second aspect, the present application provides an electronic device, comprising: a processor; and a memory storing program instructions for focusing a scanning electron microscope, wherein when the program instructions are executed by the processor, the method described in the first aspect and its multiple embodiments are implemented.
[0017] In a third aspect, the present application provides a computer-readable storage medium having stored thereon program instructions for focusing a scanning electron microscope, wherein when the program instructions are executed by a processor, the method described in the first aspect and its multiple embodiments are implemented.
[0018] The method for focusing a scanning electron microscope provided above can adapt to the image clarity evaluation under complex noise and diversified sample environments by presetting the global gradient difference algorithm, and shows high robustness and accuracy. As a result, the imaging effect of the scanning microscope in complex imaging and diversified sample environments is improved, and stronger technical support can be provided for the rapid development of nano-scale precision imaging technology. In addition, by using the gradient descent method and / or the traversal method to determine the optimal focus value within the preset focus value range, the search step size can be intelligently adjusted according to different initial focus positions, reducing the number of search steps and improving the search efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0020] Figure 1 An exemplary flow chart of a method for focusing a scanning electron microscope according to an embodiment of the present application is shown;
[0021] Figure 2 An exemplary flow chart of a method for determining a target focus value for next adjustment by using a gradient descent method according to an embodiment of the present application is shown;
[0022] Figure 3 An exemplary image of a solder ball of an embodiment of the present application under a scanning electron microscope is shown;
[0023] Figure 4 A schematic diagram showing an asymmetric distribution of an embodiment of the present application is shown;
[0024] Figure 5 A schematic diagram showing a numerical oscillation state of an embodiment of the present application;
[0025] Figure 6 An exemplary flow chart showing a method for determining a plurality of new focus values according to a preset step length in some embodiments of the present application;
[0026] Figure 7 An exemplary flow chart showing a method for determining a plurality of new focus values according to a preset step length in some other embodiments of the present application;
[0027] Figure 8The exemplary performance of the variance method and the preset global gradient difference algorithm in complex noise and diverse sample environments is shown;
[0028] Fig. 9 An exemplary process diagram of determining the best focus value using the traversal method is shown;
[0029] Fig.10 An exemplary process diagram of determining the best focus value using the gradient descent method is shown;
[0030] Fig.11 An exemplary process diagram showing a combination of a gradient descent method and a traversal method to determine an optimal focus value is shown;
[0031] Fig.12 An exemplary structural block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0033] It should be understood that when the terms "first", "second", "third" and "fourth" are used in the claims, the specification and the drawings of the present application, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present application indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.
[0034] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this application specification and claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in this application specification and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0035] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0036] The specific implementation of the present application is described in detail below with reference to the accompanying drawings.
[0037] Figure 1 An exemplary flow chart of a method 100 for focusing a scanning electron microscope according to an embodiment of the present application is shown. It is understood that the method 100 may be executed by any appropriate device having data processing capabilities, such as but not limited to a processor, a terminal device, and a server.
[0038] like Figure 1 As shown, at step S101, the method 100 can adjust the focus value of the scanning electron microscope one by one along a preset direction, and collect images formed by adjusting the focus value each time to obtain multiple images. In the context of a scanning electron microscope, the focus value represents the current value of the objective lens. The range of the current value of the objective lens is also the range of the focus value (for distinction, it can be called a preset focus value interval). In one embodiment, the preset direction is the direction of increasing the focus value.
[0039] The number of times the focus value of the scanning electron microscope is adjusted successively in the present application is at least three times. In one embodiment, an arbitrary initial focus value f0 can be set first, and a fixed focus step length f s1ep , collect images near f0, that is, collect three images at focus values f0-fstep, f0, and f0+fstep.
[0040] Next, at step S102, method 100 may use a preset global gradient difference algorithm to calculate the clarity of each image to obtain multiple image clarity. For example, by respectively calculating the clarity of the three images mentioned above, three image clarity g1, g2, and g3 may be obtained. Image clarity can be represented by the gradient of the feature edge. When the image is blurred, the image edge diffuses and the gradient value becomes smaller, but the noise in the image will cause the gradient value to change unstably. Therefore, the present application uses a preset global gradient difference algorithm to calculate the image clarity so as to remove subtle noise while retaining the edge features.
[0041] Specifically, a Gaussian filter may be used to smooth the image to obtain a smoothed image. In practical applications, the size, standard deviation, and order of the Gaussian filter may be selected according to actual denoising requirements. In one embodiment, a Gaussian filter of order 0 may be selected to smooth the image.
[0042] Then, the preset Gaussian kernel can be differentiated in the X direction and the Y direction respectively to obtain the X direction gradient kernel and the Y direction gradient kernel, that is, the rate of change of the pixel value. In practical applications, a preset Gaussian kernel can be generated according to actual needs, and the preset Gaussian kernel gives a greater weight to pixels closer to the center of the image and a smaller weight to pixels farther from the center of the image. After obtaining the X direction gradient kernel and the Y direction gradient kernel, the X direction gradient kernel and the Y direction gradient kernel can be used to perform a convolution operation on the smoothed image to obtain the X direction gradient and the Y direction gradient. The convolution operation calculates the gradient of the image pixel by pixel by sliding the derivative kernel in the image, which can ensure that the changes in the edge area are accurately captured. In this way, the edges in the image can be identified by the gradient amplitude map. Furthermore, the gradient amplitude of each pixel in the smoothed image can be obtained by calculating the square root of the sum of the squares of the X direction gradient and the Y direction gradient.
[0043] Finally, the global standard deviation can be calculated based on the gradient magnitude of each pixel. Specifically, the average value of the gradient magnitude of all pixels can be calculated first. Then, the average value of the square of the difference between the gradient magnitude of all pixels and the average value, that is, the variance, is calculated. Then, the square root of the variance is calculated to obtain the global standard deviation. The global standard deviation can reflect the degree of global difference in the gradient of the image, so it can be determined as the image clarity of the image.
[0044] Finally, at step S103, method 100 may determine the best focus value within a preset focus value range using a gradient descent method and / or a traversal method based on the successively adjusted focus values and a plurality of image sharpnesses to complete the focusing of the scanning electron microscope.
[0045] In one implementation scenario, when the gradient descent method is used to determine the optimal focus value within a preset focus value interval, the target focus value for the next adjustment can be determined by the gradient descent method based on the focus values adjusted successively and the sharpness of multiple images, and a target image formed by the target focus value can be acquired. Here, the target focus value is within the preset focus value interval. In order to facilitate understanding of how to determine the target focus value for the next adjustment by the gradient descent method based on the focus values adjusted successively and the sharpness of multiple images, the following will be combined with Figure 2 A method for determining the target focus value for the next adjustment using the gradient descent method is described in detail.
[0046] After acquiring the target image formed by the target focus value, the definition of the target image can be calculated using a preset global gradient difference algorithm to obtain the definition of the target image. Then, the difference between the definition of the target image and the definition of the image corresponding to the focus values of the first two adjustments (that is, the last two adjustments in the successive adjustments) can be determined (for the sake of distinction, they can be referred to as the first difference and the second difference). After determining the first difference and the second difference, it can be determined whether the target focus value is the optimal focus value.
[0047] Here, it can be determined first whether the first difference and the second difference are both greater than the preset threshold. When the first difference is less than the preset threshold or the second difference is less than the preset threshold, the target focus value can be determined as the optimal focus value. On the contrary, when the first difference and the second difference are both greater than the preset threshold, it can be determined that the target focus value is not the optimal focus value, so it can be transferred to the above-mentioned focus value based on the successive adjustment and multiple image clarity, and the target focus value for the next adjustment can be determined by the gradient descent method, and the target image formed by the target focus value is collected and continued to execute until the optimal focus value is determined. It can be understood that those skilled in the art can select the specific value of the preset threshold according to actual needs, and the present application does not make specific limitations on this. In one embodiment, the specific value of the preset threshold can be 0.001.
[0048] In another implementation scenario, the traversal method can be used to determine the best focus value within a preset focus value interval. The traversal method is a simple and direct search method. Its core idea is to exhaust all possible solutions and evaluate each solution. By checking all possible solutions one by one, it is ensured that the global optimal solution is finally selected. For the automatic focusing problem of scanning electron microscope (SEM) images, this application is based on the core idea of the traversal method, and combined with the partition search strategy, in the current search interval, all focus values are gradually traversed with a preset step size Δf, and the image clarity evaluation value under each focus value is calculated. By judging whether the maximum clarity value in the current search interval exists, if not, the search interval is updated until the focus value with the largest clarity evaluation value is found and used as the best focus value. The main advantage of the traversal method is its simplicity and comprehensiveness, which is easy to understand and operate. For large ranges and small step sizes, the amount of calculation is huge and time-consuming, that is, the smaller the preset step size Δf, the more refined the search, and the amount of calculation will increase accordingly. The larger the preset step size Δf, the larger the search interval and the wider the range.
[0049] In actual operation, when the traversal method is used to determine the best focus value within a preset focus value interval, the maximum value among multiple image sharpnesses can be determined first (for distinction, it can be called the maximum image sharpness), and it can be determined whether the maximum image sharpness corresponds to the first adjustment or the last adjustment in the successive adjustments. Here, the maximum image sharpness corresponding to the first adjustment or the last adjustment actually means that the focus value corresponding to the maximum image sharpness is located at any end point of the current search interval, and the search interval needs to be updated to continue the traversal. On the contrary, the maximum image sharpness does not correspond to the first adjustment or the last adjustment in the successive adjustments, which can mean that the focus value corresponding to the maximum image sharpness is located in the middle of the current search interval, and the traversal can be terminated at this time. Next, different operations can be selected according to the correspondence between the maximum sharpness and the first adjustment or the last adjustment.
[0050] In the case where the maximum image clarity corresponds to the first adjustment or the last adjustment in the successive adjustments, multiple new focus values can be determined according to the preset step length as the focus values for the successive adjustments of the scanning electron microscope, and the process goes to the above step S101 to collect the image formed by each adjustment of the focus value to obtain multiple images and continue to execute. Conversely, in the case where the maximum image clarity does not correspond to the first adjustment or the last adjustment in the successive adjustments, the focus value corresponding to the maximum image clarity can be determined as the optimal focus value. It is understandable that those skilled in the art can select the specific value of the preset step length according to actual needs, and the present application does not make specific limitations on this. In addition, in order to facilitate understanding of how to determine multiple new focus values according to the preset step length, it will be described later in conjunction with Figure 6 and Figure 7 A method for determining a plurality of new focus values according to a preset step length is described in detail.
[0051] In practical applications, the closer to the optimal focus value, the more likely the image clarity will fluctuate, and the gradient descent method is prone to misjudging the position of the optimal focus value. At this time, the respective advantages of the gradient descent method and the traversal method can be combined. The gradient descent method can be used to automatically adjust the step size of the focus value so as to reach the vicinity of the optimal focus value with the least number of steps, and then a round of small step size traversal is used to cover all focus values near the optimal focus value, thereby ensuring that the global optimal solution is finally selected. The combination of the gradient descent method and the traversal method not only speeds up the focusing speed, but also improves the accuracy and reliability under complex noise and diverse samples, and can achieve fast and accurate focusing effects.
[0052] Combination of the above Figure 1A method 100 for focusing a scanning electron microscope is described. The method can adapt to image clarity evaluation in complex noise and diverse sample environments by presetting a global gradient difference algorithm, and exhibits high robustness and accuracy. As a result, the imaging effect of the scanning microscope in complex imaging and diverse sample environments is improved, and stronger technical support can be provided for the rapid development of nano-scale precision imaging technology. In addition, by using a gradient descent method and / or a traversal method to determine the optimal focus value within a preset focus value range, the search step size can be intelligently adjusted according to different initial focus positions, thereby reducing the number of search steps and improving the search efficiency.
[0053] Figure 2 FIG. 2 is an exemplary flow chart of a method 200 for determining a target focus value for the next adjustment using a gradient descent method according to an embodiment of the present application. Figure 2 The description is a specific implementation of the aforementioned step S103, in which the target focus value for the next adjustment is determined by using the gradient descent method based on the focus values adjusted successively and the multiple image sharpnesses. Figure 1 The features described in can be applied analogously here.
[0054] For ease of understanding, the gradient descent method used in this application is first described in detail. As known to those skilled in the art, the gradient descent method is an algorithm commonly used for iterative optimization, and its core idea is to use the gradient information of the objective function to gradually approach the optimal solution along the direction of gradient descent. In the process of focusing a scanning electron microscope, the gradient descent method can be used to optimize the image clarity function C(f) to determine the optimal focus value.
[0055] Specifically, for an image clarity function C(f), its gradient Indicates the direction in which the function value increases fastest at the focus value f. In the standard gradient descent method, the algorithm moves along the negative gradient direction to gradually reduce the image clarity function value and eventually converge to the local minimum. Since the task goal of focusing the SEM is to increase the image clarity, in this scenario, the optimization of the image clarity function C(f) should be carried out along the positive gradient direction, that is, the formula is as follows:
[0056]
[0057] Where η is the learning rate, which is used to control the step size of each update of the focus value.
[0058] In order to avoid the algorithm divergence caused by the direction of large gradient, the adaptive gradient algorithm (AdaptiveGradient, AdaGrad) can be used. This algorithm dynamically adjusts the learning rate η through historical gradient information, so that it can be adaptively adjusted according to the change speed of different parameters. For parameters with large gradients, a smaller learning rate can be set to slow down the update speed. Conversely, for parameters with small gradients, a larger learning rate can be set to speed up the convergence speed. The mathematical expression of AdaGrad is:
[0059]
[0060] Among them, ΣG t is the accumulated value of the square of the historical gradient, and ∈ is the minimum constant used to prevent the denominator from being zero. Through this adaptive adjustment, AdaGrad achieves a more stable and efficient optimization process in different parameter dimensions, especially in scenarios with drastic gradient changes, ensuring fast convergence and stability.
[0061] Next, combine Figure 2 The method 200 for determining the target focus value for the next adjustment using the gradient descent method is described in detail. Figure 2 As shown, at step S201, the method 200 may perform a normalization operation on multiple image sharpnesses to obtain normalized multiple image sharpnesses.
[0062] Next, at step S202, the method 200 may perform a fitting operation on the successively adjusted focus values and the normalized multiple image sharpnesses using the least square method to obtain an image sharpness function, where the image sharpness function is used to represent the relationship between the focus value and the image sharpness.
[0063] As those skilled in the art know, during the focusing process, as the focus value changes, the image clarity first increases with the increase of the focus value, and then gradually decreases after reaching the optimal focus value. Figure 3 For understanding, it shows an exemplary image of the solder ball of the embodiment of the present application under a scanning electron microscope. Figure 3 As shown, from a to b and then to c, as the focus value increases, the clarity of the image of the solder ball continues to improve. In view of this, the relationship between image clarity and focus value can usually be expressed as a single-peak function that first rises and then falls. Therefore, during the focusing process, different focus values correspond to different image clarity, and the relationship between them can be defined as the image clarity function C(f). In one embodiment, the mathematical expression of the image clarity function is:
[0064] C(f t )= af t 2 +bf t+c (3)
[0065] Among them, f t is the focus value, C(f t ) is the image clarity, which is also the objective function in the gradient descent method. The fitting parameters a, b and c can be obtained by fitting the successively adjusted focus values and the normalized multiple image clarity using the least squares method.
[0066] After obtaining the image clarity function, the method 200 may further perform steps S203 to S205 to determine the target focus value for the next adjustment. Specifically, at step S203, the method 200 may calculate the gradient of the image clarity function.
[0067]
[0068] At step S204, method 200 may determine an adaptive learning rate based on a gradient and using an adaptive gradient algorithm, that is, determine the adaptive learning rate η using the above formula (2).
[0069] At step S205, the method 200 may determine the target focus value for the next adjustment using the above formula (1) based on the focus value of the last adjustment in the successive adjustments and the adaptive learning rate.
[0070] In actual operation, as the collected data (multiple image sharpness at different focus values [g t ,g 2,…, g n ]) increases, the fitting operation may deviate. Therefore, it is necessary to perform asymmetry detection on the data to crop and remove redundant data, and perform fitting operations based on the cropped data. Here, the asymmetry detection is to detect whether the maximum value appears in the middle position of the data. In the case where the maximum value appears in the middle position of the data, it can be determined that the data is symmetrically distributed. In the case where the maximum value does not appear in the middle position of the data, but appears in a preset range deviating from the middle position, it can be determined that the data is asymmetrically distributed. Here, the specific value of the preset range can be selected according to actual needs, and this application does not make specific limitations on this.
[0071] In one implementation scenario, asymmetry detection is performed on data. Specifically, it can be determined whether the data meets the detection conditions of asymmetry detection. The detection conditions include that the number of data is greater than a preset number, and the maximum value in the data is not the first and the last in the data. Here, the specific value of the preset number can be selected according to actual needs, and this application does not make specific restrictions on this. For example, the specific value of the preset number can be 10.
[0072] After determining that the data meets the detection conditions of asymmetry detection, the data can be subjected to asymmetry detection. Further, in the case of determining that the data is asymmetrically distributed, the data can be clipped according to different situations. Generally, the asymmetric distribution of data can be divided into two situations (for the sake of distinction, they can be called the first situation and the second situation). The first situation is that the data starts to rise from the left and starts to fall to the right after reaching the maximum value. The second situation is that the data starts to rise from the right and starts to fall to the left after reaching the maximum value. Here, you can refer to Figure 4 For understanding, it shows a schematic diagram of the asymmetric distribution of an embodiment of the present application.
[0073] Figure 4 a in the figure is the first case, where the data starts to rise from the right and starts to fall to the left after reaching the maximum value. In this case, when clipping the data, you can search from the maximum value to the right until you find a position smaller than the starting value, and set the next position as the clipping end point.
[0074] Figure 4 b in the figure is the second case, where the data starts to rise from the left and starts to fall to the right after reaching the maximum value. In this case, when clipping the data, you can search from the maximum value to the left until you find a position smaller than the end value, and set this point as the clipping starting point.
[0075] After completing data cropping, a fitting operation can be performed based on the cropped data to obtain an image clarity function, and the gradient of the image clarity function can be calculated, and then based on the gradient, an adaptive gradient algorithm is used to determine an adaptive learning rate. After that, a numerical oscillation detection can be performed on the gradient to determine whether the gradient has entered a numerical oscillation state. When it is detected that the gradient has entered a numerical oscillation state, the adaptive learning rate can be halved.
[0076] In the solution of this application, the purpose of oscillation detection is to solve the problem that when the gradient descent method is used to optimize a quadratic polynomial, when the iteration reaches the maximum value of the curve, the gradient value jumps back and forth between positive and negative, making it difficult for the algorithm to converge to the maximum value. Figure 5 For understanding, it is a schematic diagram showing the numerical oscillation state of an embodiment of the present application. Figure 5 As shown, the quadratic polynomial y = C(f t ) = af t 2 +bf tThe +c curve has a minimum or maximum point. When a<0, the curve rises first and then falls, showing a parabola shape. On the left side of the curve, the gradient value is positive; on the right side of the curve, the gradient value is negative. Therefore, when the optimization process approaches the extreme point, the gradient value may alternate between positive and negative values, resulting in an "oscillation mode", making it impossible for the optimization algorithm to stabilize on the optimal solution.
[0077] Based on this, the following operations can be used to detect the numerical oscillation of the gradient: obtain the latest four gradients, and convert each gradient into a preset positive number or a preset negative number according to the positive or negative nature of each gradient, the preset positive number is 1, and the preset negative number is -1; check the alternation of the four gradients, that is, divide the four gradients into two adjacent pairs, and determine in turn whether the two gradients in each pair have opposite signs (that is, one is 1 and the other is -1); when the two paired gradients have opposite signs, it can be determined that the adjacent gradients have alternated between positive and negative, that is, a numerical oscillation state has occurred.
[0078] Figure 6 FIG. 6 is an exemplary flow chart of a method 600 for determining a plurality of new focus values according to a preset step length in some embodiments of the present application. Figure 6 The description is a specific implementation of the above step S103 in which, when the maximum image clarity corresponds to the first adjustment in the successive adjustment, multiple new focus values are determined according to the preset step length as the focus values of the scanning electron microscope for successive adjustment. Figure 1 The features described in can be applied analogously here.
[0079] like Figure 6 As shown, at step S601, method 600 may increase the focus value corresponding to the first adjustment by a preset overlap step to obtain a left starting focus value. Here, the purpose of increasing the preset overlap step is to prevent the occurrence of missed focus points. In one embodiment, the preset overlap step may be equal to half of the difference between the focus value corresponding to the last adjustment and the focus value corresponding to the first adjustment.
[0080] Next, at step S602, the method 600 may determine multiple new focus values according to a preset step length along the reverse direction of the preset direction with the left starting focus value as the starting point. After each new focus value is determined, the method 600 may also perform steps S603 and S604 to ensure that the currently determined new focus value does not exceed the preset focus value range.
[0081] Specifically, at step S603, method 600 may determine whether the currently determined new focus value is less than the minimum value in the preset focus value interval. When the currently determined new focus value is not less than (that is, greater than or equal to) the minimum value in the preset focus value interval, it indicates that the new focus value does not exceed the preset focus value interval. When the currently determined new focus value is less than the minimum value, it indicates that the new focus value has exceeded the preset focus value interval, and the value of the new focus value can be adjusted by executing step S604.
[0082] At step S604, the method 600 may determine that the currently determined new focus value is equal to the minimum value when the currently determined new focus value is less than the minimum value. Additionally or optionally, when the currently determined new focus value is equal to the minimum value, there is no need to determine the new focus value according to the preset step size in the opposite direction of the preset direction.
[0083] Figure 7 FIG. 7 is an exemplary flow chart of a method 700 for determining a plurality of new focus values according to a preset step length in some other embodiments of the present application. Figure 7 The description is a specific implementation of the above step S103 in which, when the maximum image clarity corresponds to the last adjustment in the successive adjustments, multiple new focus values are determined according to the preset step length as the focus values of the scanning electron microscope for successive adjustments. Figure 1 The features described in can be applied analogously here.
[0084] like Figure 7 As shown, at step S701, the method 700 may reduce the focus value corresponding to the last adjustment by a preset overlap step length to obtain a right starting focus value. Here, the purpose of reducing the preset overlap step length is to prevent the occurrence of missed focus points. In one embodiment, the preset overlap step length may be equal to half of the difference between the focus value corresponding to the last adjustment and the focus value corresponding to the first adjustment.
[0085] Next, at step S702, the method 700 may determine multiple new focus values along a preset direction and according to a preset step length, starting from the right starting focus value. After each new focus value is determined, the method 700 may also perform steps S703 and S704 to ensure that the currently determined new focus value does not exceed the preset focus value range.
[0086] Specifically, at step S703, method 700 may determine whether the currently determined new focus value is greater than the maximum value in the preset focus value interval. When the currently determined new focus value is not greater than (i.e., less than or equal to) the maximum value in the preset focus value interval, it indicates that the new focus value does not exceed the preset focus value interval. When the currently determined new focus value is greater than the maximum value, it indicates that the new focus value has exceeded the preset focus value interval, and the value of the new focus value may be adjusted by executing step S704.
[0087] At step S704, the method 700 may determine that the currently determined new focus value is equal to the maximum value when the currently determined new focus value is greater than the maximum value. Additionally or optionally, when the currently determined new focus value is equal to the maximum value, there is no need to determine the new focus value along the preset direction and according to the preset step length.
[0088] For ease of understanding, the implementation effects of the preset global gradient difference algorithm, gradient descent method and / or traversal method of the present application are further explained in combination with the following multiple examples.
[0089] First of all, it is necessary to explain the preset global gradient difference algorithm, which is more robust to low signal-to-noise ratio, more in line with the subjective perception of the human eye, not affected by changes in sample characteristics, and suitable for diverse samples. Figure 8 For understanding, it shows the exemplary performance of the variance method and the preset global gradient difference algorithm in complex noise and diverse sample environments. Figure 8 Shows solder balls (such as Figure 8 a1 and a2 in), copper mesh (such as Figure 8 b1 and b2 in), positive electrode of lithium battery (such as Figure 8 c1 and c2) and metals (such as Figure 8 When the sample has a long residence time (e.g. 500ns) under the shooting conditions and the image features are rich and the signal-to-noise ratio is high, the variance method can effectively evaluate the image clarity, such as Figure 8 As shown in a1.
[0090] However, when the dwell time is shortened to 100 ns, the image signal-to-noise ratio is significantly reduced, and the variance method is difficult to cope with the diversity and complexity of the sample, such as Figure 8 As shown in b1, c1 and d1 in FIG, the variance method loses accuracy in evaluating image clarity. In contrast, the preset global gradient difference algorithm of the present application performs better under low dwell time and complex sample conditions, such as Figure 8 As shown in a2, b2, c2 and d2 in the figure, it can not only adapt to the image clarity evaluation needs of diverse samples, but also conform to the subjective perception of image clarity by the human eye, especially in the measurement of edge sharpness, showing stronger robustness and consistency.
[0091] Next, the use of the traversal method to determine the optimal focus value within the preset focus value range is described. In practical applications, when the user needs to obtain all image sharpness within the preset focus value range, the traversal method can be used alone for searching. Fig. 9 For understanding, it shows an exemplary process diagram of determining the best focus value using the traversal method. Fig. 9 As shown in a, starting from the initial focus value f0 = 0.32, the focus step is 0.004, and the focus value range f L ±0.02, and to prevent missed focus values, In order to preset the overlap step, the preset focus value interval is divided into four intervals: interval 1, interval 2, interval 3 and interval 4. Specifically, the focus value of interval 1 is [0.3, 0.304, 0.308, 0.312, 0.316, 0.32, 0.324, 0.328, 0.332, 0.336, 0.34]. Interval 1 includes the initial focus value, and a total of 11 focusing steps are required. When it comes to interval 2, the focus range is overlapped with a preset overlap step of 0.01, but the right end point of interval 1 is not included. Therefore, interval 2 is [0.33, 0.334, 0.338, 0.342, 0.346, 0.35, 0.354, 0.358, 0.362, 0.366], and a total of 10 focusing steps are required, and so on for intervals 3 and 4. As can be seen from Figure a, a total of 41 steps are required to find the optimal focus value.
[0092] like Fig. 9 As shown in b, starting from the initial focus value f0 = 0.32, the focus step is 0.006, and the focus value range f L ±0.04, and to prevent missed focus values, To preset the overlapping step length, the preset focus value interval is divided into two intervals, interval 1 and interval 2. In this case, interval 1 requires a total of 14 focus steps, interval 2 requires a total of 14 focus steps, and generally speaking, a total of 28 steps are required to find the optimal focus value.
[0093] contrast Fig. 9 From a and b in the figure, it can be found that focusing with a larger focus step can effectively reduce the number of focus steps. Therefore, when the distance to the best focus value is far, a large step can be used to save time. When the distance to the best focus value is close, a small step can be used to obtain a more accurate best focus value.
[0094] In one implementation scenario, when it is necessary to start focusing from a distance far from the optimal focus value and to complete focusing quickly, the gradient descent method can be used to determine the optimal focus value within a preset focus value range. Fig.10 For understanding, it shows an exemplary process diagram of determining the best focus value using the gradient descent method. Fig.10 As shown in FIG. 1 , starting from the initial focus value f0=0.32, until the focusing is completed, a total of 24 focusing steps are required. Fig.10 Respectively Fig. 9 By comparing a and b in the figure, we can find that Fig.10 The focusing step size in the method is automatically changed from near to far, and the closer to the optimal focusing value, the smaller the focusing step size, until it gradually converges, and fewer focusing steps are required to determine the optimal focusing value using the gradient descent method.
[0095] In addition, in practical applications, the closer to the best focus value, the more likely the image clarity will fluctuate. In this case, the gradient descent method is likely to misjudge the best focus value. Therefore, the gradient descent method and the traversal method can be combined to determine the best focus value within the preset focus value range. Here, you can refer to Fig.11 For understanding, it shows an exemplary process diagram of combining the gradient descent method and the traversal method to determine the best focus value. Fig.11 As shown in the figure, the gradient descent method can automatically adjust the focus step size, so as to reach the best focus value with the least number of focus steps. Then, a round of traversal with small steps can cover all focus values near the best focus value, and thus obtain a more accurate best focus value. In addition, the total number of focus steps required to determine the best focus value by combining the gradient descent method and the traversal method is 18, which is less than the number of focus steps to determine the best focus value by using the gradient descent method or the traversal method alone.
[0096] Next, combine Fig.12 An electronic device 1200 provided in an embodiment of the present application is exemplarily introduced. Fig.12 As shown, the electronic device 1200 of the embodiment of the present application may include a processor 1201 , a memory 1202 and a communication bus 1203 .
[0097] In the process of a specific embodiment, the processor 1201 may be at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing image processing device (DSPD), a programmable logic image processing device (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor. It can be understood that for different devices, the electronic device used to implement the functions of the processor may also be other, which is not specifically limited in this embodiment.
[0098] In the embodiment of the present application, the communication bus 1203 is used to realize the connection and communication between the processor 1201 and the memory 1202; the memory 1202 stores program instructions for adjusting the scanning electron microscope image; when the processor 1201 executes the program instructions stored in the memory 1202, the present application is realized. Figures 1 to 4 A method for focusing a scanning electron microscope is described.
[0099] Combination of the above Fig.11 An electronic device for adjusting a scanning electron microscope image that can be used to perform the present application is described. It should be understood that the device structure or architecture here is merely exemplary, and the implementation and implementation entity of the present application are not limited thereto, but can be changed without departing from the spirit of the present application. It is understandable that the description of each embodiment in the present disclosure emphasizes the differences between the various embodiments, and the same or corresponding parts can be referenced to each other. For the purpose of brevity, the present disclosure will not repeat them one by one.
[0100] According to the above description in combination with the accompanying drawings, those skilled in the art can also understand that the embodiments of the present application can also be implemented by a software program. Therefore, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores program instructions for controlling the startup of the device, and the program instructions can be used to implement the present application in combination with Figures 1 to 4 A method for focusing a scanning electron microscope is described.
[0101] It should be noted that although the operations of the method of the present application are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0102] Although multiple embodiments of the present application have been shown and described herein, it is obvious to those skilled in the art that such embodiments are provided only by way of example. Those skilled in the art can think of many changes, modifications and alternatives without departing from the thought and spirit of the present application. It should be understood that in the process of practicing the present application, various alternatives to the embodiments of the present application described herein can be adopted. The attached claims are intended to limit the scope of protection of the present application, and therefore cover equivalents or alternatives within the scope of these claims.
Claims
1. A method for focusing a scanning electron microscope, comprising: The focusing value of the scanning electron microscope is adjusted successively along a preset direction, and an image formed by adjusting the focusing value each time is collected to obtain a plurality of images; The clarity of each image is calculated using a preset global gradient difference algorithm to obtain the clarity of multiple images; Based on the successively adjusted focus values and the multiple image sharpnesses, a gradient descent method and / or a traversal method are used to determine an optimal focus value within a preset focus value interval to complete focusing of the scanning electron microscope.
2. The method according to claim 1, wherein: The image clarity is calculated using a preset global gradient difference algorithm including: Performing a smoothing operation on the image using a Gaussian filter to obtain a smoothed image; Performing X-direction difference and Y-direction difference on the preset Gaussian kernel respectively to obtain the X-direction gradient kernel and the Y-direction gradient kernel; Performing a convolution operation on the smoothed image using the X-direction gradient kernel and the Y-direction gradient kernel to obtain a gradient magnitude of each pixel in the smoothed image; A global standard deviation is calculated based on the gradient magnitude of each pixel, and the global standard deviation is determined as the image clarity of the image.
3. The method according to claim 1, wherein: Determining the optimal focus value within a preset focus value range using the gradient descent method includes: Based on the successively adjusted focus values and the plurality of image sharpnesses, the target focus value for the next adjustment is determined by using the gradient descent method, and a target image formed by the target focus value is acquired, wherein the target focus value is within the preset focus value interval; Calculating the definition of the target image using the preset global gradient difference algorithm to obtain the definition of the target image; Determine a first difference and a second difference between the target image clarity and the image clarity corresponding to the first two adjusted focus values; Determining whether the first difference and the second difference are both greater than a preset threshold; When the first difference is smaller than the preset threshold or the second difference is smaller than the preset threshold, the target focus value is determined as the optimal focus value.
4. The method according to claim 3, further comprising: When both the first difference and the second difference are greater than a preset threshold, continue to execute the method based on the successively adjusted focus values and the multiple image sharpnesses, use the gradient descent method to determine the target focus value for the next adjustment, and collect the target image formed by the target focus value.
5. The method according to claim 3 or 4, wherein: Based on the successively adjusted focus values and the plurality of image sharpnesses, determining a target focus value for next adjustment by using the gradient descent method comprises: Performing a normalization operation on the multiple image sharpnesses to obtain normalized multiple image sharpnesses; Using the least square method to perform a fitting operation on the successively adjusted focus values and the normalized multiple image sharpnesses to obtain an image sharpness function, wherein the image sharpness function is used to represent the relationship between the focus value and the image sharpness; Calculating the gradient of the image clarity function; Based on the gradient, an adaptive learning rate is determined using an adaptive gradient algorithm; Based on the focus value of the last adjustment and the adaptive learning rate, a target focus value for the next adjustment is determined.
6. The method according to claim 1, wherein: Determining the best focus value within a preset focus value range using the traversal method includes: Determining a maximum image definition among the plurality of image definitions, and determining whether the maximum image definition corresponds to a first adjustment or a last adjustment in the successive adjustments; In the case where the maximum image definition corresponds to the first adjustment or the last adjustment in the successive adjustment, a plurality of new focus values are determined according to a preset step length as the focus values of the successive adjustment scanning electron microscope, and the image formed by each adjustment of the focus value is continuously acquired to obtain a plurality of images; In a case where the maximum image definition does not correspond to the first adjustment or the last adjustment in the successive adjustments, the focus value corresponding to the maximum image definition is determined as the optimal focus value.
7. The method according to claim 6, wherein: In a case where the maximum image definition corresponds to the first adjustment in the successive adjustments, determining a plurality of new focus values according to a preset step size includes: The focus value corresponding to the first adjustment is increased by a preset overlapping step length to obtain a left starting focus value; Taking the left initial focus value as a starting point, multiple new focus values are determined along the opposite direction of the preset direction according to the preset step length.
8. The method according to claim 6, wherein: In a case where the maximum image definition corresponds to the last adjustment in the successive adjustments, determining a plurality of new focus values according to a preset step size includes: The focus value corresponding to the last adjustment is reduced by a preset overlapping step length to obtain a starting focus value on the right side; Taking the right initial focus value as a starting point, multiple new focus values are determined along the preset direction according to the preset step length.
9. The method according to claim 7, wherein: Determining a plurality of new focus values according to the preset step length along the reverse direction of the preset direction comprises: Determining whether the currently determined new focus value is less than a minimum value in the preset focus value interval; In a case where the currently determined new focus value is less than the minimum value, it is determined that the currently determined new focus value is equal to the minimum value.
10. The method according to claim 8, wherein: Determining a plurality of new focus values along the preset direction according to the preset step length comprises: Determining whether the currently determined new focus value is greater than the maximum value in the preset focus value range; In a case where the currently determined new focus value is greater than the maximum value, it is determined that the currently determined new focus value is equal to the maximum value.
11. An electronic device, comprising: processor; and a memory storing program instructions for focusing the scanning electron microscope, wherein when the program instructions are executed by the processor, the electronic device executes the method according to any one of claims 1-10.
12. A computer-readable storage medium storing program instructions for focusing a scanning electron microscope, wherein when the program instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.