Microscope automatic focusing method and device based on deep learning model, and medium

Through the microscope autofocus method based on the deep learning model, two deep learning methods are used to predict the focal plane position, quickly complete the coarse focus and accurately find the focus plane, solving the problem of slow focusing speed in the existing technology and improving the user experience.

CN120703956APending Publication Date: 2025-09-26NANJING KAISHIMAI TECH CO LTD +2
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202511144979.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Existing microscope autofocus methods are time-consuming, especially in the two-stage focusing process, which requires taking a large number of pictures, resulting in a poor user experience.

Method used

A method based on deep learning models is adopted. The first deep learning model predicts the focal plane direction and distance to guide the coarse focusing process. The second deep learning model is combined to accurately find the focal plane position and reduce the number of images in the fine focusing stage.

Benefits of technology

It significantly improves the focusing speed, reduces the number of pictures in the fine focusing stage, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120703956A_ABST
    Figure CN120703956A_ABST
Patent Text Reader

Abstract

The invention discloses a microscope automatic focusing method and device based on a deep learning model, and a medium, and the method comprises the steps: executing a coarse focusing process through a microscope, and shooting a target, and obtaining a plurality of pictures; inputting two adjacent pictures into a first deep learning model in sequence, and outputting a predicted focal plane direction and a predicted focal plane distance; guiding a coarse focusing movement strategy according to the focal plane direction and the focal plane distance until the focal plane direction deflects, and determining an approximate focal plane position; and photographing the target at the approximate focal plane position, finding out the clearest picture according to the definition, taking the picture and two pictures adjacent to each other up and down as three pictures corresponding to the approximate focal plane position, inputting the three pictures into the second deep learning model, and outputting a predicted focusing plane position. According to the invention, the position of the focusing surface is accurately found through the two deep learning models, and the number of pictures shot by fine focusing at the second stage is greatly reduced, so that the overall focusing speed is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of microscope autofocus technology, and in particular to a microscope autofocus method, device, and medium based on a deep learning model. Background Art

[0002] One of the smart functions of a microscope is autofocus, which means that when a user observes an object through a microscope, the microscope automatically adjusts the distance between the microscope lens and the target object according to the clarity of the target in the field of view, so that the surface of the object is on the focal plane of the microscope, that is, the surface of the object is clearly photographed. A simple diagram of the focal plane is shown below: Figure 1 As shown in the figure, the focal plane is a virtual surface that is fixed relative to the lens and moves up and down with the overall movement of the camera lens.

[0003] The traditional method to achieve this function is to move the microscope lens within a certain range, that is, to continuously adjust the object distance, take pictures at different object distances, calculate the clarity of each picture, and find the picture with the highest clarity, which is the object distance position with the best "focus".

[0004] During this process, there are obvious problems: the object distance interval for each movement should not be too large, otherwise the optimal focal plane will be "missed"; during the movement, many pictures will be taken, and the transmission and related processing of the pictures will take a lot of time, resulting in a long search time for the "focus" plane and a poor user experience. Taking this into account, a two-stage focus plane search method is currently generally adopted. In the first stage, a coarse focus process is performed, that is, the movement interval is slightly larger, and the focus plane is searched over a large range (the position of the focus plane is defined as the position of the microscope lens when the picture is clearest, that is, the object distance at that moment) to find the clearest picture; in the second stage, a fine focus process is performed, that is, near the clearest picture found in the first stage, more pictures are taken at smaller movement intervals to search for a more accurate focus plane. Assuming that in the first coarse focus stage, the microscope position when the sharpest image was captured was point B, and the microscope positions when the two adjacent images were captured were points A and C, the optimal focus plane we are looking for should be between A and C. At this point, we proceed to the second fine focus stage, which involves searching and capturing N images at smaller intervals between the distance between A and C. The clearest image among these N images is the image we are looking for, which is the optimal focus plane. As you can imagine, the optimal focus plane we ultimately find is only an approximation, as we cannot set N to infinity, meaning there is still a certain gap between A and C in our search. As N increases, the focus plane we find becomes more accurate, but the time required for capturing and transmitting the images also increases.

[0005] Even as described above, the two-stage focusing method used in the prior art still takes a long time to search for the focus plane. Summary of the Invention

[0006] Technical purpose: To address the drawback of slow focusing methods in the prior art, the present invention discloses a microscope autofocus method for estimating the focus position based on a deep learning model. The focus plane position is predicted through two deep learning steps to improve the overall focusing speed.

[0007] Technical solution: In order to achieve the above technical objectives, the present invention adopts the following technical solution.

[0008] A microscope autofocus method based on a deep learning model, the method comprising: S1. Use the microscope to perform a coarse focus process to shoot the target and obtain several pictures; S2. Input two adjacent images into the first deep learning model in sequence, and output the predicted focal plane direction and focal plane distance; S3, guiding the coarse focus movement strategy according to the focal plane direction and focal plane distance until the focal plane direction deflects, and determining the approximate focal plane position; S4. Take a picture of the target at the approximate focal position, find the clearest picture based on the clarity, and use the picture and the two pictures above and below it as the three pictures corresponding to the approximate focal position. Input the three pictures corresponding to the approximate focal position into the second deep learning model, and output the predicted focal position.

[0009] Preferably, the structure of the first deep learning model includes: a first feature extraction module, a second feature extraction module, a connection module, an attention module, a focal plane distance prediction module and a focal plane direction prediction module; Among them, the input of the first feature extraction module and the second feature extraction module are both a picture, and the output is connected to the connection module for extracting features from the input picture; the connection module is connected to the attention module, and the attention module is connected to the focal plane distance prediction module and the focal plane direction prediction module respectively. The connection module is used to connect the features output by the first feature extraction module and the second feature extraction module into a feature vector, and output it to the attention module; the attention module is used to process the feature vector, and output the processing results to the focal plane distance prediction module and the focal plane direction prediction module respectively; the focal plane direction prediction module is used to predict the output focal plane direction according to the processing results output by the attention module, and the focal plane distance prediction module is used to predict the output focal plane distance according to the processing results output by the attention module.

[0010] Preferably, in the training set of the first deep learning model, the image focus direction annotation information is determined based on the out-of-focus diffusion phenomenon.

[0011] Preferably, the focal plane direction is used to indicate whether the two currently input pictures are close to or away from the focus plane. The two currently input pictures have a sequence in S1 acquisition. If the focal plane direction is the same as the sequence direction of the two currently input pictures, it means that the current coarse focus process is a process of approaching the focus plane; if the focal plane direction is opposite to the sequence direction of the two currently input pictures, it means that the current coarse focus process is a process of moving away from the focus plane; the focal plane distance is used to indicate the distance between the picture close to the focus plane and the focus plane in the two currently input pictures.

[0012] Preferably, the structure of the second deep learning model includes: three feature extraction modules, a feature fusion module and an output module; The inputs of the three feature extraction modules are three pictures corresponding to the approximate focal plane positions, which are used for feature extraction and then output to the feature fusion module; the three pictures are defined as imageA, imageB, and imageC according to the order of microscope shooting, representing the pictures taken at the microscope points A, B, and C respectively; the feature fusion module is connected to the three feature extraction modules, and is used to perform convolution fusion on the extracted features, and output N+1 nodes, which are defined as categories 0 to N. When the category number predicted by the second deep learning model output is 0, the focal plane position is point A; when the category number predicted by the second deep learning model output is N, the focal plane position is point C; when the category number predicted by the second deep learning model output is N / 2, N / 2 is an integer, and the focal plane position is point B; the output module is connected to the feature fusion module, and is used to output the prediction result, and the focal plane position is obtained according to the prediction result.

[0013] Preferably, the training data of the second deep learning model is obtained by using a two-stage focusing method; in the coarse focusing stage, three pictures corresponding to the approximate focal plane position are obtained, which are defined as imageA, imageB, and imageC respectively; imageA, imageB, and imageC are pictures taken at point A, point B, and point C; in the fine focusing stage, N intervals are set for taking pictures, where N is the number of output nodes in the second deep learning model minus 1; then the size of each interval is delta = (CA) / N, and in the fine focusing stage, the position of the picture with the best clarity is calculated to find out as the focal plane position, and the focal plane position is defined as e, then the groundtruth of the output result of the second deep learning model is (eA) / delta.

[0014] Preferably, the microscope autofocus method further comprises the following steps: S5. Execute a fine focus process at M' positions near the predicted focus plane position; wherein M' is an integer and M' is less than the number of shooting positions in the coarse focus process; S6. Calculate the clarity of each image in the fine focus process to obtain the final focus plane position.

[0015] Preferably, guiding the coarse focus movement strategy according to the focal plane direction and the focal plane distance includes: increasing the Z-axis speed during the coarse focus movement when the focal plane direction is not deflected and the focal plane distance is greater than a preset threshold.

[0016] The present invention also discloses a computer device, which includes a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement any of the above-mentioned microscope autofocus methods based on a deep learning model.

[0017] The present invention also provides a computer storage medium, wherein a computer program is stored on the computer-readable storage medium. When the computer program is executed, the device executing the computer program implements any of the above-described microscope autofocus methods based on a deep learning model.

[0018] Beneficial effect: The present invention adopts two deep learning methods to predict the focus plane position. First, the focus plane position and focus plane direction are obtained through the first deep learning model, and the coarse focus strategy is adjusted in time to quickly complete the coarse focus process; then the second deep learning model is used to accurately find the position of the focus plane, which greatly reduces the number of pictures taken in the second stage of fine focus, thereby improving the overall focusing speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flow chart of the overall method of an embodiment of the present invention; Figure 2 Schematic diagram of the focusing plane of a microscope according to an embodiment of the present invention; Figure 3 Schematic diagram of the structure of a first deep learning model according to an embodiment of the present invention; Figure 4 Schematic diagram of the structure of the second deep learning model of an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application. Example

[0021] As attached Figure 1 and attached Figure 2As shown, a microscope autofocus method based on a deep learning model in this embodiment includes the following steps: S1. Use the microscope to perform a coarse focus process to shoot the target and obtain several pictures; The process of coarse focusing is that the microscope continuously moves the focusing axis to shoot the target and takes back a series of pictures, that is, a number of pictures are obtained, which can be defined as image1, image2, image3, image4...

[0022] S2. Input two adjacent images into the first deep learning model in sequence, and output the predicted focal plane direction and focal plane distance; As attached Figure 3 As shown, the structure of the first deep learning model includes: a first feature extraction module, a second feature extraction module, a connection module, an attention module, a focal plane distance prediction module and a focal plane direction prediction module; The input of the first feature extraction module and the second feature extraction module are both an image, and the output is connected to the connection module for extracting features from the input image; the first feature extraction module and the second feature extraction module can be implemented using an existing network structure, and a network structure that can extract features from the input image can be used; in this embodiment, the first feature extraction module and the second feature extraction module both use a CNN network; The connection module is connected to the attention module, and the attention module is connected to the focal plane distance prediction module and the focal plane direction prediction module respectively. The connection module is used to connect the features output by the first feature extraction module and the second feature extraction module into a feature vector, and output it to the attention module; in this embodiment, the connection module is a concat module. The attention module is used to process the feature vector and output the processing results to the focal plane distance prediction module and the focal plane direction prediction module respectively; in this embodiment, the attention module adopts a self-attention mechanism, namely self-attention, and the attention module includes a plurality of cascaded attention units, and the number of attention units is 3 or 5, and the number can also be set according to the actual amount of calculation and other conditions. The focal plane direction prediction module is used to predict the output focal plane direction according to the processing result output by the attention module, and the focal plane distance prediction module is used to predict the output focal plane distance according to the processing result output by the attention module; In this embodiment, both the focal plane distance prediction module and the focal plane direction prediction module are implemented using a CNN network with fully connected layers. The specific number of layers and neurons is set based on the computational complexity and will not be described in detail here. The focal plane distance is an integer, for example, represented by an integer dn. This means that in reality, we still need to go through dn images to reach the focal plane. When dn is large, it indicates that our current position is still relatively far from the focal plane. In this case, we can increase the Z-axis speed to move closer to the focal plane more quickly.

[0023] The training process of the first deep learning model can adopt existing training methods, which will not be elaborated here. It should be noted that in the training set of the first deep learning model, the annotation information of the picture focal plane direction is determined according to the out-of-focus point spread phenomenon, that is, the focal plane directions corresponding to two pictures are manually determined according to the out-of-focus point spread phenomenon. During the process of the microscope shooting the target, when out of focus, a certain pixel point will present an out-of-focus blurred form, which is a kind of out-of-focus point spread phenomenon. Moreover, when the distance from the focus plane is farther, that is, the more serious the out-of-focus is, the more serious the point spread phenomenon is. For the same point, for image 1 taken at a distance d1 from the focus plane and image 2 taken at a distance d2 from the focus plane, if d1 < d2, comparing the point spread phenomena of this point in image 1 and image 2, the point spread phenomenon in image 2 is more serious, and the visually seen image is more blurred. Based on this phenomenon, we use the first deep learning model to learn the characteristics of point spread in the annotated data to predict the direction and distance of the focus plane from the current position, and to predict a more accurate focus plane position through multiple pictures.

[0024] In the present invention, the focal plane direction is represented by a numerical value of 0 or 1, which is used to indicate whether the two currently input pictures are approaching or moving away from the focus plane. There is a sequence for the two currently input pictures obtained in S1. When the value of the focal plane direction is 1, that is, the focal plane direction is the same as the sequence direction of the two currently input pictures, it indicates that the current rough focusing process is a process of approaching the focus plane; when the value of the focal plane direction is 0, that is, the focal plane direction is opposite to the sequence direction of the two currently input pictures, it indicates that the current rough focusing process is a process of moving away from the focus plane; the focal plane distance is used to indicate the distance between the picture approaching the focus plane and the focus plane among the two currently input pictures. <(

[0025] For example, among image1, image2, image3, image4...imageM-1, imageM obtained by S1, after each group of two adjacent images is input into the first deep learning model, the corresponding focal plane direction and focal plane distance can be obtained. After image1 and image2 are input into the first deep learning model, the output focal plane direction value is 1, and the direction is direct1→2. At this time, the focal plane direction is the same as the order of image1 and image2. At this time, the coarse focusing process is the process of approaching the focal plane, and the focal plane distance is the distance between image2 and the focal plane; after image2 and image3 are input into the first deep learning model, the output focal plane direction value is 1, and the direction is direct2→3. At this time, the focal plane direction is the same as the order of image2 and image3. At this time, the coarse focusing process is the process of approaching the focal plane, and the focal plane distance is the distance between image2 and the focal plane; after imageM-1 and imageM are input into the first deep learning model, the output focal plane direction value is 0, and the direction is directM-1←M. At this time, the focal plane direction is opposite to the order of imageM-1 and imageM. At this time, the coarse focusing process is the process of moving away from the focal plane, and the focal plane distance is the distance between imageM-1 and the focal plane.

[0026] S3, guiding the coarse focus movement strategy according to the focal plane direction and focal plane distance until the focal plane direction deflects, and determining the approximate focal plane position; In the series of focus plane directions obtained in S2, if the focus plane direction deflects, it means that the focus plane position has been passed. At this time, the two focus plane distances corresponding to the focus plane direction deflection are used as the distance range to which the approximate focus plane position belongs. After finding the approximate focus plane position, the coarse focus process can be stopped.

[0027] Among image1, image2, image3, image4...imageM-1, imageM obtained by S1, there must be a continuous group of images, namely imageA, imageB, imageC. After imageA and imageB are input into the first deep learning model, the output focus direction value is 1, and the direction is directA→B; after imageB and imageC are input into the first deep learning model, the output focus direction value is 0, and the direction is directB←C; that is, the focus direction deflection occurs in the process of taking the three photos of imageA, imageB, and imageC, and the approximate focus position is between the position intervals corresponding to the three pictures of imageA, imageB, and imageC, and the focus position is near the position corresponding to imageB.

[0028] In this embodiment, a coarse focus movement strategy is guided by the focal plane direction and focal plane distance. The strategy includes: when the focal plane direction is not deflected and the focal plane distance is large, such as exceeding a preset threshold, the Z-axis speed can be increased or the adjustment spacing can be increased to more quickly approach the focal plane. When the focal plane direction is not deflected and the focal plane distance is small, such as less than a preset threshold, the Z-axis speed can be decreased or the initial adjustment spacing can be restored to approach the focal plane. The Z-axis speed can be roughly calculated based on the following assumption: if the current focal plane distance is dn, increasing the Z-axis speed will cause the microscope to reach a position 0.7*dn or 0.5*dn away from the focal plane for the next image.

[0029] S4. Take a picture of the target at the approximate focal plane position, find the clearest picture based on the clarity, use the picture and the two pictures above and below it as the three pictures corresponding to the approximate focal plane position, input the three pictures corresponding to the approximate focal plane position into the second deep learning model, and output the predicted focal plane position; As attached Figure 4 As shown, the structure of the second deep learning model includes: three feature extraction modules, a feature fusion module and an output module; The inputs of the three feature extraction modules are three images corresponding to the approximate focal plane position, which are used for feature extraction and then output to the feature fusion module. In this embodiment, there are no specific structural restrictions on the feature extraction module. Generally, the feature extraction module of ResNet50 or EfficientNetV2 can be used. The feature fusion module is connected to the three feature extraction modules to perform convolution fusion on the extracted features and output N+1 nodes; the feature fusion module uses multiple convolution layers to perform convolution fusion on the features.

[0030] The output module is connected to the feature fusion module and is used to output the prediction results and obtain the focus plane position according to the prediction results. In this embodiment, the output module uses softmax for output.

[0031] The second deep learning model training process requires the preparation of appropriate training data. The method for preparing training data is to use the traditional method of judging the focus plane based on clarity, that is, a two-stage focusing method. The training data of the second deep learning model is obtained by using a two-stage focusing method; in the coarse focusing stage, three images corresponding to the approximate focus position are obtained, which are defined as imageA, imageB, and imageC respectively; imageA, imageB, and imageC are images taken at point A, point B, and point C, among which the target is photographed at the approximate focus position, and the clearest image is found according to the clarity, and this image is used as the point B image, and the two images above and below the point B image are the point A image and the point C image respectively; in the fine focusing stage, N intervals are set for taking pictures, where the value of N is the number of output nodes in the second deep learning model minus 1, that is, the value of N corresponds to the number of nodes N+1 in the second deep learning model; then the size of each interval is delta = (CA) / N, and the position of the image with the best clarity is calculated in the fine focusing stage as the focus plane position, and the focus plane position is defined as e, then the groundtruth of the output result of the second deep learning model is (eA) / delta.

[0032] Specifically, in the first stage, coarse focus, the positions of points A, B, and C, along with the corresponding three images, are recorded. In the second stage, fine focus, N intervals are set for taking photos. Each interval is delta = (CA) / N. The position of the image with optimal clarity is calculated, assuming this position is e. Note that the number of intervals N here corresponds to the number of nodes in the second deep learning model, N+1. The "category" number of the model output corresponding to these three images should be (eA) / delta. The training set we prepared then takes three images as input, and the output groundtruth is (eA) / delta. A large number of object surfaces are used to construct the training set. The method for training the model using this training set is the same as traditional deep learning classification training methods and will not be elaborated here.

[0033] In this embodiment, a photograph of the target is taken at a roughly focal position. The clearest image is found based on clarity and used as the point B image. The two images above and below the point B image, namely, the point A image and the point C image, are collectively used as the three images corresponding to the roughly focal position. When the roughly focal position is within the position interval of the three images imageA, imageB, and imageC, imageA, imageB, and imageC are input into a second deep learning model. The second deep learning model is a classification model that outputs one (N+1) node, defined as 0 to N categories. The N+1 output nodes are a one-hot method (a common output method used in deep learning classification to ensure that the output can only and only belong to a certain category). The output of these N+1 nodes is defined as follows: when the output "category" number is smaller, the optimal focus plane is closer to point A corresponding to imageA, and when the output "category" number is larger, the optimal focus plane is closer to point C corresponding to imageC. When the output "category" number is 0, the optimal focus plane is A. When the output "category" number is N, the optimal focus plane is C. When the output "number" is N / 2, and N / 2 is an integer, the optimal focus plane is B. Because the computational complexity of the second deep learning model is basically unrelated to the number of output nodes, when using this model, N can be set to a larger value. A larger N means a more accurate focus plane position.

[0034] In this embodiment, a relatively accurate focus plane position can generally be obtained in S4. In some other embodiments, in order to improve the accuracy of the focus plane, the following steps are further included: S5. Execute a fine focus process at M' positions near the predicted focus plane position; wherein M' is an integer and M' is less than the number of shooting positions in the coarse focus process; S6. Calculate the clarity of each image in the fine focus process to obtain the final focus plane position.

[0035] After the present invention obtains the predicted optimal focal plane position in S4, since the output of the second deep learning model may not be completely accurate, to further improve the accuracy of the focal plane, a fine focus can be performed. That is, M' positions are searched near the predicted focal plane position, the sharpness of M' positions is calculated, and the optimal sharpness is found, that is, the final focal plane position corresponding to the optimal sharpness is obtained. In actual application, the coarse focus process captures M positions, respectively obtaining images image1, image2, image3, image4...imageM-1, imageM, and limiting M' to less than M to achieve the purpose of reducing the number of images and the amount of calculation during the fine focus process.

[0036] Among them, the methods of S5 and S6 can be implemented by existing methods and will not be described in detail here.

[0037] In the first stage, i.e., the coarse focusing stage, the method of the present invention utilizes a deep learning method to predict the direction of the focus plane and the distance to the focus plane, thereby timely adjusting the coarse focusing strategy. By adjusting this strategy, the coarse focusing process is quickly completed. Next, the present invention again utilizes the deep learning method to accurately locate the focus plane based on the approximate position of the focus plane found during the coarse focusing, thereby reducing the number of search and photo shooting required during the second stage, the fine focusing stage, thereby reducing the search and photo shooting calculation time during the second stage, and achieving the purpose of more accurately finding the focus plane.

[0038] The present invention also discloses a computer device comprising a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement any of the above-described methods for microscope autofocus based on a deep learning model. The memory can be any type of memory, including random access memory (RAM), read-only memory (ROM), flash memory, and the like, such as read-only memory (ROM) / RAM, a magnetic disk, or an optical disk.

[0039] The present invention also provides a computer storage medium having a computer program stored thereon. When the computer program is executed, the device executing the computer program implements the aforementioned microscope autofocus method based on a deep learning model. The computer storage medium may be a readable storage medium, a non-volatile storage medium, or a volatile storage medium. For example, the computer storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0040] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A microscope autofocus method based on a deep learning model, characterized in that the method include: S1. Use the microscope to perform a coarse focus process to shoot the target and obtain several pictures; S2. Input two adjacent images into the first deep learning model in sequence, and output the predicted focal plane direction and focal plane distance; S3, guiding the coarse focus movement strategy according to the focal plane direction and focal plane distance until the focal plane direction deflects, and determining the approximate focal plane position; S4. Take a picture of the target at the approximate focal position, find the clearest picture based on the clarity, and use the picture and the two pictures above and below it as the three pictures corresponding to the approximate focal position. Input the three pictures corresponding to the approximate focal position into the second deep learning model, and output the predicted focal position.

2. The microscope autofocus method based on a deep learning model according to claim 1, characterized in that: The structure of the first deep learning model includes: a first feature extraction module, a second feature extraction module, a connection module, an attention module, a focal plane distance prediction module and a focal plane direction prediction module; Among them, the input of the first feature extraction module and the second feature extraction module are both a picture, and the output is connected to the connection module for extracting features from the input picture; the connection module is connected to the attention module, and the attention module is connected to the focal plane distance prediction module and the focal plane direction prediction module respectively. The connection module is used to connect the features output by the first feature extraction module and the second feature extraction module into a feature vector, and output it to the attention module; the attention module is used to process the feature vector, and output the processing results to the focal plane distance prediction module and the focal plane direction prediction module respectively; the focal plane direction prediction module is used to predict the output focal plane direction according to the processing results output by the attention module, and the focal plane distance prediction module is used to predict the output focal plane distance according to the processing results output by the attention module.

3. The microscope autofocus method based on a deep learning model according to claim 1, characterized in that: In the training set of the first deep learning model, the focus direction annotation information of the image is determined based on the out-of-focus diffusion phenomenon.

4. The microscope autofocus method based on a deep learning model according to claim 1, characterized in that: The focus plane direction is used to indicate whether the two currently input images are close to or away from the focus plane. The two currently input images have a sequence in S1 acquisition. If the focus plane direction is the same as the sequence of the two currently input images, it means that the current coarse focus process is a process of approaching the focus plane; if the focus plane direction is opposite to the sequence of the two currently input images, it means that the current coarse focus process is a process of moving away from the focus plane; the focus plane distance is used to indicate the distance between the image close to the focus plane and the focus plane of the two currently input images.

5. The microscope autofocus method based on a deep learning model according to claim 1, characterized in that: The structure of the second deep learning model includes: three feature extraction modules, a feature fusion module and an output module; The inputs of the three feature extraction modules are three pictures corresponding to the approximate focal plane positions, which are used for feature extraction and then output to the feature fusion module; the three pictures are defined as imageA, imageB, and imageC according to the order of microscope shooting, representing the pictures taken at the microscope points A, B, and C respectively; the feature fusion module is connected to the three feature extraction modules, and is used to perform convolution fusion on the extracted features, and output N+1 nodes, which are defined as categories 0 to N. When the category number predicted by the second deep learning model output is 0, the focal plane position is point A; when the category number predicted by the second deep learning model output is N, the focal plane position is point C; when the category number predicted by the second deep learning model output is N / 2, N / 2 is an integer, and the focal plane position is point B; the output module is connected to the feature fusion module, and is used to output the prediction result, and the focal plane position is obtained according to the prediction result.

6. The microscope autofocus method based on a deep learning model according to claim 1, characterized in that: The training data for the second deep learning model is obtained using a two-stage focusing method; in the coarse focusing stage, three images corresponding to the approximate focal plane position are obtained, which are defined as imageA, imageB, and imageC respectively; imageA, imageB, and imageC are images taken at point A, point B, and point C; in the fine focusing stage, N intervals are set for taking pictures, where N is the number of output nodes in the second deep learning model minus 1; then the size of each interval is delta = (CA) / N, and in the fine focusing stage, the position of the image with the best clarity is calculated as the focal plane position, and the focal plane position is defined as e, then the groundtruth of the output result of the second deep learning model is (eA) / delta.

7. The microscope autofocus method based on a deep learning model according to claim 1, characterized in that: The microscope autofocus method further includes the following steps: S5. Execute a fine focus process at M' positions near the predicted focus plane position; wherein M' is an integer and M' is less than the number of shooting positions in the coarse focus process; S6. Calculate the clarity of each image in the fine focus process to obtain the final focus plane position.

8. The microscope autofocus method based on a deep learning model according to claim 1, characterized in that: A coarse focus movement strategy is guided according to the focal plane direction and the focal plane distance, including increasing the Z-axis speed during the coarse focus movement when the focal plane direction is not deflected and the focal plane distance is greater than a preset threshold.

9. A computer device comprising a processor and a memory, wherein: The memory stores a computer program, and the processor is used to execute the computer program to implement a microscope autofocus method based on a deep learning model as described in any one of claims 1-8.

10. A computer storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed, the device executing the computer program implements the microscope autofocus method based on a deep learning model as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Photographing method and device

    CN106161960A

  • Microscope focusing method and apparatus, computer apparatus, and storage medium

    CN109116541A

  • Automatic focusing method and device of microscopic image based on deep learning

    CN111007661A

  • Embryo multi-focal plane image implantation prediction device based on multi-modal fusion

    CN116433612A

  • Automatic focusing method of scanner

    CN118426136A