Search

CN-122018134-A - Microscope fast focusing method, apparatus, storage medium and program product

CN122018134ACN 122018134 ACN122018134 ACN 122018134ACN-122018134-A

Abstract

The invention discloses a microscope fast focusing method, a device, a storage medium and a program product. Aiming at the industry pain point of microscope automatic focusing, a brand new focusing scheme based on traditional contrast focusing and double AI model complementary checking is provided, and the problems that the prior art has contradiction between high frame rate and calculation power, the traditional algorithm has no unified weighing scale, the adaptability across scenes is poor, the speed and the precision cannot be considered at the same time are solved. Provides a solution with high speed, high precision and high stability for the automatic focusing scene of the microscope.

Inventors

  • ZHAO SHENGJIE
  • CHEN KAIXUAN
  • ZHANG SONG
  • Zhao Conghao

Assignees

  • 南京木木西里科技有限公司
  • 南京凯视迈科技有限公司
  • 南京木木智造科技有限公司

Dates

Publication Date
20260512
Application Date
20260311

Claims (10)

  1. 1. The quick focusing method of the microscope is characterized by constructing and training a large-small-area double-branch definition regression model, wherein the input of the large-small-area double-branch definition regression model is RGB three channels of a central small-area image and RGB three channels of a global large-area image of a microscope image, and after multi-scale features are respectively and independently extracted by a central small-area branch and a global large-area branch, the features of the two branches are spliced and fused, and finally the definition effectiveness fraction is output; the method comprises the steps of constructing and training a definition time sequence trend classification model, wherein the input of the definition time sequence trend classification model is RGB three channels of a current frame of a microscope image and N frames before and after the current frame, the RGB three channels are sequentially subjected to feature extraction and feature fusion, probability distribution of various definition trends is finally output, the definition trends comprise continuous rising of definition, continuous falling of definition at a real peak value and the real falling of definition, the acquired microscope image is subjected to frame-by-frame real-time operation by adopting a contrast algorithm, the definition value of the current frame is output, the Z-axis motor coding position corresponding to the current frame is recorded, a definition change curve in a focusing stroke is generated, local trend fitting is carried out on the definition change curve, the dual-mode verification is triggered only when a suspected peak point is detected, the acquired microscope image is respectively input into the large-small region dual-branch definition regression model and the definition time sequence trend classification model, and the current Z-axis motor position is locked to be a focusing position only when the output of the two models simultaneously reach verification passing conditions, and automatic focusing is completed.
  2. 2. The method for rapidly focusing a microscope according to claim 1, wherein each image in the training set of the large-small area double-branch definition regression model is marked with a definition label of 0-1, wherein 0 indicates that the image is completely out of focus, 1 indicates that the image is precisely in focus, and the large-small area double-branch definition regression model outputs a definition validity score of 0-1.
  3. 3. The method for rapidly focusing a microscope according to claim 1, wherein the training strategy of the large and small area double-branch definition regression model is as follows: The training set carries out balanced sampling aiming at different multiplying powers, different light sources and different sample types, adopts an L1 loss function, adopts an Adam optimizer to match with a learning rate attenuation strategy, and only adopts horizontal/vertical overturn to carry out data enhancement.
  4. 4. The method for rapidly focusing a microscope according to claim 1, wherein the training strategy of the definition time sequence trend classification model is as follows: The method comprises the steps of collecting continuous image sequences of focusing processes under different lenses, different multiplying powers and different samples, completely covering the full focusing process of 'blurring' -definition '-blurring', oversampling trend categories with definition at real peak values, adopting a cross entropy loss function with category weights, adopting an Adam optimizer to match with a learning rate attenuation strategy, and carrying out data enhancement by adopting only horizontal/vertical overturn.
  5. 5. The method for quickly focusing a microscope according to claim 1, wherein a Sigmoid activation function is adopted for the large-small-area double-branch definition regression model to restrict an output range, and a Softmax activation function is adopted for the definition time sequence trend classification model.
  6. 6. A quick focusing method of a microscope according to claim 1 is characterized in that a sliding window method is adopted to perform local trend fitting on a definition curve, namely, a local second-order curve is fitted by taking the definition value of a current frame and M frames before and after the current frame, namely, continuous 2M+1 frames, and when the local second-order curve meets the condition that the current frame is a local maximum value in a continuous 2M+1 frame window, the current frame is judged to be a suspected peak point, and dual-mode verification is triggered.
  7. 7. The method of claim 1, wherein a sharpness validity threshold is set, and when a sharpness validity score output by the large-small-area double-branch sharpness regression model is greater than or equal to the sharpness validity threshold, and a maximum probability distribution value output by the sharpness time sequence trend classification model corresponds to that sharpness is in a true peak trend category, the output of the two models simultaneously reaches a verification passing condition.
  8. 8. A computer device comprising a processor and a memory, the memory storing a computer program, the processor for executing the computer program to implement the microscope fast focus method according to any one of claims 1-7.
  9. 9. A computer storage medium storing a computer program which, when executed on a processor, implements the microscope fast focus method according to any one of claims 1 to 7.
  10. 10. A computer program product comprising a computer program or instructions which, when executed by a processor, implements the microscope fast focus method as claimed in any one of claims 1 to 7.

Description

Microscope fast focusing method, apparatus, storage medium and program product Technical Field The invention belongs to the field of microscope imaging, in particular relates to an automatic focusing technology of precision optical imaging equipment such as a biological microscope, a metallographic microscope, an industrial detection microscope and the like, and is particularly suitable for an automatic scene with micron-scale precision under a high-power microscope and high frame rate rapid focusing. Background With the development of microscopic imaging technology to automation, high speed and high precision, automatic Focusing (AF) has become a core standard function of modern automated microscopes. In a high-power mirror scene, the depth of field of a microscope is only 1-3 mu m, the focusing precision requirement reaches submicron level, and meanwhile, the automatic batch detection scene has extremely high requirement on focusing speed. The main automatic focusing scheme in the current microscope field is contrast focusing (CDAF), and the principle is that the focusing state is judged by detecting the image contrast peak value, and the method has the advantages of high precision, strong interpretation and the like. However, because sequential images need to be acquired, the focusing speed is strongly related to the frame rate of camera acquisition, and high frame rate acquisition is an important precondition for realizing rapid focusing. Although the traditional CDAF can adapt to high frame rate frame-by-frame operation, the output is a relative contrast value, and two unresolved natural defects exist: (1) The numerical range and the peak amplitude of the non-uniform measurement scale are greatly influenced by the brightness of a light source, the material quality of a sample, the optical parameters of a lens and the multiplying power, the definition curves under different scenes have great differences, and whether the current frame is in a real focusing state cannot be judged through a fixed threshold; (2) False peak misjudgment is serious, namely the false peak is extremely easy to be influenced by sample impurities, noise, local textures and uneven illumination under a high-power lens, a large number of local false peaks are generated, the true focusing peak and the false peak cannot be distinguished only by the relative contrast, the false judgment of a focusing system is caused, a bellows is pulled back and forth, and the focusing success rate of the traditional CDAF is low aiming at low-texture samples such as transparent cell slices and polished metals. With the rapid development of AI technology, the introduction of AI technology into micro-focusing technology is one of the current main trends, mainly including a pure AI focusing scheme and a multi-scale AI focusing scheme and an AI-assisted focusing scheme. The existing pure AI focusing scheme needs AI reasoning on each frame of acquired image, but has higher time consumption, cannot adapt to a high frame rate acquisition scene, so that the focusing speed is limited by the AI reasoning speed, the speed advantage of a high frame rate camera cannot be exerted, and meanwhile, the pure AI scheme has relatively poor focusing precision and poor interpretability, and cannot meet the compliance requirements of medical and industrial quality inspection scenes. The existing multi-scale AI focusing scheme has the defects that the receptive field is insufficient, the image characteristics are outwards diffused after the high-power lens is out of focus, the image characteristics are extremely easy to overflow a small-range focusing area, the model is misjudged, the receptive field is too large, when a plurality of layers of focal planes appear in the visual field, the focal plane of the target focusing area cannot be locked, and the special characteristics of extremely shallow depth of field and out-of-focus diffusion under the high-power lens of the microscope cannot be adapted. Disclosure of Invention In order to solve the technical problems mentioned in the background art, the invention provides a microscope quick focusing method, a device, a storage medium and a program product. In order to achieve the technical purpose, the technical scheme of the invention is as follows: The method comprises the steps of constructing and training a large-small area double-branch definition regression model, wherein the input of the large-small area double-branch definition regression model is RGB three channels of a central small area image and RGB three channels of a global large area image of a microscope image, and after multi-scale features are respectively and independently extracted by a central small area branch and a global large area branch, splicing and fusing the features of the two branches, and finally outputting a definition effectiveness fraction; the method comprises the steps of constructing and training a definition time sequence trend classificatio