AI-based mobile focusing method and device

By adopting the AI ​​-based mobile focusing method in the image collection device, the AI ​​prediction distance deviates from the direction and adjusts the distance, solves the problem of low traditional focus method focusing efficiency and poor real -time real -time.

CN116095474BActive Publication Date: 2025-01-28SUZHOU DIMEG INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111289607.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-02
Publication Date
2025-01-28
Estimated Expiration
2041-11-02

AI Technical Summary

Technical Problem

The prior art has insufficient focus quality in image acquisition equipment, and the traditional focusing method based on the sharpness algorithm cannot determine the direction of the image deviation, resulting in low focus efficiency and poor real-time performance.

Method used

Using AI -based mobile focusing methods, through pre -trained AI focus deviation from predictive models, using single image predictive distance to deviate from the correct focus position, and move the mobile focus according to the preset scanning path, control the Z axis to adjust the object at a specific speed to adjust the object at a specific speed. distance.

Benefits of technology

The focusing time of reducing more than 50 % under the premise of ensuring stable focusing, improving the focus efficiency, and solving the problem of poor real -time real -time movement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116095474B_ABST
    Figure CN116095474B_ABST
Patent Text Reader

Abstract

The present application relates to an AI-based mobile focusing method and device, belonging to the technical field of optical equipment. The method comprises: during the movement of an image acquisition device along a preset scanning path, a target image acquired at the kth scanning position is input into a pre-trained AI focus deviation prediction model to obtain a focus deviation amount, and the focus deviation speed v is calculated using the first n deviation amounts; when the focus deviation amount is greater than 0 (or less than 0) and the absolute value is greater than a preset threshold, the z-axis is controlled to reduce (or increase) the object distance at a speed of a*v; when the absolute value of the focus deviation amount is less than or equal to the preset threshold, the object distance is changed at a speed of b*v in the opposite direction of v, and based on the clarity of the target image and the clarity of the historical images acquired at the first m scanning positions, it is determined whether the current object distance is the optimal focus object distance; real-time control of the object distance during movement can be achieved, and the accuracy of mobile focusing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present application relates to an AI-based mobile focusing method and device, and relates to the technical field of optical equipment. [Background technology]

[0002] In the process of scanning samples using image acquisition equipment (such as digital slide scanners, etc.), the focus quality when acquiring the sample image determines the image quality when scanning the sample later. Therefore, how to improve the focus quality is an urgent problem to be solved.

[0003] The traditional focus method based on the clarity algorithm can only judge whether the focus point is deviated by the clarity of the image, but there is no way to judge the direction of deviation. In this way, it is impossible to judge the z-axis adjustment direction of the image acquisition device.

[0004] The invention patent "Method for automatic focusing of optical fiber end faces based on neural networks" with application number 201910151409.6 discloses the following content: setting the current position of the optical fiber as the initial position, acquiring the first optical fiber end face image at the initial position; moving the optical fiber clamp to the second position with a preset step, acquiring the second optical fiber end face image at the second position; inputting the first optical fiber end face image and the second optical fiber end face image into the trained neural network in the acquisition order; obtaining the output result of the neural network, the output result is the corresponding moving direction label generated according to the clarity change state of the two input pictures, and the moving direction label includes: a correct direction label or an incorrect direction label; adjusting the position of the optical fiber clamp according to the moving direction label and the focusing strategy until the end face of the optical fiber reaches a clear focus position.

[0005] However, the above-mentioned autofocus method not only needs to perform an automatic focusing process to the optimal focusing position at each position, which will lead to the problem of low adjustment efficiency; at the same time, it is also necessary to input two adjacent captured images into the neural network to determine the moving direction label, which will lead to the problem of poor real-time prediction of the moving direction. [Summary of the invention]

[0006] The present application provides an AI-based mobile focusing method and device. The mobile focusing method based on artificial intelligence (AI) proposed in the present application can train AI to predict the direction in which the object distance deviates from the correct focus position through a single image, so that the object distance can be adjusted in the opposite direction of the deviation direction. At the same time, by performing mobile focusing during movement along a preset scanning path, the focusing time can be reduced by more than 50% while ensuring stable focus, thereby improving the focusing efficiency.

[0007] This application provides the following technical solutions:

[0008] In a first aspect, there is provided an AI-based mobile focusing method, the method comprising:

[0009] During the movement of the image acquisition device along a preset scanning path, input the target image acquired at the k-th scanning position into a pre-trained AI focus deviation prediction model to obtain a focus deviation amount, where the focus deviation amount is used to indicate the difference between the current object distance and the optimal focusing object distance; the preset scanning path is located in the plane formed by the x-axis and y-axis of the image acquisition device; k is a positive integer starting from 1 in sequence;

[0010] Calculate the focus deviation speed v using the first n deviation amounts; n is an integer greater than 1;

[0011] When the focus deviation amount is greater than 0 (or less than 0) and its absolute value is greater than a preset threshold, control the z-axis to decrease (or increase) the object distance at a speed of a*v, where a>1;

[0012] When the absolute value of the focus deviation amount is less than or equal to the preset threshold, change the object distance at a speed of b*v in the opposite direction of v, where 1<b<a; and determine whether the current object distance is the optimal focusing object distance based on the sharpness of the target image and the sharpness of historical images acquired at the previous m scanning positions; m is a positive integer.

[0013] Optionally, the changing the object distance at a speed of b*v in the opposite direction of v includes:

[0014] Control the running speed to be a / x, where x is a value greater than 1.

[0015] Optionally, the determining whether the current object distance is the optimal focusing object distance based on the sharpness of the target image and the sharpness of historical images acquired at the previous m scanning positions includes:

[0016] Determine the maximum sharpness value from the historical images acquired at the previous m scanning positions;

[0017] When the sharpness of the target image is greater than the maximum sharpness value, determine that the current object distance is the optimal focusing object distance.

[0018] Optionally, the method further comprises:

[0019] After the mobile focusing is completed, scan the sample to be scanned according to at least one optimal focusing object distance.

[0020] Optionally, the scanning the sample to be scanned according to at least one optimal focusing object distance after the mobile focusing is completed includes:

[0021] During the scanning process, determining the best focus object distance closest to the current object distance from the at least one best focus object distance;

[0022] The sample to be scanned is scanned according to the best focus object distance with the shortest distance.

[0023] Optionally, the preset scanning path is determined based on the spatial distribution of the sample to be scanned.

[0024] Optionally, the preset scanning path includes scanning paths located in different scanning areas, and during the movement of the image acquisition device along the preset scanning path, the target image acquired at the kth scanning position is input into a pre-trained AI focus deviation prediction model to obtain the focus deviation amount, including:

[0025] For each scanning path within the scanning area, while the image acquisition device moves along the scanning path, the target image acquired at the kth scanning position on the scanning path is input into a pre-trained AI focus deviation prediction model to obtain the focus deviation amount.

[0026] Optionally, the AI ​​focus deviation prediction model is trained using training data, wherein the training data includes sample images collected at different positions on the z-axis and a focus deviation label corresponding to each sample image, wherein the focus deviation label is the difference between the object distance of the sample image collected and the optimal focus object distance.

[0027] In a second aspect, a mobile focusing device based on AI is provided, the device comprising:

[0028] A focus deviation prediction module is used to input a target image acquired at a k-th scanning position into a pre-trained AI focus deviation prediction model during the movement of the image acquisition device along a preset scanning path, to obtain a focus deviation amount, wherein the focus deviation amount is used to indicate a difference between a current object distance and an optimal focus object distance; the preset scanning path is located in a plane formed by an x-axis and a y-axis of the image acquisition device; and k is a positive integer starting from 1;

[0029] A moving speed calculation module, used to calculate the focus deviation speed v using the first n deviation amounts; wherein n is an integer greater than 1;

[0030] A first object distance control module, for controlling the z-axis to decrease or increase the object distance at a speed of a*v when the focus deviation is greater than 0 or less than 0 and the absolute value is greater than a preset threshold, wherein a>1;

[0031] The second object distance control module is configured to change the object distance in the opposite direction of v at a speed of b*v when the absolute value of the focus deviation amount is less than or equal to a preset threshold, where 1 < b < a; and determine whether the current object distance is the optimal focusing object distance based on the sharpness of the target image and the sharpness of the historical images collected at the previous m scanning positions; m is a positive integer.

[0032] The beneficial effects of the present application at least include: during the movement of the image acquisition device along the preset scanning path, the target image collected at the kth scanning position is input into the pre-trained AI focus deviation prediction model to obtain the focus deviation amount, and the focus deviation speed v is calculated using the previous n deviation amounts; when the focus deviation amount is greater than 0 (or less than 0) and the absolute value is greater than the preset threshold, the z-axis is controlled to decrease (or increase) the object distance at a speed of a*v, where a > 1; when the absolute value of the focus deviation amount is less than or equal to the preset threshold, the object distance is changed at a speed of b*v in the opposite direction of v, where b satisfies 1 < b < a; it can solve the problem of low focusing efficiency when adjusting to the optimal focusing object distance for each scanning position; since mobile focusing is performed during the movement along the preset scanning path, overall control of the x, y, and z axes can be achieved, improving the focusing efficiency. At the same time, it can also solve the problem of poor real-time performance in predicting the moving direction when using the images collected in two adjacent times to input into the neural network to determine the moving direction label; by training the AI to predict the direction of the object distance deviating from the correct focusing position through a single image, the object distance can be adjusted in the opposite direction of the deviation direction, enabling real-time control of the object distance during the movement and improving the accuracy of mobile focusing.

[0033] The above description is only an overview of the technical solution of the present application. In order to understand the technical means of the present application more clearly and implement it according to the content of the specification, the following further details the preferred embodiments of the present application in conjunction with the accompanying drawings.

Description of the Drawings

[0034] Figure 1 is a flowchart of an AI-based mobile focusing method provided by an embodiment of the present application;

[0035] Figure 2 is a flowchart of an AI-based mobile focusing method provided by another embodiment of the present application;

[0036] Figure 3 is a schematic diagram of historical images at different scanning positions provided by an embodiment of the present application;

[0037] Figure 4 is a schematic diagram of the correspondence between the df predicted value and the true value provided by an embodiment of the present application;

[0038] Figure 5is a schematic diagram of an AI-based mobile focus trajectory provided by an embodiment of the present application;

[0039] Figure 6 It is a block diagram of an AI-based mobile focusing device provided by an embodiment of the present application. [Specific implementation method]

[0040] The specific implementation methods of the present application are further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present application but are not intended to limit the scope of the present application.

[0041] First, several terms involved in the embodiments of the present application are introduced.

[0042] The digital slide scanner is a precision instrument that integrates multiple technologies such as optics, mechanics, electronics, and computers. By controlling the microscopic imaging system and the slices to move in a certain pattern, multiple continuous high-resolution microscopic images are collected, and then seamlessly spliced ​​to generate a high-resolution full-slice image. After the traditional slice is turned into a high-resolution digital image, the user can browse the slice on a computer or mobile device anytime and anywhere without a microscope. This digital image has the advantages of never fading, easy to save, manage, share, and can be zoomed in and out at will for all-round viewing.

[0043] During the scanning process of the digital slice scanner, it is necessary to control the microscope imaging system to focus on the slice on the stage.

[0044] Optionally, the present application uses the AI-based mobile focusing method provided in each embodiment as an example for use in an image acquisition device, where the image acquisition device includes but is not limited to a digital slide scanner, a microscope, and other devices that need to focus on objects during the image acquisition process. This embodiment does not limit the implementation method of the image acquisition device.

[0045] Figure 1 : is a flow chart of an AI-based mobile focusing method provided by an embodiment of the present application, and the method includes at least the following steps:

[0046] Step 101, when the image acquisition device moves along a preset scanning path, the target image acquired at the kth scanning position is input into a pre-trained AI focus deviation prediction model to obtain a focus deviation amount, which is used to indicate the difference between the current object distance and the optimal focus object distance; the preset scanning path is located in the plane formed by the x-axis and y-axis of the image acquisition device.

[0047] k is a positive integer starting from 1.

[0048] In this embodiment, the image acquisition device includes control motors in three directions, namely, an x-axis control motor, a y-axis control motor, and a z-axis control motor. Among them, the x-axis control motor controls the image acquisition device to move along the x-axis, the y-axis control motor controls the image acquisition device to move along the y-axis, and the z-axis control motor controls the image acquisition device to move along the z-axis. The x-axis and the y-axis are perpendicular to each other and parallel to the plane where the sample to be scanned is placed, and the z-axis is perpendicular to the plane where the x-axis and the y-axis are located.

[0049] Optionally, the positive direction of the z-axis points to the sample to be scanned (in this case, the positive direction of the z-axis is the first direction below), or the positive direction of the z-axis points away from the sample to be scanned (in this case, the positive direction of the z-axis is the second direction below). This embodiment does not limit the implementation method of the z-axis.

[0050] The preset scanning path refers to the moving track of the image acquisition device in the plane formed by the x-axis and the y-axis. There are multiple scanning positions on the preset scanning path, and the scanning position refers to the position where the image acquisition device acquires the image of the sample to be scanned. Optionally, the image acquisition device acquires an image every preset time, or the image acquisition device acquires an image every time it moves a preset distance on the preset scanning path. This embodiment does not limit the timing of the image acquisition device acquiring images.

[0051] The sample to be scanned may be a digital slice, or a specific layer in a digital slice. This embodiment does not limit the implementation method of the sample to be scanned.

[0052] Optionally, the preset scanning path is determined based on the spatial distribution of the sample to be scanned. The preset scanning path may be a straight line or a curve, and this embodiment does not limit the shape of the preset scanning path.

[0053] Optionally, the preset scanning path includes scanning paths located in different scanning areas. At this time, when the image acquisition device moves along the preset scanning path, the target image captured at the kth scanning position is input into the pre-trained AI focus deviation prediction model to obtain the focus deviation amount, including: for the scanning path within each scanning area, when the image acquisition device moves along the scanning path, the target image captured at the kth scanning position on the scanning path is input into the pre-trained AI focus deviation prediction model to obtain the focus deviation amount. In other words, when different scanning areas contain multiple unconnected areas, different scanning areas are moved and focused according to the scanning paths within the area.

[0054] In this embodiment, the AI focus deviation prediction model is trained using training data, which includes sample images collected at different positions on the z-axis and the focus deviation label corresponding to each sample image. The focus deviation label is the difference df between the object distance d for collecting the sample image and the optimal focusing object distance f. Accordingly, the focus deviation amount is used to indicate the difference df between the current object distance d and the optimal focusing object distance f.

[0055] Specifically, control the z-axis control motor to adjust the distance between the objective lens of the image acquisition device and the sample, collect a sample image and obtain the object distance of the sample image; record the position when the clarity of the sample image is the highest as the optimal focusing object distance. The object distance of the sample image increasing compared to the optimal focusing object distance is positive, and decreasing is negative, to obtain training data for training the AI focus deviation prediction model.

[0056] Schematically, the AI focus deviation prediction model is trained based on the residual network ResNet50.

[0057] Step 102, calculate the focus deviation speed v using the first n deviation amounts; n is an integer greater than 1.

[0058] Step 103, when the focus deviation amount is greater than 0 (or less than 0) and its absolute value is greater than a preset threshold, control the z-axis to decrease (or increase) the object distance at a speed of a*v, where a > 1.

[0059] That is, when df > 0 and its absolute value is greater than the preset threshold, the object distance is greater than the optimal focusing object distance. At this time, control the z-axis to move in the direction of decreasing the object distance.

[0060] Optionally, when df > 0 and its absolute value is greater than the preset threshold, since the image acquisition device is far from the optimal focusing position, at this time, control the moving speed of the image acquisition device to remain unchanged.

[0061] When df < 0 and its absolute value is greater than the preset threshold, the object distance is less than the optimal focusing object distance. At this time, control the z-axis to move in the direction of increasing the object distance.

[0062] Optionally, when df < 0 and its absolute value is greater than the preset threshold, since the image acquisition device is also far from the optimal focusing position, at this time, control the moving speed of the image acquisition device to remain unchanged.

[0063] Step 104, when the absolute value of the focus deviation amount is less than or equal to the preset threshold, change the object distance at a speed of b*v in the opposite direction of v, where 1 < b < a, and determine whether the current object distance is the optimal focusing object distance based on the clarity of the target image and the clarity of the historical images collected at the previous m scanning positions.

[0064] m is a positive integer.

[0065] When the absolute value of the focus deviation is less than or equal to the preset threshold, the direction of df is uncertain. At this time, the object distance is close to the optimal focus object distance, and the clarity Qk of the target image is recorded; based on the first m clarity, it is determined whether the current object distance is recorded as the optimal focus object distance.

[0066] Optionally, when the absolute value of the focus deviation is less than or equal to a preset threshold, the operating speed is controlled to be reduced to a / x, where x is a value greater than 1. The value of x is a preset integer, which may be 3, 4, etc. This embodiment does not limit the value of n.

[0067] Based on the clarity of the target image and the clarity of the historical images collected at the first m scanning positions, determining whether the current object distance is the optimal focus object distance includes: determining the maximum clarity value from the historical images collected at the first m scanning positions; when the clarity of the target image is greater than the maximum clarity value, determining the current object distance is the optimal focus object distance.

[0068] Optionally, when the clarity of the target image is greater than the maximum clarity, the object distance with the maximum clarity in the historical image is used as the optimal focus object distance for the corresponding position.

[0069] The value of m may be 3, 5, etc., and this embodiment does not limit the value of m.

[0070] Among them, steps 102 and 103 are mutually exclusive steps, that is, there is no strict execution order between steps 102 and 103, and this embodiment does not limit the execution order between 102 and 103.

[0071] After steps 102, 103 and 104 are completed, the image acquisition device is controlled to continue to move along the preset scanning path until the moving focus stops at the end of the movement along the preset scanning path.

[0072] In order to more clearly understand the mobile focus process provided by this application, the following example is used to illustrate the process. Figure 2 , the process includes the following steps:

[0073] Step 21, determine whether the mobile focus is completed, if not, execute step 22; if yes, the process ends;

[0074] Step 22, controlling the image acquisition device to change the positions of the x-axis and the y-axis to move along a preset scanning path and acquire a target image;

[0075] Step 23, input the target image into the AI ​​focus deviation prediction model to obtain the focus deviation amount df;

[0076] In this embodiment, the focus deviation df is basically close to the true value. Figure 3Schematic diagram of the corresponding relationship between the predicted value and the true value shown.

[0077] Step 24, determine whether df is greater than 0 and whether the absolute value is greater than a preset threshold; if df is greater than 0 and the absolute value is greater than the preset threshold, execute step 25; if df is less than 0 and the absolute value is greater than the preset threshold, execute step 26; if the absolute value of df is less than or equal to the preset threshold, execute step 27;

[0078] Step 25, controlling the z-axis to move in a direction close to the sample to reduce the object distance, and executing step 21 again;

[0079] Step 26, controlling the z-axis to move in a direction away from the sample to increase the object distance, and executing step 21 again;

[0080] Step 27, continue to control the z-axis to move in the current direction, and determine whether the current object distance is the optimal focus object distance based on the clarity of the target image and the clarity of the historical images collected at the first m scanning positions, and execute step 21.

[0081] Among them, the clarity of different historical images is referenced Figure 4 As shown, according to Figure 4 It can be seen that the clarity of historical images corresponding to different scanning positions is different.

[0082] In the process of moving focus according to the above steps, the movement trajectory of the z-axis is referenced Figure 5 As shown. Figure 5 It can be seen that the object distances at various scanning positions are basically close to the optimal focusing object distance.

[0083] Optionally, after the mobile focus is completed, the image acquisition device scans the sample to be scanned according to at least one optimal focus object distance.

[0084] Specifically, after the mobile focus is completed, the sample to be scanned is scanned according to at least one optimal focus object distance, including: during the scanning process, determining the optimal focus object distance closest to the current object distance from at least one optimal focus object distance; scanning the sample to be scanned according to the closest optimal focus object distance.

[0085] In summary, for the AI-based mobile focusing method provided in this embodiment, during the movement of the image acquisition device along a preset scanning path, the target image acquired at the k-th scanning position is input into a pre-trained AI focus deviation prediction model to obtain a focus deviation amount; and the focus deviation speed v is calculated using the first n deviation amounts; when the focus deviation amount is greater than 0 (or less than 0) and the absolute value is greater than a preset threshold, the z-axis is controlled to decrease (or increase) the object distance at a speed of a*v, where a>1; when the absolute value of the focus deviation amount is less than or equal to the preset threshold, the object distance is changed at a speed of b*v in the opposite direction of v, where 1<b<a; this can solve the problem of low focusing efficiency when adjusting to the optimal focusing object distance for each scanning position; since mobile focusing is performed during the movement along the preset scanning path, overall control of the x, y, and z axes can be achieved, improving the focusing efficiency. At the same time, it can also solve the problem of poor real-time performance in predicting the moving direction when using the images acquired in two adjacent times to input into the neural network to determine the moving direction label; by training the AI to predict the direction of the object distance deviating from the correct focusing position through a single image, the object distance can be adjusted relative to the opposite direction of the deviation direction, which can improve the real-time performance of mobile focusing.

[0086] Figure 6 FIG. 4 is a block diagram of an AI-based mobile focusing device provided by an embodiment of the present application. The device at least includes the following modules: a focus deviation prediction module 610, a moving speed calculation module 620, a first object distance control module 630, and a second object distance control module 640.

[0087] The focus deviation prediction module 610 is configured to, during the movement of the image acquisition device along a preset scanning path, input the target image acquired at the k-th scanning position into a pre-trained AI focus deviation prediction model to obtain a focus deviation amount, where the focus deviation amount is used to indicate the difference between the current object distance and the optimal focusing object distance; the preset scanning path is located in the plane formed by the x-axis and the y-axis of the image acquisition device; k is a positive integer starting from 1 in sequence;

[0088] The moving speed calculation module 620 is configured to calculate the focus deviation speed v using the first n deviation amounts; n is an integer greater than 1;

[0089] The first object distance control module 630 is configured to, when the focus deviation amount is greater than 0 (or less than 0) and the absolute value is greater than a preset threshold, control the z-axis to decrease (or increase) the object distance at a speed of a*v, where a>1;

[0090] The second object distance control module 640 is configured to change the object distance in the opposite direction of v at a speed of b*v when the absolute value of the focus deviation amount is less than or equal to a preset threshold, where 1 < b < a; and determine whether the current object distance is the optimal focusing object distance based on the sharpness of the target image and the sharpness of the historical images collected at the previous m scanning positions; m is a positive integer.

[0091] For related details, refer to the above method embodiments.

[0092] It should be noted that: when the AI-based mobile focusing device provided in the above embodiments performs AI-based mobile focusing, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be assigned to different functional modules according to needs, that is, the internal structure of the AI-based mobile focusing device is divided into different functional modules to complete all or part of the functions described above. In addition, the AI-based mobile focusing device provided in the above embodiments and the method embodiments of AI-based mobile focusing belong to the same concept. For the specific implementation process, refer to the method embodiments and will not be elaborated here.

[0093] Optionally, the present application further provides a computer-readable storage medium, in which a program is stored, and the program is loaded and executed by a processor to implement the AI-based mobile focusing method of the above method embodiments.

[0094] Optionally, the present application further provides a computer product, which includes a computer-readable storage medium, in which a program is stored, and the program is loaded and executed by a processor to implement the AI-based mobile focusing method of the above method embodiments.

[0095] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, 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, it should be considered as the scope recorded in this specification.

[0096] The above embodiments only represent several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the invention patent. It should be pointed out that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.

Claims

1. A mobile focusing method based on AI, characterized in that: The method includes: During the movement of the image acquisition device along a preset scanning path, input the target image acquired at the k-th scanning position into a pre-trained AI focus deviation prediction model to obtain a focus deviation amount, where the focus deviation amount is used to indicate the difference between the current object distance and the optimal focusing object distance; the preset scanning path is located in the plane formed by the x-axis and y-axis of the image acquisition device; k is a positive integer starting from 1 in sequence; Calculate the focus deviation speed v using the first n deviation amounts; n is an integer greater than 1; When the focus deviation amount is greater than 0 and its absolute value is greater than a preset threshold, control the z-axis to decrease the object distance at a speed of a*v. When the focus deviation amount is less than 0 and its absolute value is greater than the preset threshold, control the z-axis to increase the object distance at a speed of a*v, where a > 1; When the absolute value of the focus deviation amount is less than or equal to the preset threshold, change the object distance at a speed of b*v in the opposite direction of v, where 1 < b < a; and determine whether the current object distance is the optimal focusing object distance based on the sharpness of the target image and the sharpness of the historical images acquired at the previous m scanning positions; m is a positive integer.

2. The method according to claim 1, characterized in that The changing the object distance at a speed of b*v in the opposite direction of v includes: Control the running speed to be a / x, where x is a value greater than 1.

3. The method according to claim 1, characterized in that The determining whether the current object distance is the optimal focusing object distance based on the sharpness of the target image and the sharpness of the historical images acquired at the previous m scanning positions includes: Determine the maximum sharpness value from the historical images acquired at the previous m scanning positions; When the sharpness of the target image is greater than the maximum sharpness value, determine that the current object distance is the optimal focusing object distance.

4. The method according to claim 1, characterized in that: The method further includes: After the moving focus is completed, scan the sample to be scanned according to at least one optimal focusing object distance.

5. The method according to claim 4, characterized in that The scanning the sample to be scanned according to at least one optimal focusing object distance after the moving focus is completed includes: During the scanning process, determine the optimal focusing object distance closest to the current object distance from the at least one optimal focusing object distance; Scan the sample to be scanned according to the optimal focusing object distance closest to the distance.

6. The method according to claim 1, characterized in that The preset scanning path is determined based on the spatial distribution of the sample to be scanned.

7. The method according to claim 1, characterized in that The preset scanning path includes scanning paths in different scanning regions. During the movement of the image acquisition device along the preset scanning path, input the target image acquired at the k-th scanning position into a pre-trained AI focus deviation prediction model to obtain a focus deviation amount, including: For the scanning path in each scanning region, during the movement of the image acquisition device along the scanning path, input the target image acquired at the k-th scanning position on the scanning path into a pre-trained AI focus deviation prediction model to obtain the focus deviation amount.

8. The method according to any one of claims 1 to 7, characterized in that: The AI focus deviation prediction model is trained using training data, where the training data includes sample images acquired at different positions on the z-axis and the focus deviation labels corresponding to each sample image, and the focus deviation label is the difference between the object distance for acquiring the sample image and the optimal focusing object distance.

9. An AI-based mobile focusing device, characterized in that: The device includes: A focus deviation prediction module, which is configured to input the target image collected at the k-th scanning position into a pre-trained AI focus deviation prediction model during the movement of the image acquisition device along a preset scanning path, so as to obtain a focus deviation amount, and the focus deviation amount is used to indicate the difference between the current object distance and the optimal focusing object distance; the preset scanning path is located in the plane formed by the x-axis and the y-axis of the image acquisition device; k is a positive integer starting from 1 in sequence; A moving speed calculation module, which is configured to calculate the focus deviation speed v using the previous n deviation amounts; n is an integer greater than 1; A first object distance control module, which is configured to control the z-axis to decrease the object distance at a speed of a*v when the focus deviation amount is greater than 0 and its absolute value is greater than a preset threshold, and control the z-axis to increase the object distance at a speed of a*v when the focus deviation amount is less than 0 and its absolute value is greater than the preset threshold, where a>1; A second object distance control module, which is configured to change the object distance at a speed of b*v in the opposite direction of v when the absolute value of the focus deviation amount is less than or equal to the preset threshold, where 1<b<a; and determine whether the current object distance is the optimal focusing object distance based on the sharpness of the target image and the sharpness of the historical images collected at the previous m scanning positions; m is a positive integer.

Citation Information

Patent Citations

  • Methods and related devices for fiber optic end-face autofocus based on neural networks

    CN109936696B

  • Image scanning method and system based on linear array CCD (charge coupled device) system

    CN102333171A

  • Quick and automatic focusing method and device for camera

    CN105430279A