Focal plane non-turn-back microscopic focusing method based on deep learning
Patent Information
- Application Number
- CN202410973172.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-19
AI Technical Summary
[0004]本发明的目的是为解决现有聚焦方法需要焦平面多次折返振荡,导致所需聚焦时间长、聚焦效率低的问题,而提出了一种基于深度学习的焦平面无折返显微聚焦方法
[0050] 1. The present invention first constructs and trains a focus measurement network. When a microscopic image of an imaging target is input, the focus measurement network outputs a focus measurement map describing the focus degree of each area of the original image, also called a semantic segmentation map; After delineating the area of interest from the focus measurement map, the average pixel value in the area of interest is counted as the sharpness measurement value of the input image. Finally, a search strategy based on pid control is implemented to implement a variable step search strategy.
Smart Images

Figure CN118962954A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of microscopic imaging technology, and in particular relates to a focal plane non-reentry microscopic focusing method based on deep learning. Background Art
[0002] Microscopes are important tools for exploring the microscopic world and are widely used in biomedicine, electronic component testing and other fields. However, due to the limitations of the optical structure of the microscope, its depth of field is usually small. This causes the image to blur rapidly when the imaging target deviates from the focal plane. Therefore, focusing is a necessary operation for the microscope to work properly and obtain high-quality images. The focusing of the microscope is mainly divided into two directions: based on hardware modification and based on software algorithms. Hardware modification usually involves modifying the illumination source, introducing light field modulation elements (SLM, phase plate), etc. to obtain the encoded defocus information, such as the literature (Silvestri L, Müllenbroich MC, Costantini I, et al. Universal autofocus for quantitative volumetric microscopy of whole mouse brains [J]. Nature Methods, 2021, 18 (8): 953-958. and Ge Z, Wei H, Xu F, et al. Millisecond autofocusing microscopy using neuromorphic event sensing [J]. Optics and Lasers in Engineering, 2023, 160: 107247.), and then decoding and processing the defocus information to complete the focusing. This type of method based on hardware modification usually has good performance in efficiency and accuracy, but because it needs to add components to modify the microscope structure, its versatility is limited and it is difficult to apply to commercial microscopes. In contrast, the software algorithm only needs to process the digital image collected by the microscope to complete the focusing. Due to its easy deployment and implementation, it has received widespread attention and research.
[0003] A relatively primitive software focusing method is to move the entire target with a certain step length and then scan it, and then select the image with the largest clarity value as the focused image. However, this method requires the acquisition of a large number of images, and the focal plane moves a large distance, resulting in a long focusing time and low efficiency. More commercial software uses a multi-scale search method (Chen Chuan, Zhang Min, Qiu Hao, et al. Microscope autofocus system based on improved hill climbing algorithm [J]. Journal of Jiangsu University of Technology, 2023, 29(02): 10-18. DOI: 10.19831 / j.cnki.2095-7394.2023.02.002.). This method first scans the target with a large step length. When it is found that the clarity value changes from small to large and then to small, it means that the best focus point has been passed. At this time, a small step length return search is used. This method greatly reduces the focal plane movement distance. However, this method will repeatedly search near the best focus position during the search process, causing the focal plane to oscillate multiple times. In addition to the multi-scale search method, the existing focus algorithm search strategies basically require the focal plane to cross the optimal focus position and then return, but the focal plane return will waste unnecessary time and be inefficient. Therefore, in order to solve the above problems, it is necessary to propose a new microscopic focusing method that does not require focal plane return. Summary of the invention
[0004] The purpose of the present invention is to solve the problem that the existing focusing method requires multiple reentry oscillations of the focal plane, resulting in long focusing time and low focusing efficiency, and proposes a focal plane non-reentry microscopic focusing method based on deep learning.
[0005] The technical solution adopted by the present invention to solve the above technical problems is: a focal plane non-reentry micro-focusing method based on deep learning, the method specifically comprises the following steps:
[0006] Step 1: Build a focus measurement network including an encoder and a decoder;
[0007] Step 2: Generate a point spread function according to the microscope parameters, and then generate a training data set for the focus measurement network based on the point spread function;
[0008] Step 3: Use the training data set generated in step 2 to train the built focus measurement network to obtain a trained focus measurement network;
[0009] Step 4: Capture an image of the imaging target under a microscope, crop the captured image, and input each image block obtained by cropping into a trained focus measurement network to obtain a semantic segmentation map corresponding to the captured image;
[0010] And extract the image of the region of interest from the semantic segmentation map;
[0011] Step 5, calculating the average value of each pixel in the image of the region of interest cut out in step 4, and using the calculated average value as the clarity value of the region of interest;
[0012] Step 6: Calculate the difference between the clarity value obtained in step 5 and the target clarity value, and determine whether the difference is less than a set threshold value γ;
[0013] If the difference is less than the set threshold γ, focusing is completed;
[0014] If the difference is greater than or equal to the set threshold γ, execute step seven;
[0015] Step 7: Calculate the moving step length of the focal plane according to the clarity value obtained in step 5, move the focal plane according to the moving direction and the calculated moving step length, and re-capture the image of the imaging target at the new focal plane position;
[0016] Return to step 4 for the re-acquired imaging target image.
[0017] Furthermore, the encoder of the focus measurement network includes N attention mechanism modules with the same structure connected in sequence, and the attention mechanism module includes a self-attention mechanism layer, a convolution layer with a convolution kernel size of 3×3, and an image block overlap area processing unit; the image block overlap area processing unit includes a convolution layer with a convolution kernel size of 7×7 and a convolution layer with a convolution kernel size of 3×3;
[0018] The decoder consists of two multi-layer perceptrons.
[0019] Preferably, the number N of the attention mechanism modules is 4.
[0020] Furthermore, in step 2, the training data set is generated by:
[0021] For any training data:
[0022] Step 1: Generate the point spread function according to the microscope parameters and the Born&Wolf model in the imageJ software;
[0023] Step 2, obtaining a slice with texture information, and manually photographing an image of the obtained slice in a focused state under a microscope;
[0024] Step 3: Get the depth map corresponding to the slice in step 2, specifically:
[0025] Generate perlin noise to simulate the ups and downs of the object in the slice in step 2 to obtain a depth map;
[0026] Step 4: Combine the image obtained in step 2 and the depth map obtained in step 3 to obtain a 3D surface texture map;
[0027] Step 5: Convolve the 3D surface texture map with the point spread function to generate a virtual degradation map, and use the generated virtual degradation map as the input part of the training data. Calculate the absolute distance between the value of each pixel in the depth map and the focal plane position, and use the absolute distance corresponding to each pixel as the output part of the training data, that is, use the absolute distance corresponding to each pixel to form a label image.
[0028] Furthermore, the working process of the focusing measurement network is:
[0029] Each image block obtained by cropping in step 4 is used as the input of the focus measurement network. In the focus measurement network, each image block first passes through the encoder, and then the outputs of the N attention mechanism modules of the encoder are input to the first multi-layer perceptron of the decoder;
[0030] After the first multi-layer perceptron scales the N feature maps to the same dimension, it concatenates the scaled N feature maps into one feature map along the channel dimension, and uses the concatenated feature map as the input of the second multi-layer perceptron;
[0031] The semantic segmentation map is output through the second multi-layer perceptron.
[0032] Furthermore, before each image block is input into the focus measurement network, it needs to be pre-processed by a Sobel operator.
[0033] Furthermore, the calculation of the moving step length of the focal plane according to the clarity value obtained in step five adopts a PID controller.
[0034] Furthermore, the moving step length of the focal plane is calculated according to the clarity value obtained in step 5, specifically:
[0035] Z _step =K p (C _set -C _cur )+K d C _diff +K i C _intgral
[0036] Among them, Z _step is the moving step length of the focal plane, C _cur is the clarity value obtained in step 5, C _set is the target clarity value, C _diff is the differential term of the PID controller, C _intgral is the integral term of the PID controller, K p ,Kd and K i These are the control parameters of the PID controller.
[0037] Furthermore, the target clarity value is calculated as follows:
[0038] Obtain a sample with the same texture as the imaging target, collect a focused image of the obtained sample under a microscope, and then crop the collected focused image to obtain various image blocks;
[0039] Each image block is input into the trained focus measurement network, and then the image of the region of interest is cut out from the image output by the focus measurement network, and then the mean value of each pixel in the cut-out image of the region of interest is calculated, and the calculated mean value is used as the target clarity value.
[0040] Furthermore, the step 4 also includes the following process:
[0041] When the focal plane is at position A, the microscope is used to collect the imaging target image x at position A. A ; Then move the focal plane from position A by a step length of △A. After the movement, the focal plane is located at position B. Use the microscope to collect the imaging target image x at position B. B ;
[0042] For image x A After cropping, each image block is input into the trained focus measurement network to obtain image x A Corresponding semantic segmentation map, extract the region of interest image ROI from the semantic segmentation map A , and then calculate the region of interest image ROI A The mean value of each pixel in A ;
[0043] For image x B After cropping, each image block is input into the trained focus measurement network to obtain image x B Corresponding semantic segmentation map, extract the region of interest image ROI from the semantic segmentation map B , and then calculate the region of interest image ROI B The mean value of each pixel in B ;
[0044] Determine whether l is satisfied A -C _set <γ or l B -C _set <γ;
[0045] If satisfied, focusing is completed;
[0046] If not satisfied, continue to compare lA With l B Size:
[0047] If l A Less than l B , then determine that the moving direction of the focal plane is from position B to position A, and then continue to execute step 4, that is, step 4 is based on position A, and the image is collected when the focal plane moves to a new position along the moving direction;
[0048] If l A Greater than l B , then determine that the moving direction of the focal plane is from position A to position B, and then continue to execute step 4, that is, step 4 is based on position B, and the image is collected when the focal plane moves along the moving direction to a new position.
[0049] The beneficial effects of the present invention are:
[0050] 1. The present invention first constructs and trains a focus measurement network. When a microscopic image of an imaging target is input, the focus measurement network outputs a focus measurement map describing the focus degree of each area of the original image, also known as a semantic segmentation map. After the region of interest is delineated from the focus measurement map, the mean value of pixels in the region of interest is counted as the clarity measurement value of the input image. Finally, a variable step-size search strategy is implemented based on a PID-controlled search strategy.
[0051] 2. The present invention realizes a focusing process without the need for the focal plane to return. Compared with the traditional multi-scale search algorithm, under the premise of the same accuracy, the focal plane movement stroke is reduced by 60%, the focusing time is saved by more than 70%, and the focusing efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 is a schematic diagram of the training data generation process of the focused measurement network;
[0053] Figure 2 It is a schematic diagram of the focal plane moving step length calculation process;
[0054] Figure 3 is a focused flow chart of the present invention;
[0055] Figure 4 It is a schematic diagram of 3D surface texture. DETAILED DESCRIPTION
[0056] Specific implementation method 1: Combination Figure 3 The present embodiment describes a focal plane non-reentry micro-focusing method based on deep learning, and the method specifically comprises the following steps:
[0057] Step 1: Build a focus measurement network including an encoder and a decoder based on the mmsegmentation platform;
[0058] Step 2: Generate a point spread function according to the microscope parameters, and then generate a training data set for the focus measurement network based on the point spread function;
[0059] Step 3: Use the training data set generated in step 2 to train the built focus measurement network to obtain a trained focus measurement network;
[0060] The training process is as follows: each virtual degradation map in the training data set is cropped to obtain image blocks of the same size, and in the same virtual degradation map, there is an overlapping area between two adjacent image blocks;
[0061] Each image block is input into the focus measurement network. In the focus measurement network, each image block first passes through the encoder, and then the outputs of the encoder's N attention mechanism modules are input into the first multi-layer perceptron of the decoder;
[0062] After the first multi-layer perceptron scales the N feature maps to the same dimension, it concatenates the scaled N feature maps into one feature map along the channel dimension, and uses the concatenated feature map as the input of the second multi-layer perceptron;
[0063] The semantic segmentation map corresponding to each virtual degradation map is output through the second multi-layer perceptron;
[0064] The loss is calculated based on the semantic segmentation map and the label image until the loss function converges or the training is stopped when the set maximum number of training times is reached, and a trained focus measurement network is obtained;
[0065] Step 4: Capture an image of the imaging target under a microscope, crop the captured image, and input each image block obtained by cropping into a trained focus measurement network to obtain a semantic segmentation map corresponding to the captured image;
[0066] And extract the region of interest (ROI region) image from the semantic segmentation map;
[0067] Step 5, calculating the average value of each pixel in the image of the region of interest cut out in step 4, and using the calculated average value as the clarity value of the region of interest;
[0068] Step 6: Calculate the difference between the clarity value obtained in step 5 and the target clarity value, and determine whether the difference is less than a set threshold value γ;
[0069] If the difference is less than the set threshold γ, focusing is completed;
[0070] If the difference is greater than or equal to the set threshold γ, execute step seven;
[0071] Step 7: Calculate the moving step length of the focal plane according to the clarity value obtained in step 5, move the focal plane according to the moving direction and the calculated moving step length, and re-capture the image of the imaging target at the new focal plane position;
[0072] Return to step 4 for the re-acquired imaging target image.
[0073] The label file of the present invention is obtained by the absolute distance between the focal plane position and the depth map. In this way, the absolute distance represents the focusing degree of the degradation map, and an absolute distance of 0 represents complete focus, and the larger the absolute distance, the more blurred it is. By learning texture features, the problem of focal plane reentry during focusing is solved, the focusing efficiency is improved, and the focusing time is saved, which shows that the method of the present invention has important application value in the field of multi-target imaging.
[0074] Specific implementation method 2: This implementation method is different from specific implementation method 1 in that the encoder of the focus measurement network includes N attention mechanism modules with the same structure connected in sequence, and the attention mechanism module includes a self-attention mechanism layer, a convolution layer with a convolution kernel size of 3×3 (the convolution layer is used to characterize the position relationship) and an image block overlap area processing unit; the image block overlap area processing unit includes a convolution layer with a convolution kernel size of 7×7 and a convolution layer with a convolution kernel size of 3×3;
[0075] The decoder consists of two multi-layer perceptrons.
[0076] The other steps and parameters are the same as those in the first embodiment.
[0077] It should be noted that the sequential connection in this embodiment means that the output of the first attention mechanism module is used as the input of the second attention mechanism module, the output of the second attention mechanism module is used as the input of the third attention mechanism module, and so on, the output of the N-1th attention mechanism module is used as the input of the Nth attention mechanism module. In an attention mechanism module, the input image passes through the attention mechanism module, the convolution layer and the image block overlap area processing unit in sequence, that is, the output of the image block overlap area processing unit is used as the output of the attention mechanism module.
[0078] Specific implementation method three: This implementation method is different from specific implementation methods one or two in that the number N of the attention mechanism modules is 4.
[0079] The other steps and parameters are the same as those in the first or second embodiment.
[0080] In the present invention, the number of attention mechanism modules is preferably 4, but not limited to 4.
[0081] Specific implementation method four: Combination Figure 1 The present embodiment is different from any one of the specific embodiments 1 to 3 in that in step 2, the method for generating the training data set is:
[0082] For any training data:
[0083] Step 1: Generate the point spread function according to the microscope parameters and the Born&Wolf model in the imageJ software;
[0084] Step 2, obtaining a slice with texture information, and manually photographing an image of the obtained slice in a focused state under a microscope;
[0085] Step 3: Get the depth map corresponding to the slice in step 2, specifically:
[0086] Generate perlin noise to simulate the ups and downs of the object in the slice in step 2 to obtain a depth map;
[0087] Step 4: Combine the image obtained in step 2 and the depth map obtained in step 3 to obtain a 3D surface texture map, such as Figure 4 As shown;
[0088] Step 5. Convolve the 3D surface texture map with the point spread function to generate a virtual degradation map, use the generated virtual degradation map as the input part of the training data, calculate the absolute distance between the value of each pixel in the depth map and the focal plane position, and use the absolute distance corresponding to each pixel as the output part of the training data, that is, use the absolute distance corresponding to each pixel to form a label image (for any training data, after the training data is input into the focus measurement network, the label image is the training target of the focus measurement network).
[0089] The other steps and parameters are the same as those in Specific Embodiments 1 to 3.
[0090] The method of this embodiment can generate a series of training data and finally obtain a training data set. The parameters set in the Born & Wolf model of the imageJ software include the numerical aperture, pixel size, wavelength and sampling z-axis step of the microscope, and the specific parameter values set vary with the change of the microscope. For example, the numerical aperture NA of a microscope is 0.45, the pixel size is 325nm, the wavelength is 610nm, and the sampling z-axis step is 500nm.
[0091] Specific implementation method 5: This implementation method is different from any one of the specific implementation methods 1 to 4 in that the working process of the focus measurement network is as follows:
[0092] Each image block obtained by cropping in step 4 is used as the input of the focus measurement network. In the focus measurement network, each image block first passes through the encoder, and then the outputs of the N attention mechanism modules of the encoder are input to the first multi-layer perceptron of the decoder;
[0093] After the first multi-layer perceptron scales the N feature maps to the same dimension, it concatenates the scaled N feature maps into one feature map along the channel dimension, and uses the concatenated feature map as the input of the second multi-layer perceptron;
[0094] The semantic segmentation map is output through the second multi-layer perceptron.
[0095] The other steps and parameters are the same as those in Specific Embodiments 1 to 4.
[0096] It should be noted that the image cropping methods of various parts of the present invention are the same.
[0097] Specific implementation example 6: This implementation example is different from any one of specific implementation examples 1 to 5 in that each image block needs to be pre-processed by a Sobel operator before being input into the focus measurement network.
[0098] The other steps and parameters are the same as those in Specific Implementation Methods 1 to 5.
[0099] The purpose of pre-processing the input image with the Sobel operator is to make the network focus on the image texture features.
[0100] Specific implementation method seven: This implementation method is different from any one of specific implementation methods one to six in that a PID controller is used to calculate the moving step length of the focal plane according to the clarity value obtained in step five.
[0101] The other steps and parameters are the same as those in Specific Embodiments 1 to 6.
[0102] Specific implementation method eight: Combination Figure 2 This embodiment is different from any one of the specific embodiments 1 to 7 in that the moving step length of the focal plane is calculated according to the clarity value obtained in step 5, specifically:
[0103] Z _step =K p (C _set -C _cur )+K d C _diff +K i C _intgral
[0104] Among them, Z _step is the moving step length of the focal plane, C_cur is the clarity value obtained in step 5, C _set is the target clarity value, C _diff is the differential term of the PID controller, C _intgral is the integral term of the PID controller, K p ,K d and K i These are the control parameters of the PID controller.
[0105] The other steps and parameters are the same as those in Specific Embodiments 1 to 7.
[0106] In the PID controller part, the control parameters can be adjusted according to the actual situation. By adjusting the PID control parameters, it is possible to avoid the output moving step being too large and crossing the extreme point. Under appropriate PID control parameters, the focal plane will continue to approach the best focus position, and the closer to the best focus position, the smaller the corresponding output moving step. The focusing is completed until the clarity measurement value is close enough to the target clarity value. Through such a focusing strategy, the focal plane is realized without reentry during the focusing process.
[0107] Specific implementation method 9: This implementation method is different from any one of specific implementation methods 1 to 8 in that the target clarity value is calculated as follows:
[0108] Obtain a sample with the same texture as the imaging target, collect a focused image of the obtained sample under a microscope, and then crop the collected focused image to obtain various image blocks;
[0109] Each image block is input into the trained focus measurement network, and then the image of the region of interest is cut out from the image output by the focus measurement network, and then the mean value of each pixel in the cut-out image of the region of interest is calculated, and the calculated mean value is used as the target clarity value.
[0110] The other steps and parameters are the same as those in Specific Embodiments 1 to 8.
[0111] Because the focus measurement network mainly learns the richness of image texture, and the texture feature richness of samples with the same texture is basically the same, the clarity value of samples with the same texture is constant. Therefore, it is only necessary to calibrate the sample once to obtain the target clarity value C of all imaging targets with the same texture. _set , move the focal plane to one side from the focus position to obtain the sharpness value C _set +γ corresponds to the focal plane position L1, and then the focal plane is moved to the other side from the focus position to obtain the clarity value C _set +γ corresponds to the focal plane position L2, and then obtains the interval length △L between L1 and L2 to provide prior information for focusing.
[0112] Specific implementation method 10: This implementation method is different from the specific implementation methods 1 to 9 in that the following process is also included before step 4:
[0113] When the focal plane is at position A, the microscope is used to collect the imaging target image x at position A. A ; Then move the focal plane from position A by a step length of △A. After the movement, the focal plane is located at position B. Use the microscope to collect the imaging target image x at position B. B ;
[0114] For image x A After cropping, each image block is input into the trained focus measurement network to obtain image x A Corresponding semantic segmentation map, extract the region of interest image ROI from the semantic segmentation map A , and then calculate the region of interest image ROI A The mean value of each pixel in A ;
[0115] For image x B After cropping, each image block is input into the trained focus measurement network to obtain image x B Corresponding semantic segmentation map, extract the region of interest image ROI from the semantic segmentation map B , and then calculate the region of interest image ROI B The mean value of each pixel in B ;
[0116] Determine whether l is satisfied A -C _set <γ or l B -C _set <γ;
[0117] If satisfied, focusing is completed; at this time, at least one of position B and position A is between position L1 and position L2;
[0118] If not satisfied, continue to compare l A With l B Size:
[0119] If l A Less than l B , then determine that the moving direction of the focal plane is from position B to position A, and then continue to execute step 4, that is, step 4 is based on position A, and the image is collected when the focal plane moves to a new position along the moving direction;
[0120] If l A Greater than l B, then determine that the moving direction of the focal plane is from position A to position B, and then continue to execute step 4, that is, step 4 is based on position B, and the image is collected when the focal plane moves along the moving direction to a new position.
[0121] The other steps and parameters are the same as those in Specific Embodiments 1 to 9.
[0122] In the present invention, the moving step length ΔA is controlled to be smaller than ΔL.
[0123] The above calculation examples of the present invention are only used to explain the calculation model and calculation process of the present invention in detail, and are not intended to limit the implementation methods of the present invention. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is impossible to list all the implementation methods here. All obvious changes or modifications derived from the technical solution of the present invention are still within the scope of protection of the present invention.
Claims
1. A focal plane non-reentry microscopic focusing method based on deep learning, characterized in that: The method specifically comprises the following steps: Step 1: Build a focus measurement network including an encoder and a decoder; Step 2: Generate a point spread function according to the microscope parameters, and then generate a training data set for the focus measurement network based on the point spread function; Step 3: Use the training data set generated in step 2 to train the built focus measurement network to obtain a trained focus measurement network; Step 4: Capture an image of the imaging target under a microscope, crop the captured image, and input each image block obtained by cropping into the trained focus measurement network to obtain a semantic segmentation map corresponding to the captured image; And extract the image of the region of interest from the semantic segmentation map; Step 5, calculating the average value of each pixel in the image of the region of interest cut out in step 4, and using the calculated average value as the clarity value of the region of interest; Step 6: Calculate the difference between the clarity value obtained in step 5 and the target clarity value, and determine whether the difference is less than a set threshold value γ; If the difference is less than the set threshold γ, focusing is completed; If the difference is greater than or equal to the set threshold γ, execute step seven; Step 7: Calculate the moving step length of the focal plane according to the clarity value obtained in step 5, move the focal plane according to the moving direction and the calculated moving step length, and re-capture the image of the imaging target at the new focal plane position; Return to step 4 for the re-acquired imaging target image.
2. The method for focal plane non-reentry microscopy focusing based on deep learning according to claim 1, characterized in that: The encoder of the focus measurement network includes N attention mechanism modules with the same structure connected in sequence, and the attention mechanism module includes a self-attention mechanism layer, a convolution layer with a convolution kernel size of 3 3, and an image block overlap area processing unit; the image block overlap area processing unit includes a convolution layer with a convolution kernel size of 7 7 and a convolution layer with a convolution kernel size of 3 3; The decoder consists of two multi-layer perceptrons.
3. The method for focal plane non-reentry micro-focusing based on deep learning according to claim 2, characterized in that: The number N of the attention mechanism modules is 4.
4. The method for focal plane non-reentry micro-focusing based on deep learning according to claim 1, characterized in that: In step 2, the method for generating the training data set is: For any training data: Step 1: Generate the point spread function according to the microscope parameters and the Born&Wolf model in the imageJ software; Step 2, obtaining a slice with texture information, and manually photographing an image of the obtained slice in a focused state under a microscope; Step 3: Get the depth map corresponding to the slice in step 2, specifically: Generate perlin noise to simulate the ups and downs of the object in the slice in step 2 to obtain a depth map; Step 4: Combine the image obtained in step 2 and the depth map obtained in step 3 to obtain a 3D surface texture map; Step 5: Convolve the 3D surface texture map with the point spread function to generate a virtual degradation map, and use the generated virtual degradation map as the input part of the training data. Calculate the absolute distance between the value of each pixel in the depth map and the focal plane position, and use the absolute distance corresponding to each pixel as the output part of the training data, that is, use the absolute distance corresponding to each pixel to form a label image.
5. The method for focal plane non-reentry microscopy focusing based on deep learning according to claim 1, characterized in that: The working process of the focusing measurement network is as follows: Each image block obtained by cropping in step 4 is used as the input of the focus measurement network. In the focus measurement network, each image block first passes through the encoder, and then the outputs of the N attention mechanism modules of the encoder are input to the first multi-layer perceptron of the decoder; After the first multi-layer perceptron scales the N feature maps to the same dimension, it concatenates the scaled N feature maps into one feature map along the channel dimension, and uses the concatenated feature map as the input of the second multi-layer perceptron; The semantic segmentation map is output through the second multi-layer perceptron.
6. The method for focal plane non-reentry micro-focusing based on deep learning according to claim 1, characterized in that: Before each image block is input into the focus measurement network, it needs to be pre-processed by a Sobel operator.
7. The method for focal plane non-reentry micro-focusing based on deep learning according to claim 1, characterized in that: The moving step length of the focal plane is calculated according to the clarity value obtained in step 5 by using a PID controller.
8. The method for focal plane non-reentry micro-focusing based on deep learning according to claim 7, characterized in that: The moving step length of the focal plane is calculated according to the clarity value obtained in step 5, specifically: Z _ep =K p (C _ -C _ )+K d C _ +K i C _l Among them, Z _ep is the moving step length of the focal plane, C _ is the clarity value obtained in step 5, C _ is the target clarity value, C _ff is the differential term of the PID controller, C _gral is the integral term of the PID controller, K p ,d and K i These are the control parameters of the PID controller.
9. The method for focal plane non-reentry micro-focusing based on deep learning according to claim 8, characterized in that: The target clarity value is calculated as follows: Obtain a sample with the same texture as the imaging target, collect a focused image of the obtained sample under a microscope, and then crop the collected focused image to obtain various image blocks; Each image block is input into the trained focus measurement network, and then the image of the region of interest is cut out from the image output by the focus measurement network, and then the mean value of each pixel in the cut-out image of the region of interest is calculated, and the calculated mean value is used as the target clarity value.
10. The method for focal plane non-reentry micro-focusing based on deep learning according to claim 1, characterized in that: The step 4 also includes the following process: When the focal plane is at position A, the microscope is used to collect the imaging target image x at position A. A ; Then move the focal plane from position A by a step length of △A. After the movement, the focal plane is located at position B. Use the microscope to collect the imaging target image x at position B. B ; For image x A After cropping, each image block is input into the trained focus measurement network to obtain image x A Corresponding semantic segmentation map, extract the region of interest image ROI from the semantic segmentation map A , and then calculate the region of interest image ROI A The mean value of each pixel in A ; For image x B After cropping, each image block is input into the trained focus measurement network to obtain image x B Corresponding semantic segmentation map, extract the region of interest image ROI from the semantic segmentation map B , and then calculate the region of interest image ROI B The mean value of each pixel in B ; Determine whether l is satisfied A -C _ <γ or l B -C _ <γ; If satisfied, focusing is completed; If not satisfied, continue to compare l A With l B Size: If l A Less than l B , then determine that the moving direction of the focal plane is from position B to position A, and then continue to execute step 4, that is, step 4 is based on position A, and the image is collected when the focal plane moves to a new position along the moving direction; If l A Greater than l B , then determine that the moving direction of the focal plane is from position A to position B, and then continue to execute step 4, that is, step 4 is based on position B, and the image is collected when the focal plane moves along the moving direction to a new position.
Citation Information
Patent Citations
Automatic focusing method based on improved hill climbing method
CN109739011A
Automatic blood cell analysis method and system, blood cell analyzer and storage medium
CN110796117A
Method and device for quickly detecting position of optimal focal plane
CN111083365A
Bacterial microscopic image segmentation method based on deep learning network
CN112949378A
High-precision microscopic image automatic focusing method and system, and computer equipment
CN112995517A
Cited By
Pixel reconstruction method and system based on artificial intelligence
CN121073763A
