Automatic focusing method, device and computer equipment for sparse sample microscopic imaging

By dividing and labeling image blocks on microscopic images, training the content sparsity and defocus distance prediction network, and filtering dense image blocks for prediction, the problem of slow focusing speed and low accuracy in microscopic imaging of sparse samples is solved, and a rapid Precise autofocus effect.

CN118366156BActive Publication Date: 2024-09-24NAT UNIV OF DEFENSE TECH
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410797506.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-09-24
Estimated Expiration
2044-06-20

AI Technical Summary

Technical Problem

Existing autofocus methods have the problems of slow focusing speed and low focusing accuracy in sparse sample microscopy imaging. Especially when the training sample content is sparse, the prediction accuracy is poor.

Method used

By evenly dividing the microscopic image into non-overlapping image blocks, labeling the content sparsity and defocus distance, training the content sparsity classification network and the defocus distance prediction network, and screening dense image blocks for defocus distance prediction, achieving Fast and precise autofocus.

Benefits of technology

This method can achieve accurate defocus distance prediction using only a very few areas of a single defocused image, significantly improving the autofocus accuracy and speed of microscopic imaging of sparse samples, and is especially suitable for microscopic image samples with sparse content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118366156B
    Figure CN118366156B
Patent Text Reader

Abstract

The present application relates to an autofocus method, device and computer equipment for sparse sample microscopic imaging, including: evenly dividing the collected microscopic images into non-overlapping image blocks, and labeling the image blocks with content sparsity and defocus distance, for respectively training defocus distance prediction and content sparsity classification networks; and then being able to use the trained content sparsity classification network to screen the target image blocks, obtain a preset number of dense image blocks, and then input them into the trained defocus distance prediction network. The method can achieve accurate defocus distance prediction, especially for microscopic images with sparse content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of microscopic imaging technology, and in particular to an automatic focusing method, device and computer equipment for microscopic imaging of sparse samples. Background Art

[0002] Autofocus technology is one of the key technologies in computer vision, imaging systems, and various confidential instruments. It plays a very important role in microscopic imaging. It not only ensures high-quality, high-definition microscopic images, but also improves work efficiency and simplifies operations. Traditional autofocus technology can be divided into active focus technology and passive focus technology. Active focus technology requires the installation of additional distance sensors in the imaging system to directly measure the defocus distance, while passive focus technology predicts the defocus distance based on the digital image itself.

[0003] At present, passive autofocus methods based on digital image processing are commonly used in microscopic imaging. This type of method includes image clarity evaluation algorithms and iterative search algorithms. Specifically, the image clarity of the microscopic image collected at the current position is evaluated and its degree of defocus is inferred based on the image clarity algorithm. Then, the iterative search algorithm is combined to maximize the image clarity with the least number of moves to obtain the ideal focal plane. This type of method requires the collection of multiple microscopic images to achieve autofocus, and there are problems such as slow focusing speed and low focusing accuracy.

[0004] In recent years, as deep learning has demonstrated powerful reasoning capabilities in computer vision, natural language processing and other fields, many scholars have turned their attention to it and used deep learning to predict the defocus distance of complex images and autofocus of microscopic imaging. Autofocus methods based on deep learning can autonomously learn the characteristics of samples and can also give better defocus distance predictions for microscopic images of complex cells and tissue structures. However, the prediction accuracy of such methods is limited by the type, quantity and content richness of training samples. When the content of training samples is dense, such methods can usually achieve better autofocus effects. When the content of training samples is sparse, the autofocus effect of such methods is poor due to the difficulties of sparse samples in the imaging process, such as small depth of field, multiple focal points, and high background ratio.

[0005] Existing autofocus methods have problems such as dependence on the richness of sample content, slow focusing speed and low focusing accuracy. Therefore, there is an urgent need to develop an autofocus method for microscopic imaging suitable for sparse samples to achieve fast and accurate focusing and microscopic imaging without human intervention. Summary of the invention

[0006] Based on this, it is necessary to provide an automatic focusing method, device and computer equipment for sparse sample microscopic imaging to address the above technical problems.

[0007] An automatic focusing method for sparse sample microscopic imaging, the method comprising:

[0008] The collected microscopic image is evenly divided into non-overlapping image blocks, and the image blocks are labeled with content sparsity and defocus distance; wherein the content sparsity of the image block is determined by the ratio of the size of the foreground target area in the image block to the size of the image block;

[0009] Training a content sparsity classification network based on image blocks labeled with content sparsity to obtain a trained content sparsity classification network, and training a defocus distance prediction network based on image blocks labeled with defocus distance to obtain a trained defocus distance prediction network;

[0010] The trained content sparsity classification network is used to screen the target image blocks, only dense image blocks are retained, and a preset number of dense image blocks are input into the trained defocus distance prediction network for defocus distance prediction.

[0011] An automatic focusing device for sparse sample microscopic imaging, the device comprising:

[0012] An image block labeling module is used to evenly divide the collected microscopic image into non-overlapping image blocks, and label the image blocks with content sparsity and defocus distance; wherein the content sparsity of the image block is determined by the ratio of the size of the foreground target area in the image block to the size of the image block;

[0013] A network training module is used to train a content sparsity classification network according to image blocks labeled with content sparsity to obtain a trained content sparsity classification network, and to train a defocus distance prediction network according to image blocks labeled with defocus distance to obtain a trained defocus distance prediction network;

[0014] The defocus distance prediction module is used to use the trained content sparsity classification network to screen the target image blocks, retain only dense image blocks, and input a preset number of dense image blocks into the trained defocus distance prediction network to predict the defocus distance.

[0015] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0016] The collected microscopic image is evenly divided into non-overlapping image blocks, and the image blocks are labeled with content sparsity and defocus distance; wherein the content sparsity of the image block is determined by the ratio of the size of the foreground target area in the image block to the size of the image block;

[0017] Training a content sparsity classification network based on image blocks labeled with content sparsity to obtain a trained content sparsity classification network, and training a defocus distance prediction network based on image blocks labeled with defocus distance to obtain a trained defocus distance prediction network;

[0018] The trained content sparsity classification network is used to screen the target image blocks, only dense image blocks are retained, and a preset number of dense image blocks are input into the trained defocus distance prediction network for defocus distance prediction.

[0019] The above-mentioned automatic focusing method, device and computer equipment for sparse sample microscopic imaging include: evenly dividing the collected microscopic image into non-overlapping image blocks, and labeling the image blocks with content sparsity and defocus distance, which are used to train the defocus distance prediction network and the content sparsity classification network respectively; using the trained content sparsity classification network to screen the target image blocks to obtain dense image blocks, and then inputting a preset number of dense image blocks into the trained defocus distance prediction network. This method can achieve accurate defocus distance prediction through only a very small number of areas of a single defocused image, and is particularly suitable for microscopic image samples with sparse content. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A schematic diagram of the process of the autofocus method for sparse sample microscopy imaging;

[0021] Figure 2 This is a schematic diagram of the network structure of the content sparsity classification network;

[0022] Figure 3 Schematic diagram of the network structure of the defocus distance prediction network; Figure 3 (a) Schematic diagram of the specific network structure of the defocus distance prediction network; Figure 3 (b) is the structure of the ConvNeXt Block module; Figure 3 (c) is the downsampling structure;

[0023] Figure 4 Schematic diagram of prediction results of different defocused images;

[0024] Figure 5 A block diagram of an autofocus device for microscopic imaging of sparse samples;

[0025] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0027] In one embodiment, Figure 1 As shown, an automatic focusing method for sparse sample microscopic imaging is provided, comprising the following steps:

[0028] Step 102 : evenly divide the collected microscopic image into non-overlapping image blocks, and label the image blocks with content sparsity and defocus distance.

[0029] The content sparsity of the image block is determined by the ratio of the size of the foreground target area in the image block to the size of the image block.

[0030] Specifically, firstly, microscopic images of several samples collected under several fields of view are obtained. Each field of view corresponds to a microscopic image stack, and each microscopic image stack includes several microscopic images with different degrees of defocus. The samples can be human pathological sections from several patients, mainly including human exfoliated cells (such as cervical exfoliated cells) and tissue sections (such as human liver and lung tissue sections). Among them, the cell sections can be stained by the Papanicolaou staining method, and the tissue sections can be stained by the HE staining method.

[0031] Then, the microscopic image stack is divided into several categories according to the sparseness of the image content and the type of the image sample. For example, it can be divided into four categories: dense cell microscopic image stack, sparse cell microscopic image stack, dense tissue microscopic image stack, and sparse tissue microscopic image stack. The type and number of divisions can be designed according to actual needs and are not specifically limited here.

[0032] Next, randomly select several microscopic image stacks from each type of microscopic image stack, and crop all microscopic images in them to a certain pixel size to obtain an unlabeled data set. For example, randomly select several microscopic image stacks from each type in a certain ratio to ensure that the sample type and sparsity are relatively evenly distributed in the training set, that is, to balance the number of samples, thereby ensuring the prediction accuracy of the trained model. All microscopic images in the extracted microscopic image stack are cropped from a pixel size of 2448×2048 to 2016×2016 according to the center position, and the unlabeled data set can be obtained, and the unlabeled data set is divided into a training data set, a validation data set, and a test data set in a ratio of 8:1:1.

[0033] Finally, the microscopic images in the unlabeled dataset are evenly divided into non-overlapping image blocks, and the image blocks are labeled with content sparsity and defocus distance. The deep learning model constructed in this scheme includes a content sparsity classification network and a defocus distance prediction network. In order to train these two networks, this scheme performs two types of data annotation on the training dataset and the validation dataset.

[0034] In order to obtain the labeled data required for training the content sparsity classification network, all microscopic images in the training dataset and the validation dataset can be divided into non-overlapping image blocks with a size of 224×224, so each cropped microscopic image can be divided into 9×9 image blocks.

[0035] In order to obtain the labeled data required for training the defocus distance prediction network, this scheme divides all microscopic images in the training data set and the validation data set into non-overlapping image blocks with a size of 224×224. Therefore, each cropped microscopic image can be divided into 9×9 image blocks. The image blocks corresponding to the block positions are combined to obtain multiple local microscopic image stacks. Each microscopic image stack can be divided into 9×9 local microscopic image stacks. Then, the defocus distance of each image block in the local microscopic image stack is annotated to obtain the true label corresponding to each image block.

[0036] Step 104: training a content sparsity classification network based on image blocks labeled with content sparsity to obtain a trained content sparsity classification network, and training a defocus distance prediction network based on image blocks labeled with defocus distance to obtain a trained defocus distance prediction network.

[0037] Since the content sparsity classification network focuses on extracting the content richness features of the image, and the defocus distance prediction network focuses on extracting the contrast features of the image, during the training phase, this scheme trains the content sparsity prediction network and the defocus distance prediction network separately.

[0038] Step 106 , using the trained content sparsity classification network to screen the target image blocks, retaining only dense image blocks, and inputting a preset number of dense image blocks into the trained defocus distance prediction network to perform defocus distance prediction.

[0039] The target microscopic image is evenly divided into non-overlapping image blocks to obtain the target image blocks.

[0040] The deep learning model constructed in the above-mentioned autofocus method for microscopic imaging includes a content sparsity classification network and a defocus distance prediction network. The content sparsity classification network is used to classify the input defocused (in-focus) image according to the density or sparsity of the content. The input image can be screened through the content sparsity classification network, and only the image blocks with rich content are retained for subsequent defocus distance prediction, which can improve the speed and accuracy of defocus distance prediction. The defocus distance prediction network is used to predict the defocus distance of the input defocused (in-focus) image. The network can achieve accurate defocus distance prediction through only a very small number of areas of a single defocused image, which is particularly suitable for microscopic image samples with sparse content, thereby realizing autofocus and microscopic imaging.

[0041] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0042] In one embodiment, the method for collecting microscopic images with different defocus levels is:

[0043] In each field of view, the microscope objective is moved along the Z-axis direction within a set movement range at a fixed step length to collect several microscope images with different defocus levels.

[0044] The fully automatic microscopic imaging system can be used to collect microscopic images of different defocus degrees in several fields of view in several samples. Specifically: F fields of view are randomly selected in each sample, and for each field of view, the microscope objective is moved in a set range of motion at a fixed step length along the Z axis to collect M microscopic images of different defocus degrees to form a microscopic image stack. F microscopic image stacks can be obtained for each sample. For example, assuming there are 100 samples, 100 fields of view are selected for each sample, so 10,000 microscopic image stacks can be obtained.

[0045] The above-mentioned fully automatic microscopic imaging system adopts a linear motor and a high-precision grating ruler as a servo motion mechanism of the Z axis, and the objective lens of the fully automatic microscopic imaging system can adopt an APO objective lens with 20X and NA of 0.75.

[0046] The image resolution of each field of view is 2448×2048, the movement range of the microscope objective in each field of view is [-25μm, 25μm], and the step size of each movement is 0.5μm. In this way, 101 microscopic images with different defocus levels can be collected in each field of view.

[0047] In one embodiment, before classifying the microscopic image stack into several categories according to the sparseness of the image content and the type of the image sample, the method further includes:

[0048] All collected microscopic image stacks are automatically screened using digital image processing algorithms to remove blank and blurred microscopic image stacks.

[0049] Next, all the microscopic image stacks that have not been eliminated can be divided.

[0050] In one embodiment, labeling the image block with a content sparsity label includes:

[0051] An image processing algorithm is used to perform foreground and background segmentation processing on the image block, and the size of the foreground target area in the image block is calculated; the image processing algorithm adopts a binarization method or an image segmentation method based on deep learning, etc.

[0052] If the ratio of the size of the foreground target area in the image block to the size of the image block is greater than the set threshold, the image block is a dense content image block and is marked as 1; otherwise, the image block is a sparse content image block and is marked as 0.

[0053] In one embodiment, labeling the defocus distance of the image block includes:

[0054] The image blocks corresponding to the block positions are combined to obtain a plurality of local microscopic image stacks; wherein the number of local microscopic image stacks corresponding to one microscopic image stack is equal to the number of one microscopic image block;

[0055] For a local microscopic image stack, the image clarity evaluation function is used to calculate the clarity value of each image block in it, and the maximum clarity value is obtained. The defocus distance label of the image block corresponding to the maximum clarity value is marked as zero; for the defocus distance of other image blocks in it, labels are marked according to their physical distance to the image block with a label of zero.

[0056] Specifically, the image block corresponding to the maximum clarity value is labeled as 0 μm, and other image blocks in the local microscopic image stack are labeled according to their physical distance to the image block labeled as 0 μm.

[0057] Considering that image blocks with sparse content have a greater impact on the autofocus algorithm, when annotating image blocks in the local microscopic image stack, the local microscopic image stack with a maximum clarity value less than a set threshold is eliminated.

[0058] The above-mentioned image clarity evaluation function includes but is not limited to Tenengrad evaluation function, Laplacian gradient function, Brenner function, etc.

[0059] In one embodiment, the content sparsity classification network is constructed using an improved MobileNetV3-small network, and its network structure is as follows: Figure 2 As shown in the figure. The input size of the network is 224×224×3. The input image first undergoes a 2D convolution operation with a convolution kernel size of 3×3, then passes through 3 bneck modules with a convolution kernel size of 3×3, 8 bneck modules with a convolution kernel size of 5×5, then passes through a 2D convolution operation with a convolution kernel size of 1×1 and a pooling operation with a convolution kernel size of 7×7, and finally passes through a 2D convolution operation with a convolution kernel size of 2×2 without a batch normalization layer and a 2D convolution operation with a convolution kernel size of 1×1 without a batch normalization layer. The output of the network is the probability value of the predicted category.

[0060] In one embodiment, a trained content sparsity classification network is used to screen the target image blocks, and only dense image blocks are retained. A preset number of dense image blocks are input into a trained defocus distance prediction network to predict the defocus distance, including:

[0061] The target microscopic image is divided into blocks to obtain target image blocks; the target image blocks are input into the trained content sparsity classification network, and the probability value of the content sparsity category of the image blocks is output; the target image blocks whose content sparsity category is dense and whose probability value is greater than a preset value are taken as candidate dense image blocks; the candidate dense image blocks are arranged in descending order according to the probability value, and the first k candidate dense image blocks are selected and input into the trained defocus distance prediction network for defocus distance prediction.

[0062] That is to say, this scheme inputs the target image blocks into the trained content sparsity classification network, outputs the predicted category probability values ​​of these target image blocks, and then sorts the predicted category probability values ​​of these target image blocks in descending order, and selects the first K image blocks with higher probability values ​​for subsequent defocus distance prediction. The selected K image blocks are input into the defocus distance prediction network, and the predicted defocus distances of the K image blocks are output. Then, the predicted defocus distances of the K image blocks are median filtered to obtain the final defocus distance value of the test image.

[0063] The value range of K is 5 to 20, and the specific value needs to take into account the accuracy and speed of prediction.

[0064] In one embodiment, the defocus distance prediction network is constructed using an improved ConvNeXt-T network, and its network structure is as follows: Figure 3 As shown in (a). The input of the network is a 224×224 three-channel image. First, the input image undergoes a two-dimensional convolution operation with a convolution kernel size of 4×4 and a stride of 4, and then undergoes a batch normalization operation; then, it passes through three ConvNeXt Block modules with an input channel number of 96 in sequence, and after downsampling, it passes through three ConvNeXtBlock modules with an input channel number of 192 in sequence, and after downsampling, it passes through nine ConvNeXt Block modules with an input channel number of 384 in sequence, and after downsampling, it passes through three ConvNeXt Block modules with an input channel number of 768 in sequence; finally, after a global average pooling layer operation, two two-dimensional convolution operations with a convolution kernel size of 1×1 without a batch normalization layer, and a fully connected layer operation, the output of the network is the predicted defocus distance value. The structure of the ConvNeXt Block module is shown as follows: Figure 3 (b) is shown. The downsampling structure is as follows Figure 3 (c) shown.

[0065] In one embodiment, when training the content sparsity classification network, a binary cross entropy loss is used. To update the parameters of the model, for Batch data of samples, The calculation formula is as follows:

[0066] ;

[0067] in, is a hyperparameter, Indicates The true content sparsity label of samples, Represents the content sparsity classification network for the The content sparsity category probability value predicted by each sample.

[0068] In one embodiment, when training the defocus distance prediction network, an L1 loss is used To update the parameters of the model, for Batch data of samples, The calculation formula is as follows:

[0069] ;

[0070] in, Indicates The true defocus distance label of samples, Represents the predicted defocus distance value of the nth sample by the defocus distance prediction network.

[0071] When training the content sparsity classification network and the defocus distance prediction network, the programming environment used was the Ubantu18.04 operating system, python3.7 was used as the programming language, the deep learning framework used was pytorch1.13.1+cuda11.7, and the selected server was Dell POWEREDGE T640, which contains 4 NVIDIA RTX3090 graphics cards and two 2nd generation Intel® Xeon® scalable processors, each with up to 2 cores.

[0072] When training the content sparsity classification network, the batch size is set to 8, the epoch is 400, Adam is used as the optimizer, and the learning rate is set to 0.00005. When training the defocus distance prediction network, the batch size is set to 64, the epoch is 400, Adam is used as the optimizer, and the learning rate is set to 0.00001.

[0073] In order to verify the autofocus performance of the present invention, the method proposed in the present invention is compared with the three current mainstream methods: ResNet18, MobileNetV2 and MobileNetV3-Small. According to the type of samples in the test data set and the sparsity of the graphic content, the test results are statistically analyzed, and the comparison results are shown in Table 1. As can be seen from Table 1, the autofocus method of the present invention has greatly improved the focusing accuracy compared with the other three mainstream methods, especially in the case of sparse samples, the autofocus effect has been rapidly improved. The mean absolute error (MAE) of the autofocus method of the present invention is 0.372μm and 0.345μm, respectively, under sparse samples, which is an increase of 96% compared to the highest accuracy methods of 10.932μm and 9.989μm. Therefore, the autofocus method for microscopic imaging of sparse samples of the present invention has higher accuracy and robustness. Figure 4 The prediction results of some different defocused images are listed. The model of the present invention is deployed to a local server and accelerated inference is performed using a GPU, which can achieve a prediction speed of 30 μs per image.

[0074] Table 1 Comparison results of the present invention and three mainstream methods

[0075]

[0076] In summary, the present invention constructs a new microscopic image autofocus method based on a deep learning model, which adopts a dual network structure of a content sparsity classification network and a defocus distance prediction network, and can predict the defocus distance from a single microscopic image, getting rid of the drawback of the traditional need to collect multiple images and resulting in slow focusing speed. The input microscopic image blocks are screened using a content sparsity classification network, and after removing the areas with extremely sparse content, the defocus distance prediction network is used to predict the areas with dense content, which can improve the accuracy of defocus distance prediction, and is particularly suitable for sparse samples. The reason why the current autofocus algorithm fails under sparse samples is that the accuracy error of the prediction of areas with sparse content is large, which affects the overall prediction.

[0077] In one embodiment, Figure 5 As shown, an automatic focusing device for sparse sample microscopic imaging is provided, comprising: an image block annotation module, a network training module and a defocus distance prediction module, wherein:

[0078] An image block labeling module is used to evenly divide the collected microscopic image into non-overlapping image blocks, and label the image blocks with content sparsity and defocus distance; wherein the content sparsity of the image block is determined by the ratio of the size of the foreground target area in the image block to the size of the image block;

[0079] A network training module is used to train a content sparsity classification network according to image blocks labeled with content sparsity to obtain a trained content sparsity classification network, and to train a defocus distance prediction network according to image blocks labeled with defocus distance to obtain a trained defocus distance prediction network;

[0080] The defocus distance prediction module is used to use the trained content sparsity classification network to screen the target image blocks, retain only dense image blocks, and input a preset number of dense image blocks into the trained defocus distance prediction network to predict the defocus distance.

[0081] For the specific definition of the autofocus device for sparse sample microscopic imaging, please refer to the definition of the autofocus method for sparse sample microscopic imaging above, which will not be repeated here. Each module in the above-mentioned autofocus device for sparse sample microscopic imaging can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0082] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as microscopic images. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an automatic focusing method for sparse sample microscopic imaging is implemented.

[0083] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0084] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in the above embodiment when executing the computer program.

[0085] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the above embodiment are implemented.

[0086] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0087] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0088] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. An automatic focusing method for sparse sample microscopic imaging, characterized in that: The method comprises: The collected microscopic image is evenly divided into non-overlapping image blocks, and the image blocks are labeled with content sparsity and defocus distance; wherein the content sparsity of the image block is determined by the ratio of the size of the foreground target area in the image block to the size of the image block; specifically, the method includes: performing foreground and background segmentation processing on the image block, and calculating the size of the foreground target area in the image block; if the ratio of the size of the foreground target area in the image block to the size of the image block is greater than a set threshold, the image block is labeled as a content-dense image block, otherwise it is labeled as a content-sparse image block; Training a content sparsity classification network based on image blocks labeled with content sparsity to obtain a trained content sparsity classification network, and training a defocus distance prediction network based on image blocks labeled with defocus distance to obtain a trained defocus distance prediction network; The content sparsity classification network is constructed using an improved MobileNetV3-small network; the input image block first undergoes a two-dimensional convolution operation with a convolution kernel size of 3×3, then sequentially passes through three bneck modules with a convolution kernel size of 3×3, eight bneck modules with a convolution kernel size of 5×5, then passes through a two-dimensional convolution operation with a convolution kernel size of 1×1 and a pooling operation with a convolution kernel size of 7×7, and finally passes through a two-dimensional convolution operation with a convolution kernel size of 2×2 without a batch normalization layer and a two-dimensional convolution operation with a convolution kernel size of 1×1 without a batch normalization layer; The defocus distance prediction network is constructed using an improved ConvNeXt-T network; first, the input image is subjected to a two-dimensional convolution operation with a convolution kernel size of 4×4 and a step size of 4 and a batch normalization operation; then, it is sequentially passed through three ConvNeXt Block modules with an input channel number of 96, and after downsampling, it is sequentially passed through three ConvNeXtBlock modules with an input channel number of 192, and after downsampling, it is sequentially passed through nine ConvNeXt Block modules with an input channel number of 384, and after downsampling, it is sequentially passed through three ConvNeXt Block modules with an input channel number of 768; finally, after a global average pooling layer operation, two two-dimensional convolution operations with a convolution kernel size of 1×1 and no batch normalization layer, and a fully connected layer operation, the output of the network is the predicted defocus distance value; A trained content sparsity classification network is used to screen the target image blocks, retaining only dense image blocks, and a preset number of dense image blocks are input into a trained defocus distance prediction network for defocus distance prediction; wherein the output of the content sparsity classification network is the probability value of the predicted category.

2. The method according to claim 1, characterized in that Label the image blocks with the defocus distance, including: The image blocks corresponding to the block positions are combined to obtain a plurality of local microscopic image stacks; wherein the number of local microscopic image stacks corresponding to one microscopic image stack is equal to the number of one microscopic image block; For a local microscopic image stack, the image clarity evaluation function is used to calculate the clarity value of each image block in it, and the maximum clarity value is obtained. The defocus distance label of the image block corresponding to the maximum clarity value is marked as zero; for the defocus distance of other image blocks in it, labels are marked according to their physical distance to the image block with a label of zero.

3. The method according to claim 1, characterized in that: When training the content sparsity classification network, the binary cross entropy loss is used To update the parameters of the model, for Batch data containing N samples, The calculation formula is as follows: ; in, is a hyperparameter, represents the true content sparsity label of the i-th sample, Represents the content sparsity category probability value predicted by the content sparsity classification network for the i-th sample.

4. The method according to claim 1, characterized in that: The trained content sparsity classification network is used to screen the target image blocks, and only dense image blocks are retained. A preset number of dense image blocks are input into the trained defocus distance prediction network for defocus distance prediction, including: Divide the target microscopic image into blocks to obtain target image blocks; Input the target image block into the trained content sparsity classification network, and output the probability value of the content sparsity category of the image block; The target image block whose content sparsity category is dense and whose probability value is greater than a preset value is taken as a candidate dense image block; The candidate dense image blocks are arranged in descending order according to the probability values, and the first k candidate dense image blocks are selected to input into the trained defocus distance prediction network for defocus distance prediction.

5. The method according to claim 1, characterized in that When training the defocus distance prediction network, use L1 loss To update the parameters of the model, for Batch data containing N samples, The calculation formula is as follows: ; in, represents the true defocus distance label of the nth sample, Represents the predicted defocus distance value of the nth sample by the defocus distance prediction network.

6. An automatic focusing device for sparse sample microscopic imaging, characterized in that: The device comprises: The image block labeling module is used to evenly divide the collected microscopic image into non-overlapping image blocks, and label the image blocks with content sparsity and defocus distance; wherein the content sparsity of the image block is determined by the ratio of the size of the foreground target area in the image block to the size of the image block; specifically, the module includes: performing foreground and background segmentation processing on the image block, and calculating the size of the foreground target area in the image block; if the ratio of the size of the foreground target area in the image block to the size of the image block is greater than a set threshold, the image block is labeled as a dense content image block, otherwise it is labeled as a sparse content image block; The network training module is used to train a content sparsity classification network according to image blocks labeled with content sparsity to obtain a trained content sparsity classification network, and to train a defocus distance prediction network according to image blocks labeled with defocus distance to obtain a trained defocus distance prediction network; the content sparsity classification network is constructed using an improved MobileNetV3-small network; the input image block first undergoes a two-dimensional convolution operation with a convolution kernel size of 3×3, and then successively passes through three bneck modules with a convolution kernel size of 3×3, and eight convolution kernels with a convolution kernel size of 5×5. bneck module, then a two-dimensional convolution operation with a convolution kernel size of 1×1 and a pooling operation with a convolution kernel size of 7×7, and finally a two-dimensional convolution operation with a convolution kernel size of 2×2 without a batch normalization layer and a two-dimensional convolution operation with a convolution kernel size of 1×1 without a batch normalization layer; the defocus distance prediction network is constructed using an improved ConvNeXt-T network; first, the input image undergoes a two-dimensional convolution operation with a convolution kernel size of 4×4 and a step size of 4 and a batch normalization operation; then, it passes through three ConvNeXt-T networks with 96 input channels in sequence. After downsampling, it passes through three ConvNeXt Block modules with 192 input channels, nine ConvNeXt Block modules with 384 input channels, and three ConvNeXtBlock modules with 768 input channels. Finally, after a global average pooling layer operation, two 2D convolution operations with a kernel size of 1×1 and no batch normalization layer, and a fully connected layer operation, the output of the network is the predicted defocus distance value. The defocus distance prediction module is used to use the trained content sparsity classification network to screen the target image blocks, retain only dense image blocks, and input a preset number of dense image blocks into the trained defocus distance prediction network for defocus distance prediction; wherein the output of the content sparsity classification network is the probability value of the predicted category.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • SAR image salient region detection method based on noisy spectrum stability

    CN112561901A

  • Method for detecting weak and small target in foresight active sonar image

    CN113780080A

  • Road scene semantic segmentation method based on multi-model fusion

    CN114693924A

  • Brain stroke behavior detection method based on BEFAST judgment principle

    CN116433642A

  • Automatic focusing method, device and equipment for microscopic imaging and storage medium

    CN117369108A