Scanning image refocusing method, device, electronic device and storage medium
Through the fusion and deep learning model processing of multiple scan images collected by the microscope, the problems of local blur and uneven contrast in traditional scan image synthesis are solved, and refocused images with high definition and uniform contrast can be generated on a small number of images. , improving the efficiency and effect of cell analysis.
Patent Information
- Application Number
- CN202311438903.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2043-10-31
AI Technical Summary
In the existing technology, scanned images based on 15-layer image synthesis have problems such as local blur and uneven contrast, resulting in poor cell analysis and processing results.
By acquiring multiple scanned images at different Z-axis positions in the same field of view collected by the microscope, they are fused and refocused based on the deep learning model to generate a refocused image with better clarity and contrast. The specific method includes using the first refocusing model to refocus the scan fusion image, or performing feature extraction and fusion on multiple scanned images based on the second refocusing model to generate a refocused image.
Realize image refocusing based on a small number of scanned images, reduce scanning gaps, reduce scanning costs, and improve the performance and efficiency of image refocusing.
Smart Images

Figure CN117372274B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image analysis technology, and in particular to a scanning image refocusing method, device, electronic equipment and storage medium. Background Art
[0002] Circulating tumor cells (CTCs) detection is based on Fluorescence In Situ Hybridization (FISH) technology, which is used for early screening of lung cancer. FISH technology achieves rapid detection of cell components by marking specific DNA sequences and is an important tool for cytogenetic analysis. However, FISH technology requires precise positioning of the position and outline of each cell, and the operation process is complicated and prone to positioning errors. Among them, when using a microscope to collect cell images, 15 layers of images are usually taken continuously after pre-positioning, of which 3-4 layers are focused and the others are out of focus. Because it is impossible to determine which layers are focused during the process, the traditional algorithm synthesizes a new image based on 15 layers of images for subsequent image analysis. However, the synthetic images generated by this method have problems such as local blurring and uneven contrast, and the effect is poor, which is not conducive to subsequent cell analysis and processing. Therefore, there is a need for a method that can generate refocused images on a small number or even a single image to obtain cell images with better clarity, contrast and other effects. Summary of the invention
[0003] The present invention provides a scanning image refocusing method, device, electronic device and storage medium, which are used to solve the defects of local blur and uneven contrast of synthetic images in the prior art.
[0004] The present invention provides a scanning image refocusing method, comprising:
[0005] Acquire multiple scanned images at different Z-axis positions in the same field of view collected by a microscope;
[0006] fusing the multiple scanned images to obtain a scanned fused image, and refocusing the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanned images;
[0007] Alternatively, after extracting features from the multiple scanned images based on the second refocusing model to obtain feature matrices corresponding to the multiple scanned images, the feature matrices corresponding to the multiple scanned images are fused to obtain a fused feature matrix, and refocused images corresponding to the multiple scanned images are obtained based on the fused feature matrix;
[0008] Among them, the first refocusing model is obtained by training based on a sample scanning fusion image of multiple sample scanning images and their corresponding sample refocusing images, and the second refocusing model is obtained by training based on multiple sample scanning images and their corresponding sample refocusing images.
[0009] According to a scanning image refocusing method provided by the present invention, the first refocusing model or the second refocusing model is obtained by training based on the following steps:
[0010] Inputting the model input image corresponding to the current round of iteration into the first refocusing model or the second refocusing model to obtain a test refocusing image output by the first refocusing model or the second refocusing model, and calculating the model loss based on the test refocusing image and the corresponding sample refocusing image, and adjusting the model parameters of the first refocusing model or the second refocusing model based on the model loss;
[0011] Among them, the model input image corresponding to the first refocusing model is a sample scan fusion image of multiple sample scan images, and the model input image corresponding to the second refocusing model is multiple sample scan images; before the preset training node, the model loss is calculated based on the first loss function, and after the preset training node, the model loss is calculated based on the first loss function and the second loss function, the first loss function is used to determine the difference between the test refocusing image and the corresponding sample refocusing image, and the second loss function is used to calculate the difference between the feature map of the test refocusing image output by the pre-trained feature extraction network and the feature map of the sample refocusing image.
[0012] According to a scanning image refocusing method provided by the present invention, the first refocusing model includes a downsampling network and an upsampling network; the second refocusing model includes a plurality of downsampling networks and upsampling networks corresponding to the number of the scanned images; wherein the downsampling network is constructed based on a pre-trained image feature extraction model.
[0013] According to a scanning image refocusing method provided by the present invention, any downsampling layer in each downsampling network of the second refocusing model is connected to an upsampling layer in the upsampling network whose output feature map size is the same as the feature map size output by any downsampling layer.
[0014] According to a scanning image refocusing method provided by the present invention, fusing the multiple scanning images to obtain a scanning fused image specifically includes:
[0015] Converting the plurality of scanned images into grayscale images to obtain a plurality of scanned grayscale images;
[0016] Calculating an average pixel value of each pixel based on the pixel values of the same pixel in the plurality of scanned grayscale images, and generating a fused grayscale image based on the average pixel value of each pixel;
[0017] The fused grayscale image is converted into a color image to obtain the scanned fused image.
[0018] According to a scanning image refocusing method provided by the present invention, the method further includes:
[0019] Based on the target segmentation model, target segmentation is performed on the multiple scanned images and the refocused images corresponding to the multiple scanned images respectively, to obtain target segmentation results of each of the multiple scanned images and target segmentation results of the refocused images corresponding to the multiple scanned images;
[0020] Determine segmentation effect evaluation values of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images, respectively, based on the target segmentation results of the plurality of scanned images and the target segmentation results of the refocused images corresponding to the plurality of scanned images;
[0021] respectively determining the sharpness of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images;
[0022] Based on the plurality of scanned images and the segmentation effect evaluation values and the sharpness of the refocused images corresponding to the plurality of scanned images, the focusing effect evaluation values of the refocused images corresponding to the plurality of scanned images are determined.
[0023] According to a scanning image refocusing method provided by the present invention, determining the focusing effect evaluation value of the refocusing image corresponding to the multiple scanning images based on the segmentation effect evaluation value and clarity of the multiple scanning images and the refocusing images corresponding to the multiple scanning images specifically includes:
[0024] Calculating image effect evaluation values of the plurality of scanned images respectively based on the segmentation effect evaluation values and sharpness of each of the plurality of scanned images;
[0025] Calculating image effect evaluation values of the refocused images corresponding to the multiple scanned images based on the segmentation effect evaluation values and the clarity of the refocused images corresponding to the multiple scanned images;
[0026] Based on the difference between the image effect evaluation values of the refocusing images corresponding to the plurality of scanning images and the image effect evaluation values of the plurality of scanning images, the focusing effect evaluation values of the refocusing images corresponding to the plurality of scanning images are determined.
[0027] The present invention also provides a scanning image refocusing device, comprising:
[0028] A scanning image acquisition unit, used to acquire multiple scanning images at different Z-axis positions in the same field of view collected by the microscope;
[0029] a first refocusing unit, configured to fuse the plurality of scanned images to obtain a scanned fused image, and refocus the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the plurality of scanned images;
[0030] Alternatively, a second refocusing unit is used to perform feature extraction on the multiple scanned images based on a second refocusing model, obtain feature matrices corresponding to the multiple scanned images, fuse the feature matrices corresponding to the multiple scanned images to obtain a fused feature matrix, and obtain refocused images corresponding to the multiple scanned images based on the fused feature matrix;
[0031] Among them, the first refocusing model is obtained by training based on a sample scanning fusion image of multiple sample scanning images and their corresponding sample refocusing images, and the second refocusing model is obtained by training based on multiple sample scanning images and their corresponding sample refocusing images.
[0032] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the scanning image refocusing method as described above is implemented.
[0033] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the scanning image refocusing method as described in any one of the above is implemented.
[0034] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the scanning image refocusing method as described above is implemented.
[0035] The scanning image refocusing method, device, electronic device and storage medium provided by the present invention obtain a scanning fusion image by fusing multiple scanning images, and refocus the scanning fusion image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanning images; or, extract features from multiple scanning images respectively based on a second refocusing model to obtain feature matrices corresponding to each of the multiple scanning images, fuse the feature matrices corresponding to each of the multiple scanning images to obtain a fused feature matrix, and obtain the refocused image corresponding to the multiple scanning images based on the fused feature matrix. Image refocusing can be performed on a small number of scanning images, so that the scanning interval can be reduced within the same scanning interval, reducing the scanning cost. Then, a small number of scanning images are fused and then refocused using a deep learning network, or a small number of scanning images are feature extracted and fused using a deep learning network and then refocused, thereby improving the performance and efficiency of image refocusing. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 It is a schematic flow chart of the scanning image refocusing method provided by the present invention;
[0038] Figure 2 It is a flow chart of the image focusing effect evaluation method provided by the present invention;
[0039] Figure 3 It is a structural schematic diagram of the scanning image refocusing device provided by the present invention;
[0040] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] Figure 1 is a flow chart of the scanning image refocusing method provided by the present invention, such as Figure 1As shown, the method includes:
[0043] Step 110, acquiring a plurality of scanned images at different Z-axis positions in the same field of view collected by a microscope;
[0044] Step 120, fusing the multiple scanned images to obtain a scanned fused image, and refocusing the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanned images;
[0045] Alternatively, in step 130, after extracting features from the plurality of scanned images based on the second refocusing model to obtain feature matrices corresponding to the plurality of scanned images, the feature matrices corresponding to the plurality of scanned images are fused to obtain a fused feature matrix, and refocused images corresponding to the plurality of scanned images are obtained based on the fused feature matrix;
[0046] Among them, the first refocusing model is obtained by training based on a sample scanning fusion image of multiple sample scanning images and their corresponding sample refocusing images, and the second refocusing model is obtained by training based on multiple sample scanning images and their corresponding sample refocusing images.
[0047] Specifically, multiple layers of scanned images at different Z-axis positions in the same field of view taken continuously by a microscope can be obtained. In some embodiments, the scanned image can be a DAPI image, and the number of scanned images can be set according to the actual application scenario, for example, it can be 3 layers, which is not specifically limited in the embodiment of the present invention.
[0048] In one embodiment, a plurality of scanned images may be fused to obtain a scanned fused image corresponding to the plurality of scanned images, and then the scanned fused image may be input into a first refocusing model to refocus the scanned fused image, thereby obtaining a refocused image corresponding to the plurality of scanned images output by the first refocusing model. In some embodiments, in order to fuse the plurality of scanned images, the plurality of scanned images may be converted into grayscale images to obtain a plurality of scanned grayscale images. Subsequently, based on the pixel values of the same pixel points (i.e., the pixel points at the same position in the image) in the plurality of scanned grayscale images, the average pixel value of each pixel point is calculated, and a fused grayscale image is generated based on the average pixel value of each pixel point. Then, the fused grayscale image is converted into a color image using an image processing library (e.g., opencv) to obtain a scanned fused image corresponding to the plurality of scanned images. In addition, the scanned fused image may be normalized and input into the first refocusing model, and then the refocused image output by the first refocusing model may be denormalized.
[0049] The above-mentioned first refocusing model can be constructed based on a downsampling network and an upsampling network, and its model parameters are adjusted inversely by the model loss calculated based on a sample scanned fusion image of multiple sample scanned images and their corresponding sample refocused images, so that it has the ability to extract and restore the details of the scanned fusion image, and realize the refocusing of the scanned fusion image. In some embodiments, the first refocusing model can be constructed based on the unet model. On this basis, in order to further improve the efficiency and effect of model training, the downsampling network in the unet model can be replaced with a pre-trained image feature extraction model, such as Resnet and Densenet, etc., so as to utilize the image feature extraction capability currently possessed by the pre-trained image feature extraction model to improve the convergence speed of the first refocusing model.
[0050] In another way, the above-mentioned multiple scanned images can be input into the second refocusing model, and the second refocusing model is used to extract features from the above-mentioned multiple scanned images respectively, and after obtaining the feature matrices corresponding to each scanned image, the feature matrices corresponding to each scanned image are fused into a fused feature matrix, and then the refocused images corresponding to the above-mentioned multiple scanned images are obtained based on the fused feature matrix. Among them, the above-mentioned second refocusing model can be constructed based on multiple downsampling networks and upsampling networks, wherein the multiple downsampling networks correspond to the multiple scanned images one by one, respectively, and are used to extract the feature matrices of the corresponding scanned images, and then the feature matrices of the various scanned images are fused (for example, spliced by channel) to obtain a fused feature matrix, and then the fused feature matrix is processed by the upsampling network to obtain the refocused images corresponding to the above-mentioned multiple scanned images. Compared with the first way, this way can fully extract and fuse the original multiple scanned images, and can retain more image information, so as to achieve a better image refocusing effect. In addition, each scanned image can be normalized and input into the second refocusing model, and then the refocused image output by the second refocusing model is denormalized.
[0051] Here, similar to the first refocusing model, the model parameters can be reversely adjusted by the model loss calculated based on multiple sample scanned images and their corresponding sample refocused images, so that the second refocusing model has the ability to extract and restore the details of the scanned fusion image, and realize the refocusing of the scanned fusion image. In some embodiments, the second refocusing model can also be constructed based on the unet model, on which basis, multiple downsampling networks with the same structure can be set for feature extraction processing of the corresponding scanned images. In addition, the downsampling network in the unet model can be replaced with a pre-trained image feature extraction model, and the image feature extraction capability currently possessed by the pre-trained image feature extraction model is used to improve the convergence speed and training effect of the second refocusing model. In other embodiments, a jump connection method is used between any downsampling layer in each downsampling network of the second refocusing model and the upsampling layer whose feature map size output in the upsampling network is the same as the feature map size output by the downsampling layer, that is, the downsampling network and the network layer with the same resolution in the upsampling network are connected, so that the second refocusing model can fuse the feature information extracted in the downsampling process during the upsampling process, and optimize the image refocusing effect.
[0052] In some embodiments, in order to improve the refocusing performance of the first refocusing model and the second refocusing model for a small number of scanned images, the first refocusing model and the second refocusing model may be trained in the following manner:
[0053] The model input image corresponding to the current round of iteration is input to the first refocusing model or the second refocusing model to obtain a test refocusing image output by the first refocusing model or the second refocusing model, and the model loss is calculated based on the test refocusing image and the corresponding sample refocusing image, and the model parameters of the first refocusing model or the second refocusing model are adjusted based on the model loss. Wherein, the model input image corresponding to the first refocusing model is a sample scan fusion image of multiple sample scan images, and the model input image corresponding to the second refocusing model is a multiple sample scan images; before the preset training node, the model loss is calculated based on the first loss function, and after the preset training node, the model loss is calculated based on the first loss function and the second loss function, the first loss function is used to determine the difference between the test refocusing image and the corresponding sample refocusing image, and the second loss function is used to calculate the difference between the feature map of the test refocusing image output by the pre-trained feature extraction network and the feature map of the sample refocusing image.
[0054] Specifically, for the first refocusing model and the second refocusing model, a two-stage training method can be adopted. Taking the first refocusing model as an example, in the early stage of training, the model input image corresponding to the current round of iteration (that is, a sample scan fusion image corresponding to a group of sample scan images, the fusion method is the same as the fusion method given in the above embodiment, and will not be repeated here) can be input into the first refocusing model to obtain a test refocusing image output by the first refocusing model. Then, the first loss function is used to calculate the model loss based on the test refocusing image and the corresponding sample refocusing image, and the model parameters of the first refocusing model are adjusted based on the model loss. Among them, the first loss function is used to determine the difference between the test refocusing image and the corresponding sample refocusing image. For example, L1 loss can be used to calculate the absolute difference between the test refocusing image and the corresponding sample refocusing image.
[0055] In the later stage of training, after the model input image corresponding to the current round iteration is input into the first refocusing model and the test refocusing image output by the first refocusing model is obtained, the first model loss and the second model loss can be calculated based on the test refocusing image and the corresponding sample refocusing image using the first loss function and the second loss function respectively, and the fusion result of the first model loss and the second model loss is used as the model loss, and the model parameters of the first refocusing model are adjusted based on the model loss. Among them, the second loss function is used to calculate the difference between the feature map of the test refocusing image output by the pre-trained feature extraction network (such as the VGG network) and the feature map of the sample refocusing image. In some embodiments, the test refocusing image and the sample refocusing image can be respectively input into the pre-trained feature extraction network, and then the feature maps output by the first several layers (such as the first 3 layers) of the network layer in the feature extraction network are obtained. Subsequently, the difference between the feature map of the test refocusing image output by the same network layer and the feature map of the sample refocusing image is calculated. For example, the absolute difference between the two can be calculated based on L1loss as the single-layer loss corresponding to the network layer, and the single-layer losses corresponding to the above-mentioned several layers of network layers are accumulated as the second model loss. In addition, when the first model loss and the second model loss are fused to obtain the model loss, a weighted sum can be performed on them, where the weight of the first model loss is less than the weight of the second model loss. For example, the weight of the first model loss can be set to 0.1, and the weight of the second model loss can be set to 1.
[0056] It should be noted that the preset training nodes for dividing the early and late training stages can be determined based on the model loss calculated based on the first loss function. If the difference between the above model loss corresponding to multiple consecutive iterations and the preset threshold is within a preset range, indicating that the model learning is achieved through the model loss calculated based on the first loss function so that the model reaches a stable state, it can be determined that the preset training node has been reached. In the next round of iterations, the first loss function and the second loss function can be used to calculate the model loss for adjusting the model parameters, so that the model can learn further, thereby improving its image refocusing ability. The training process of the second refocusing model is similar to that of the first refocusing model. The difference is that the model input image of the second refocusing model is a set of sample scan images, so it will not be repeated here.
[0057] To summarize, the method provided in the embodiment of the present invention obtains a scanned fused image by fusing multiple scanned images, and refocuses the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanned images; or, extracts features from the multiple scanned images based on a second refocusing model to obtain feature matrices corresponding to the multiple scanned images, fuses the feature matrices corresponding to the multiple scanned images to obtain a fused feature matrix, and obtains a refocused image corresponding to the multiple scanned images based on the fused feature matrix. Image refocusing can be performed on the basis of a small number of scanned images, so that the scanning interval can be reduced within the same scanning interval, thereby reducing the scanning cost. Then, a small number of scanned images are fused and then refocused using a deep learning network, or a small number of scanned images are feature extracted and fused using a deep learning network and then refocused, thereby improving the performance and efficiency of image refocusing.
[0058] Based on the above embodiments, the traditional evaluation indicators for the quality of generated images, such as PSNR, SSIM, FID, etc., are limited to calculating the difference between the calculated and ideal images, and the evaluation performance for the image refocusing scene is not optimal. In this regard, in order to more accurately evaluate the refocusing effect of the refocused image, so as to optimize the above image refocusing method, the image focusing effect can be evaluated in combination with the AI segmentation results. Specifically, Figure 2 As shown, the method also includes:
[0059] Step 210, performing target segmentation on the multiple scanned images and the refocused images corresponding to the multiple scanned images based on the target segmentation model, to obtain target segmentation results of the multiple scanned images and target segmentation results of the refocused images corresponding to the multiple scanned images;
[0060] Step 220, based on the target segmentation results of the plurality of scanned images and the target segmentation results of the refocused images corresponding to the plurality of scanned images, respectively determine the segmentation effect evaluation values of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images;
[0061] Step 230, respectively determining the clarity of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images;
[0062] Step 240: Determine a focusing effect evaluation value of the refocused images corresponding to the multiple scanned images based on the multiple scanned images and the segmentation effect evaluation values and the sharpness of the refocused images corresponding to the multiple scanned images.
[0063] Specifically, multiple scanned images and the refocused images corresponding to the multiple scanned images can be respectively input into the pre-trained target segmentation model for target segmentation. Among them, the target segmentation model can adopt any segmentation model, such as Mask-RCNN, etc., and the embodiment of the present invention does not specifically limit this. When training the target segmentation model, the target to be segmented can be determined based on the application scenario of the refocused image, so as to collect the corresponding sample segmentation image and its corresponding sample segmentation result. For example, when the downstream task of the refocused image is a cell classification or cell segmentation and other image processing tasks related to cells, it can be determined that the target to be segmented is a cell, so the cell image collected by the microscope can be collected as a sample segmentation image, and it can be annotated to obtain the corresponding sample segmentation result. Here, 15 layers of cell images taken continuously by the microscope can be fused into a fused image as a sample segmentation image. The pre-trained target segmentation model is used to segment the targets to be segmented in the multiple scanned images and the refocused images corresponding to the multiple scanned images, and the target segmentation results of each of the multiple scanned images and the target segmentation results of the refocused images corresponding to the multiple scanned images are obtained.
[0064] Subsequently, based on the target segmentation results of each of the above-mentioned multiple scanned images and the target segmentation results of the refocused images corresponding to the above-mentioned multiple scanned images, the segmentation effect evaluation values of each scanned image and the above-mentioned refocused image are determined respectively. The segmentation effect evaluation value is used to characterize the segmentation accuracy of the corresponding target segmentation result, which can be calculated using any image segmentation evaluation index, such as mAP (mean Average Precision), which is not specifically limited in the embodiment of the present invention. In addition, the clarity of the above-mentioned multiple scanned images and the refocused images corresponding to the above-mentioned multiple scanned images is determined respectively. The clarity can be calculated based on the image clarity evaluation index, for example, the tenengrad function can be used to calculate the clarity of the above-mentioned multiple scanned images and the refocused images corresponding to the above-mentioned multiple scanned images.
[0065] Based on the segmentation effect evaluation values and clarity of the above-mentioned multiple scanned images and the refocused images corresponding to the above-mentioned multiple scanned images, the focusing effect evaluation values of the refocused images corresponding to the above-mentioned multiple scanned images are comprehensively determined, thereby improving the accuracy of the refocusing effect evaluation. Among them, the image effect evaluation values of the multiple scanned images can be calculated respectively based on the segmentation effect evaluation values and clarity of each of the multiple scanned images. For example, for any scanned image, its segmentation effect evaluation value and clarity can be weighted and summed to obtain the image effect evaluation value of the scanned image. Among them, the weight of the segmentation effect evaluation value is greater than the weight of the clarity, for example, the weight of the segmentation effect evaluation value can be set to 0.9, and the weight of the clarity can be set to 0.1. Similarly, the image effect evaluation value of the refocused image can be calculated based on the segmentation effect evaluation value and clarity of the refocused image. Subsequently, based on the difference between the image effect evaluation value of the refocused image and the image effect evaluation values of the above-mentioned multiple scanned images, the focusing effect evaluation value of the refocused image is determined. Among them, the greater the difference between the image effect evaluation value of the refocused image and the image effect evaluation values of the above-mentioned multiple scanned images, the better the refocusing effect of the refocused image is, and thus the greater the focusing effect evaluation value of the refocused image can be.
[0066] The scanning image refocusing device provided by the present invention is described below. The scanning image refocusing device described below and the scanning image refocusing method described above can be referred to each other.
[0067] Based on any of the above embodiments, Figure 3 Schematic diagram of the structure of the scanning image refocusing device provided by the present invention. Figure 3 As shown, the device comprises:
[0068] The scanning image acquisition unit 310 is used to acquire multiple scanning images at different Z-axis positions in the same field of view acquired by the microscope;
[0069] A first refocusing unit 320, configured to fuse the multiple scanned images to obtain a scanned fused image, and refocus the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanned images;
[0070] Alternatively, the second refocusing unit 330 is configured to perform feature extraction on the multiple scanned images based on the second refocusing model, obtain feature matrices corresponding to the multiple scanned images, fuse the feature matrices corresponding to the multiple scanned images to obtain a fused feature matrix, and obtain refocused images corresponding to the multiple scanned images based on the fused feature matrix;
[0071] Among them, the first refocusing model is obtained by training based on a sample scanning fusion image of multiple sample scanning images and their corresponding sample refocusing images, and the second refocusing model is obtained by training based on multiple sample scanning images and their corresponding sample refocusing images.
[0072] The device provided by the embodiment of the present invention obtains a scanned fused image by fusing multiple scanned images, and refocuses the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanned images; or, extracts features from the multiple scanned images based on a second refocusing model to obtain feature matrices corresponding to each of the multiple scanned images, then fuses the feature matrices corresponding to each of the multiple scanned images to obtain a fused feature matrix, and obtains a refocused image corresponding to the multiple scanned images based on the fused feature matrix. Image refocusing can be performed on the basis of a small number of scanned images, so that the scanning interval can be reduced within the same scanning interval, thereby reducing the scanning cost. Then, a small number of scanned images are fused and then refocused using a deep learning network, or a small number of scanned images are feature extracted and fused using a deep learning network and then refocused, thereby improving the performance and efficiency of image refocusing.
[0073] Based on any of the foregoing embodiments, the first refocusing model or the second refocusing model is trained based on the following steps:
[0074] Inputting the model input image corresponding to the current round of iteration into the first refocusing model or the second refocusing model to obtain a test refocusing image output by the first refocusing model or the second refocusing model, and calculating the model loss based on the test refocusing image and the corresponding sample refocusing image, and adjusting the model parameters of the first refocusing model or the second refocusing model based on the model loss;
[0075] Among them, the model input image corresponding to the first refocusing model is a sample scan fusion image of multiple sample scan images, and the model input image corresponding to the second refocusing model is multiple sample scan images; before the preset training node, the model loss is calculated based on the first loss function, and after the preset training node, the model loss is calculated based on the first loss function and the second loss function, the first loss function is used to determine the difference between the test refocusing image and the corresponding sample refocusing image, and the second loss function is used to calculate the difference between the feature map of the test refocusing image output by the pre-trained feature extraction network and the feature map of the sample refocusing image.
[0076] Based on any of the above embodiments, the first refocusing model includes a downsampling network and an upsampling network; the second refocusing model includes a plurality of downsampling networks and upsampling networks corresponding to the number of scanned images; wherein the downsampling network is constructed based on a pre-trained image feature extraction model.
[0077] Based on any of the above embodiments, any downsampling layer in each downsampling network of the second refocusing model is connected to an upsampling layer in the upsampling network whose output feature map size is the same as the feature map size output by any downsampling layer.
[0078] Based on any of the above embodiments, fusing the multiple scanned images to obtain a scanned fused image specifically includes:
[0079] Converting the plurality of scanned images into grayscale images to obtain a plurality of scanned grayscale images;
[0080] Calculating an average pixel value of each pixel based on the pixel values of the same pixel in the plurality of scanned grayscale images, and generating a fused grayscale image based on the average pixel value of each pixel;
[0081] The fused grayscale image is converted into a color image to obtain the scanned fused image.
[0082] Based on any of the above embodiments, the device further includes a refocusing effect evaluation unit, which is used to:
[0083] Based on the target segmentation model, target segmentation is performed on the multiple scanned images and the refocused images corresponding to the multiple scanned images respectively, to obtain target segmentation results of each of the multiple scanned images and target segmentation results of the refocused images corresponding to the multiple scanned images;
[0084] Determine segmentation effect evaluation values of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images, respectively, based on the target segmentation results of the plurality of scanned images and the target segmentation results of the refocused images corresponding to the plurality of scanned images;
[0085] respectively determining the sharpness of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images;
[0086] Based on the plurality of scanned images and the segmentation effect evaluation values and the sharpness of the refocused images corresponding to the plurality of scanned images, the focusing effect evaluation values of the refocused images corresponding to the plurality of scanned images are determined.
[0087] Based on any of the above embodiments, determining the focusing effect evaluation value of the refocused image corresponding to the multiple scanned images based on the segmentation effect evaluation value and clarity of the multiple scanned images and the refocused images corresponding to the multiple scanned images specifically includes:
[0088] Calculating image effect evaluation values of the plurality of scanned images respectively based on the segmentation effect evaluation values and sharpness of each of the plurality of scanned images;
[0089] Calculating image effect evaluation values of the refocused images corresponding to the multiple scanned images based on the segmentation effect evaluation values and the clarity of the refocused images corresponding to the multiple scanned images;
[0090] Based on the difference between the image effect evaluation values of the refocusing images corresponding to the plurality of scanning images and the image effect evaluation values of the plurality of scanning images, the focusing effect evaluation values of the refocusing images corresponding to the plurality of scanning images are determined.
[0091] Figure 4 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor (processor) 410, a memory (memory) 420, a communication interface (Communications Interface) 430 and a communication bus 440, wherein the processor 410, the memory 420, and the communication interface 430 communicate with each other through the communication bus 440. The processor 410 can call the logic instructions in the memory 420 to execute the scanning image refocusing method, which includes: acquiring multiple scanning images at different Z-axis positions under the same field of view collected by the microscope; fusing the multiple scanning images to obtain a scanning fusion image, and refocusing the scanning fusion image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanning images; or, based on a second refocusing model, respectively extracting features from the multiple scanning images to obtain feature matrices corresponding to each of the multiple scanning images, fusing the feature matrices corresponding to each of the multiple scanning images to obtain a fused feature matrix, and obtaining refocused images corresponding to the multiple scanning images based on the fused feature matrix; wherein the first refocusing model is obtained by training a sample scanning fusion image of a plurality of sample scanning images and their corresponding sample refocusing images, and the second refocusing model is obtained by training a plurality of sample scanning images and their corresponding sample refocusing images.
[0092] In addition, the logic instructions in the above-mentioned memory 420 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0093] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the scanning image refocusing method provided by the above-mentioned methods, and the method includes: acquiring multiple scanning images at different Z-axis positions under the same field of view collected by a microscope; fusing the multiple scanning images to obtain a scanning fusion image, and refocusing the scanning fusion image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanning images; or, based on a second refocusing model, respectively extracting features from the multiple scanning images to obtain feature matrices corresponding to each of the multiple scanning images, fusing the feature matrices corresponding to each of the multiple scanning images to obtain a fused feature matrix, and obtaining the refocused images corresponding to the multiple scanning images based on the fused feature matrix; wherein the first refocusing model is obtained by training a sample scanning fusion image of a plurality of sample scanning images and their corresponding sample refocusing images, and the second refocusing model is obtained by training a plurality of sample scanning images and their corresponding sample refocusing images.
[0094] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the scanning image refocusing methods provided above, the methods comprising: acquiring multiple scanning images at different Z-axis positions under the same field of view acquired by a microscope; fusing the multiple scanning images to obtain a scanning fusion image, and refocusing the scanning fusion image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanning images; or, extracting features from the multiple scanning images respectively based on a second refocusing model to obtain feature matrices corresponding to each of the multiple scanning images, fusing the feature matrices corresponding to each of the multiple scanning images to obtain a fused feature matrix, and obtaining refocused images corresponding to the multiple scanning images based on the fused feature matrix; wherein the first refocusing model is obtained by training a sample scanning fusion image of a plurality of sample scanning images and their corresponding sample refocusing images, and the second refocusing model is obtained by training a plurality of sample scanning images and their corresponding sample refocusing images.
[0095] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A scanning image refocusing method, characterized in that: include: Acquire multiple scanned images at different Z-axis positions in the same field of view collected by a microscope; fusing the multiple scanned images to obtain a scanned fused image, and refocusing the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the multiple scanned images; Alternatively, after extracting features from the multiple scanned images based on the second refocusing model to obtain feature matrices corresponding to the multiple scanned images, the feature matrices corresponding to the multiple scanned images are fused to obtain a fused feature matrix, and refocused images corresponding to the multiple scanned images are obtained based on the fused feature matrix; The first refocusing model is obtained by training based on a sample scan fusion image of a plurality of sample scan images and their corresponding sample refocusing images, and the second refocusing model is obtained by training based on a plurality of sample scan images and their corresponding sample refocusing images; The first refocusing model or the second refocusing model is trained based on the following steps: Inputting the model input image corresponding to the current round of iteration into the first refocusing model or the second refocusing model to obtain a test refocusing image output by the first refocusing model or the second refocusing model, and calculating the model loss based on the test refocusing image and the corresponding sample refocusing image, and adjusting the model parameters of the first refocusing model or the second refocusing model based on the model loss; Among them, the model input image corresponding to the first refocusing model is a sample scan fusion image of multiple sample scan images, and the model input image corresponding to the second refocusing model is multiple sample scan images; before the preset training node, the model loss is calculated based on the first loss function, and after the preset training node, the model loss is calculated based on the first loss function and the second loss function, the first loss function is used to determine the difference between the test refocusing image and the corresponding sample refocusing image, and the second loss function is used to calculate the difference between the feature map of the test refocusing image output by the pre-trained feature extraction network and the feature map of the sample refocusing image.
2. The scanning image refocusing method according to claim 1, characterized in that: The first refocusing model includes a downsampling network and an upsampling network; the second refocusing model includes a plurality of downsampling networks and upsampling networks corresponding to the number of scanned images; wherein the downsampling network is constructed based on a pre-trained image feature extraction model.
3. The scanning image refocusing method according to claim 2, characterized in that: Any down-sampling layer in each down-sampling network of the second refocusing model is connected to an up-sampling layer in the up-sampling network whose output feature map size is the same as the feature map size output by any down-sampling layer.
4. The scanning image refocusing method according to claim 1, characterized in that: The fusing the multiple scanned images to obtain a scanned fused image specifically includes: Converting the plurality of scanned images into grayscale images to obtain a plurality of scanned grayscale images; Calculating an average pixel value of each pixel based on the pixel values of the same pixel in the plurality of scanned grayscale images, and generating a fused grayscale image based on the average pixel value of each pixel; The fused grayscale image is converted into a color image to obtain the scanned fused image.
5. The scanning image refocusing method according to any one of claims 1 to 4, characterized in that: The method further comprises: Based on the target segmentation model, target segmentation is performed on the multiple scanned images and the refocused images corresponding to the multiple scanned images respectively, to obtain target segmentation results of each of the multiple scanned images and target segmentation results of the refocused images corresponding to the multiple scanned images; Determine segmentation effect evaluation values of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images, respectively, based on the target segmentation results of the plurality of scanned images and the target segmentation results of the refocused images corresponding to the plurality of scanned images; respectively determining the sharpness of the plurality of scanned images and the refocused images corresponding to the plurality of scanned images; Based on the plurality of scanned images and the segmentation effect evaluation values and the sharpness of the refocused images corresponding to the plurality of scanned images, the focusing effect evaluation values of the refocused images corresponding to the plurality of scanned images are determined.
6. The scanning image refocusing method according to claim 5, characterized in that: The determining, based on the plurality of scanned images and the segmentation effect evaluation values and sharpness of the refocused images corresponding to the plurality of scanned images, the focusing effect evaluation values of the refocused images corresponding to the plurality of scanned images specifically includes: Calculating image effect evaluation values of the plurality of scanned images respectively based on the segmentation effect evaluation values and sharpness of each of the plurality of scanned images; Calculating image effect evaluation values of the refocused images corresponding to the multiple scanned images based on the segmentation effect evaluation values and the clarity of the refocused images corresponding to the multiple scanned images; Based on the difference between the image effect evaluation values of the refocusing images corresponding to the plurality of scanning images and the image effect evaluation values of the plurality of scanning images, the focusing effect evaluation values of the refocusing images corresponding to the plurality of scanning images are determined.
7. A scanning image refocusing device, characterized in that: include: A scanning image acquisition unit, used to acquire multiple scanning images at different Z-axis positions in the same field of view collected by the microscope; a first refocusing unit, configured to fuse the plurality of scanned images to obtain a scanned fused image, and refocus the scanned fused image based on a first refocusing model to obtain a refocused image corresponding to the plurality of scanned images; Alternatively, a second refocusing unit is used to perform feature extraction on the multiple scanned images based on a second refocusing model, obtain feature matrices corresponding to the multiple scanned images, fuse the feature matrices corresponding to the multiple scanned images to obtain a fused feature matrix, and obtain refocused images corresponding to the multiple scanned images based on the fused feature matrix; The first refocusing model is obtained by training based on a sample scan fusion image of a plurality of sample scan images and their corresponding sample refocusing images, and the second refocusing model is obtained by training based on a plurality of sample scan images and their corresponding sample refocusing images; The first refocusing model or the second refocusing model is trained based on the following steps: Inputting the model input image corresponding to the current round of iteration into the first refocusing model or the second refocusing model to obtain a test refocusing image output by the first refocusing model or the second refocusing model, and calculating the model loss based on the test refocusing image and the corresponding sample refocusing image, and adjusting the model parameters of the first refocusing model or the second refocusing model based on the model loss; Among them, the model input image corresponding to the first refocusing model is a sample scan fusion image of multiple sample scan images, and the model input image corresponding to the second refocusing model is multiple sample scan images; before the preset training node, the model loss is calculated based on the first loss function, and after the preset training node, the model loss is calculated based on the first loss function and the second loss function, the first loss function is used to determine the difference between the test refocusing image and the corresponding sample refocusing image, and the second loss function is used to calculate the difference between the feature map of the test refocusing image output by the pre-trained feature extraction network and the feature map of the sample refocusing image.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the scanning image refocusing method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the scanning image refocusing method according to any one of claims 1 to 6 is implemented.
