A Deep Learning-Based QPD PDAF Focusing Method

By using a deep learning-based QPD PDAF focusing method, the problem of unstable focusing in difficult scenarios of traditional QPD PDAF is solved, and fast, stable and high-precision focusing is achieved in various scenarios.

CN115861102BActive Publication Date: 2026-05-15HOWAY TECH (WUHAN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HOWAY TECH (WUHAN) CO LTD
Filing Date
2022-11-30
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Traditional QPD PDAF focusing methods lack sufficient or unstable focusing accuracy in typical challenging scenarios such as low light, high light, high frequency small text, and weak texture, affecting their applicability.

Method used

We employ a deep learning-based QPD PDAF focusing method. By acquiring and preprocessing the dataset and validation set, we build a QPD PDAF network model, train the network, and output the Defocus value, achieving a fast, stable, and accurate focusing effect.

Benefits of technology

It achieves fast, stable and more accurate focusing effects in both normal scenarios and typical difficult cases, while reducing the zero-point accuracy (Offset) and overall error (Mean_error).

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115861102B_ABST
    Figure CN115861102B_ABST
Patent Text Reader

Abstract

The application provides a kind of QPD PDAF focusing method based on deep learning, comprising: obtaining data set and verification set and carrying out data preprocessing;Build QPD PDAF network model;Network training obtains final network model;And collect test image data and input to final network model, output Defocus value.The QPD PDAF focusing method based on deep learning provided in the application can achieve fast, stable and more accurate focusing effect in conventional scene and typical difficult example.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of camera imaging technology, and in particular to a deep learning-based QPD PDAF focusing method. Background Technology

[0002] Traditional focusing methods use contrast-detection autofocus, which uses the contrast of the image as a reference standard. During the focusing process, the point with the highest contrast is selected as the point of focus. The motor drives the lens to move from the lowest point to the highest point, recording the contrast of the image at each position. After the lens has moved the entire distance, it is moved back to the position with the highest contrast, thus completing the contrast-detection autofocus.

[0003] The basic principle of PDAF (Phase Detection Auto Focus) is that the part of the mobile phone module that senses the image is the photosensitive chip. Each pixel senses the image. If two symmetrical pixels that are a certain distance apart are covered respectively, covering the left and right halves of the pixel, it is equivalent to the left and right eyes of a person. Based on the different angles at which the two eyes see the object, the focus can be calculated to determine whether the focus is accurate.

[0004] Compared to contrast-detection autofocus, PDAF does not involve a full-process motor search. Instead, it determines the distance the motor needs to reach the point of focus by judging the phase difference, and then pushes the lens to that point of focus in one go, thus greatly improving focusing speed.

[0005] However, traditional PDAF schemes based on QPD (quad phase detection) sensors often suffer from insufficient focusing accuracy or unstable focusing (oscillation) in typical challenging scenarios such as low light, high light, high frequency small text, and weak texture, thus affecting the applicability of PDAF algorithms on QPD sensors. Summary of the Invention

[0006] The purpose of this invention is to provide a deep learning-based QPD PDAF focusing method that can achieve fast, stable and more accurate focusing results in both conventional scenarios and typical difficult cases.

[0007] To address the aforementioned technical problems, this invention provides a deep learning-based QPD PDAF focusing method, comprising:

[0008] Obtain the dataset and validation set and perform data preprocessing;

[0009] Build a QPD PDAF network model;

[0010] The network is trained to obtain the final network model; and

[0011] The test image data is collected and input into the final network model, and the Defocus value is output.

[0012] Optionally, the steps to obtain the dataset and validation set include:

[0013] Acquire QPD image data; perform data sampling; generate data labels; and generate datasets and validation sets.

[0014] Optionally, image data can be acquired using a QPD sensor.

[0015] Optionally, the data sampling includes dividing each image into 6*9 windows of 200*200 pixels each.

[0016] Optionally, methods for generating data labels include:

[0017] Calculate the contrast of the image;

[0018] Find N points near the maximum gradient and calculate the location of the focal point, where N is a positive integer; and

[0019] Based on the focal point position, a Defocus label is generated.

[0020] Optionally, the formula for calculating the contrast of the image is:

[0021]

[0022] G x (x,y)=2I(x,y)-I(x-1,y)-I(x+1,y)

[0023] G y (x, y)=2I(x, y)-I(x, y-1)-I(x, y+1)

[0024] Here, x and y refer to the positions of the pixels in the image.

[0025] Optionally, the Defocus tag is:

[0026] Label = DAC current -DAC focus

[0027] Among them, DAC current This refers to the DAC value of the existing acquired images. focus This refers to the DAC value corresponding to the focal point position; DAC refers to the position where the motor moves.

[0028] Optionally, methods for generating the dataset and validation set include randomly splitting the data into a dataset and a validation set.

[0029] Optionally, data preprocessing methods include:

[0030] The data was normalized using the Z-Score algorithm; and

[0031] Calculate the offset between the acquisition window and the center window.

[0032] Optionally, the following methods can be used to build a QPD PDAF network model:

[0033] Considering the characteristics of the image data, the first layer is set to a two-channel input;

[0034] Extract N feature layers of different depths from the network, pass them through 1*1 convolutional layers and fully connected layers respectively to obtain M-dimensional feature vectors, add the input offsets Dx and Dy to form N*M+2 dimensional features;

[0035] The fully connected layer was modified into two layers.

[0036] Optionally, methods for training the network to obtain the final network model include: selecting the model with the smallest loss value in the validation set as the final network model within a predetermined number of training iterations.

[0037] Optionally, the evaluation parameters of the QPD PDAF focusing method include curve correlation (PCC), zero-point accuracy (Offset), and overall error (Mean_error).

[0038] The formula for curve correlation PCC is:

[0039]

[0040] The formula for zero-point precision Offset is:

[0041] Offset = |ZeroOffset PDAF -ZeroOffset CDAF |;

[0042] The formula for the overall error Mean_error is:

[0043]

[0044] Where DAC is the position the motor moves to, DF is the DAC required to move to the focus, and ZeroOffset is the position of the motor. PDAF ZeroOffset is used to achieve zero-point accuracy for the point of focus. CDAF The zero-point precision of the target value.

[0045] Optionally, the curve correlation PCC is used to evaluate the correlation between the DAC and DF based on 21 points near the focal point, and the zero-point accuracy Offset is used to evaluate the zero-point accuracy based on 21 points near the focal point.

[0046] In summary, the deep learning-based QPD PDAF focusing method provided by this invention first acquires a dataset and a validation set and performs data preprocessing; then, a QPD PDAF network model is built, followed by network training to obtain the final network model; finally, test image data is collected and input into the final network model, and the Defocus value is output. Thus, it can achieve a fast, stable, and more accurate focusing effect in both conventional scenarios and typical difficult cases. Attached Figure Description

[0047] Those skilled in the art will understand that the accompanying drawings are provided to better understand the invention and do not constitute any limitation on the scope of the invention. Wherein:

[0048] Figure 1 This is a flowchart of a deep learning-based QPD PDAF focusing method provided in an embodiment of the present invention.

[0049] Figure 2 This is a flowchart of a deep learning-based QPD PDAF focusing method provided in an embodiment of the present invention.

[0050] Figure 3 This is a schematic diagram illustrating the relationship between contrast and DAC provided in an embodiment of the present invention.

[0051] Figure 4 Yes Figure 3 The curve obtained by fitting the data within the dashed circle.

[0052] Figure 5 This is a schematic diagram illustrating the relationship between the loss value obtained during network training and the number of training iterations, provided by one embodiment of the present invention.

[0053] Figure 6a This is a schematic diagram of the verification image provided in one embodiment of the present invention.

[0054] Figure 6b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 1 of the present invention.

[0055] Figure 7a This is a schematic diagram of the verification image provided in Embodiment 2 of the present invention.

[0056] Figure 7b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 2 of the present invention.

[0057] Figure 8a This is a schematic diagram of the verification image provided in Embodiment 3 of the present invention.

[0058] Figure 8bThis is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 3 of the present invention.

[0059] Figure 9a This is a schematic diagram of the verification image provided in Embodiment 4 of the present invention.

[0060] Figure 9b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 4 of the present invention.

[0061] Figure 10a This is a schematic diagram of the verification image provided in Embodiment 5 of the present invention.

[0062] Figure 10b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 5 of the present invention.

[0063] Figure 11a This is a schematic diagram of the verification image provided in Embodiment Six of the present invention.

[0064] Figure 11b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment Six of the present invention.

[0065] Figure 12a This is a schematic diagram of the verification image provided in Embodiment 7 of the present invention.

[0066] Figure 12b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 7 of the present invention.

[0067] Figure 13a This is a schematic diagram of the verification image provided in Embodiment 8 of the present invention.

[0068] Figure 13b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 8 of the present invention.

[0069] Figure 14 This is a schematic diagram illustrating the relationship between Defocus and DAC provided in an embodiment of the present invention. Detailed Implementation

[0070] To make the objectives, advantages, and features of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the drawings are all in a very simplified form and are not drawn to scale, and are only used to facilitate and clarify the explanation of the embodiments of this invention. Furthermore, the structures shown in the drawings are often part of the actual structures. In particular, different figures may emphasize different aspects and may sometimes use different scales.

[0071] As used in this invention, the singular forms “a,” “an,” and “the” include plural objects; the term “or” is generally used to mean “and / or”; the term “a number” is generally used to mean “at least one”; the term “at least two” is generally used to mean “two or more”; furthermore, the terms “first,” “second,” and “third” are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined as "first," "second," and "third" may explicitly or implicitly include one or at least two of those features. The term "proximal" usually refers to the end closer to the operator, and the term "distal" usually refers to the end closer to the patient. "One end" and "the other end," as well as "proximal" and "distal," usually refer to two corresponding parts, which include not only the endpoints. The terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can be fixed connections, detachable connections, or integral connections; they can be mechanical connections or electrical connections; they can be direct connections or indirect connections through an intermediate medium; they can be internal connections between two components or the interaction between two components.

[0072] Furthermore, as used in this invention, the phrase "one element is disposed on another element" generally only indicates that there is a connection, coupling, cooperation, or transmission relationship between the two elements, and the connection, coupling, cooperation, or transmission between the two elements can be direct or indirect through an intermediate element. It should not be construed as indicating or implying a spatial positional relationship between the two elements, i.e., one element can be located arbitrarily inside, outside, above, below, or to one side of the other element, unless otherwise explicitly stated. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0073] Figure 1 This is a flowchart of a deep learning-based QPD PDAF focusing method provided in an embodiment of the present invention. Please refer to... Figure 1 As shown, this invention provides a deep learning-based QPD PDAF focusing method, comprising:

[0074] S1: Obtain the dataset and validation set and perform data preprocessing;

[0075] S2: Build the QPD PDAF network model;

[0076] S3: Perform network training to obtain the final network model; and

[0077] S4: Collect test image data and input it into the final network model, outputting the Defocus value.

[0078] Figure 2This is a flowchart of a deep learning-based QPDPDAF focusing method provided in an embodiment of the present invention. Next, it will be combined with... Figure 1 and Figure 2 The following is a detailed description of a deep learning-based QPD PDAF focusing method provided by an embodiment of the present invention.

[0079] In step S1, the dataset and validation set are acquired and data preprocessing is performed. In this embodiment, the steps of acquiring the dataset and validation set include: step S11, acquiring QPD image data; step S12, data sampling; step S13, generating data labels; and step S14, generating the dataset and validation set.

[0080] Specifically, step S11 is executed first to acquire QPD image data. For example, image data can be acquired using a QPD sensor, and image data from various scenes can be acquired, such as normal scenes, high-frequency scenes, moiré scenes, and / or low-light scenes, but are not limited to these.

[0081] Next, step S12 is executed to sample data. For example, each image is divided into 6*9 windows with a resolution of 200*200 pixels each.

[0082] Then, step S13 is executed to generate data labels. For example, the method for generating data labels includes: calculating the contrast of the image; finding N points near the maximum gradient value, calculating the focal point position, where N is a positive integer; and generating a Defocus (the DAC value required to move to the focal point, where DAC is the position the motor moves) label based on the focal point position.

[0083] Specifically, firstly, the contrast of the image is calculated using the following formula:

[0084]

[0085] G x (x,y)=2I(x,y)-I(x-1,y)-I(x+1,y)

[0086] G y (x, y)=2I(x, y)-I(x, y-1)-I(x, y+1)

[0087] Here, x and y refer to the positions of the pixels in the image.

[0088] Next, find N points near the maximum gradient and calculate the focal point position. Figure 3 This is a schematic diagram illustrating the relationship between contrast and DAC according to an embodiment of the present invention, namely, a contrast curve diagram. Figure 3As shown, the horizontal axis represents the DAC (motor position) and the vertical axis represents the contrast. The area enclosed by the dashed circle contains N points near the maximum gradient. Next, the data within the dashed circle is fitted to obtain a quadratic curve, as shown below. Figure 4 As shown, it is for Figure 3 The curve obtained after fitting the data within the dashed circle shows the location of the focal point. Figure 4 As shown by the dashed line.

[0089] Finally, based on the focal point position, a Defocus tag is generated, and the Defocus tag is:

[0090] Label = DAC current -DAC focus

[0091] Among them, DAC current This refers to the DAC value of the existing acquired images. focus This refers to the DAC value corresponding to the focal point position.

[0092] Then, step S14 is performed to generate the dataset and validation set. For example, a method for generating the dataset and validation set includes randomly splitting the data into a dataset and a validation set.

[0093] Next, data preprocessing is performed. For example, data preprocessing methods include: normalizing the data using the Z-Score algorithm, and calculating the offset from the acquisition window to the center window.

[0094] The normalization formula is:

[0095]

[0096] Among them, Image norm The image represents the normalized data, while the image itself represents the original data, μ. image It is the average of the original data, σ image It is the standard deviation of the original data.

[0097] In step S2, the QPD PDAF network model is built.

[0098] The model design principle is to have limited hardware resources, and to ensure classification accuracy while having few model parameters and high speed. Therefore, the network design is mainly based on MobileNetV3.

[0099] For example, the method for building a QPD PDAF network model includes: taking into account the characteristics of the image data (i.e., PD images), setting the first layer as a two-channel input, i.e., left and right images; extracting N feature layers of different depths in the network, and obtaining M-dimensional feature vectors by passing them through 1*1 convolutional layers and fully connected layers respectively, and adding the input offsets Dx and Dy to form N*M+2 dimensional features; modifying the fully connected layer to two layers to reduce the model parameters.

[0100] In step S3, network training is performed to obtain the final network model.

[0101] For example, hyperparameters are determined, including epochs (number of training iterations), batch size (number of data points passed to the program for training in a single iteration), and learning rate, but these are not limited to these. The learning rate determines whether and when the objective function converges to a local minimum; a suitable learning rate allows the objective function to converge to a local minimum within a suitable time. The batch size means that, assuming the training set has 1000 data points, if the batch size is 100, the model will first be trained using the first 100 data points. After training, the weights are updated, and then the model is trained again using the 101st to 200th data points, until the tenth iteration using all 1000 data points in the training set.

[0102] In this embodiment, the hyperparameters are determined as follows: epoch = 500, batch size = 64, learning rate = 0.001. The loss function is L1, which minimizes the error, which is the sum of all absolute differences between the true and predicted values, representing the minimum absolute deviation. The optimizer is Adam (Adaptive Moment Estimation). The training method is as follows: within 500 epochs, the model corresponding to the smallest loss value in the validation set is selected as the final network model.

[0103] Figure 5 This is a schematic diagram illustrating the relationship between the loss value obtained during network training and the number of training iterations, provided by one embodiment of the present invention. Please refer to it. Figure 5 As shown, the horizontal axis represents the number of training epochs, and the vertical axis represents the loss value. Curve 1 represents the model loss on the validation set (val), and curve 2 represents the model loss on the training set (train). Figure 5 Select the minimum loss value in the validation set (e.g., Figure 5 The model corresponding to the circle in the middle is used as the final network model.

[0104] In step S4, test image data is acquired and input into the final network model, and the Defocus value is output.

[0105] Collect test image data and perform data preprocessing, such as the data preprocessing described in step S1 above, and then input it into the final network model selected in step S3 to finally output the Defocus value.

[0106] The deep learning-based QPD PDAF focusing method provided by this invention first acquires a dataset and a validation set and performs data preprocessing; then, a QPD PDAF network model is built, followed by network training to obtain the final network model; then, test image data is collected and input into the final network model, and the Defocus value is output, thereby achieving a fast, stable and more accurate focusing effect in both conventional scenarios and typical difficult cases.

[0107] The evaluation parameters of the QPD PDAF focusing method include curve correlation (PCC), zero-point accuracy (Offset), and overall error (Mean_error).

[0108] The formula for curve correlation PCC is:

[0109]

[0110] The formula for zero-point precision Offset is:

[0111] Offset = |ZeroOffset PDAF -ZeroOffset CDAF |;

[0112] The formula for the overall error Mean_error is:

[0113]

[0114] Where DAC is the motor's moving position, DF is the DAC required to move to the focus, Cov is the covariance, D is the variance, and ZeroOffset is the zero offset. PDAF ZeroOffset is used to correct the zero-point accuracy of the focus point. CDAF The zero-point precision of the target value.

[0115] It should be noted that the curve correlation PCC is based on 21 points near the focal point to evaluate the correlation between DAC and DF, and the zero-point accuracy Offset is based on 21 points near the focal point to evaluate the zero-point accuracy.

[0116] The following specific embodiments verify the deep learning-based QPD PDAF focusing method provided by the present invention.

[0117] Figure 6a This is a schematic diagram of the verification image provided in one embodiment of the present invention. Figure 6b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 1 of the present invention. According to... Figure 6a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 1.

[0118] Table 1

[0119] PCC Offset Mean_error Traditional methods 0.991 3.375 38.925 The method of the present invention 0.998 2.375 12.2875

[0120] As can be seen from Table 1, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error), especially the overall error (Mean_error) shows a significant reduction. Figure 6b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 6b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0121] Figure 7a This is a schematic diagram of the verification image provided in Embodiment 2 of the present invention. Figure 7b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 2 of the present invention. Figure 7a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 2.

[0122] Table 2

[0123] PCC Offset Mean_error Traditional methods 0.989 1.875 23.744 The method of the present invention 0.999 0.625 5.310

[0124] As can be seen from Table 2, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error), especially the overall error (Mean_error) shows a significant reduction. Figure 7b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 7b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0125] Figure 8a This is a schematic diagram of the verification image provided in Embodiment 3 of the present invention. Figure 8bThis is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 3 of the present invention. Figure 8a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 3.

[0126] Table 3

[0127] PCC Offset Mean_error Traditional methods 0.993 3.375 35.025 The method of the present invention 0.998 1.250 10.013

[0128] As can be seen from Table 3, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error), especially the overall error (Mean_error) shows a significant decrease. Figure 8b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 8b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0129] Figure 9a This is a schematic diagram of the verification image provided in Embodiment 4 of the present invention. Figure 9b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 4 of the present invention. Figure 9a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 4.

[0130] Table 4

[0131] PCC Offset Mean_error Traditional methods 0.944 3.375 35.715 The method of the present invention 0.999 0.750 13.967

[0132] As can be seen from Table 4, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error), and the reduction is quite significant. Figure 9b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 9b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0133] Figure 10a This is a schematic diagram of the verification image provided in Embodiment 5 of the present invention. Figure 10b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 5 of the present invention. According to... Figure 10a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 5.

[0134] Table 5

[0135] PCC Offset Mean_error Traditional methods 0.981 2.625 35.621 The method of the present invention 0.999 1.250 6.283

[0136] As can be seen from Table 5, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error), especially the overall error (Mean_error) shows a significant reduction. Figure 10b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 10b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0137] Figure 11a This is a schematic diagram of the verification image provided in Embodiment Six of the present invention. Figure 11b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment Six of the present invention. Figure 11a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 6.

[0138] Table 6

[0139] PCC Offset Mean_error Traditional methods 0.793 24.875 83.444 The method of the present invention 0.864 18.375 65.298

[0140] As can be seen from Table 6, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error). Figure 11b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 11b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0141] Figure 12a This is a schematic diagram of the verification image provided in Embodiment 7 of the present invention. Figure 12b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment Seven of the present invention. Figure 12a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 7.

[0142] Table 7

[0143] PCC Offset Mean_error Traditional methods 0.995 3.875 21.217 The method of the present invention 0.999 2.250 6.531

[0144] As can be seen from Table 7, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error), especially the overall error (Mean_error) shows a significant reduction. Figure 12b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 12b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0145] Figure 13a This is a schematic diagram of the verification image provided in Embodiment 8 of the present invention. Figure 13b This is a schematic diagram illustrating the relationship between Defocus and DAC provided in Embodiment 8 of the present invention. Figure 13a The verification images shown are used to obtain the final evaluation parameters, which are shown in Table 8.

[0146] Table 8

[0147] PCC Offset Mean_error Traditional methods 0.428 7.000 87.050 The method of the present invention 0.994 1.500 11.165

[0148] As can be seen from Table 8, compared with the traditional method, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall error (Mean_error), and the reduction in both the zero-point accuracy (Offset) and the overall error (Mean_error) is relatively large. Figure 13b In the diagram, curve 1 represents the target curve, curve 2 represents the curve obtained using conventional methods, and curve 3 represents the curve obtained using the method described in this invention. From... Figure 13b As can be seen from the data, curve 3 is closer to curve 1 than curve 2, meaning that the curve obtained by using the deep learning-based QPD PDAF focusing method described in this invention is closer to the target curve.

[0149] It should be noted that the curve correlation (PCC), zero-point precision (Offset), and overall error (Mean_error) in the table above are all average values, i.e., in... Figures 6a to 13a Multiple windows are set on the provided image. For each window, the curve correlation coefficient (PCC), zero-point accuracy offset, and overall error (Mean_error) are calculated and averaged. For example, in Examples 1 to 8, seven windows are selected for testing. Figures 6b to 13b What is displayed is the curve corresponding to a window.

[0150] Table 9

[0151]

[0152] Table 9 shows the image verification under different scenarios and the comparison with traditional methods. The verification scenarios include: Common Set, Low Light, Repeated Textures, and Screen. Other scenarios can also be verified; this embodiment uses the above four scenarios as examples. The numbers in parentheses for each scenario in Table 9 represent the number of images selected for that scenario. The total is the average of the data from the four scenarios. The data shows that, compared with traditional methods, the focusing method described in this invention reduces both the zero-point accuracy (Offset) and the overall mean error (Mean_error), especially for repeated textures, where the reduction in both is significant.

[0153] In the deep learning-based QPD PDAF focusing method provided by this invention, if some difficult scenarios are to be solved, the training set must have a corresponding dataset. Figure 14 This is a schematic diagram illustrating the relationship between Defocus and DAC according to an embodiment of the present invention. Please refer to it. Figure 14 As shown, curve 1 is the target curve, curve 2 is the curve obtained using the traditional method, curve 3 is the curve obtained using the method described in this invention but with a training set that does not contain difficult example scenarios, and curve 4 is the curve obtained using the method described in this invention but with a training set that includes difficult example scenarios. From Figure 14 As can be seen, compared to curve 2, curves 3 and 4 are closer to curve 1, and compared to curve 4, curve 4 is closer to curve 1, and curve 4 and curve 1 almost overlap. Therefore, for some difficult scenarios, the training set must have a corresponding dataset.

[0154] In summary, the deep learning-based QPD PDAF focusing method provided by this invention first acquires a dataset and a validation set and performs data preprocessing; then, a QPD PDAF network model is built, followed by network training to obtain the final network model; finally, test image data is collected and input into the final network model, and the Defocus value is output. Thus, it can achieve a fast, stable, and more accurate focusing effect in both conventional scenarios and typical difficult cases.

[0155] The above description is merely a description of preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any person skilled in the art can make possible changes and modifications to the technical solutions of the present invention by utilizing the methods and techniques disclosed above without departing from the spirit and scope of the present invention. Therefore, any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solutions of the present invention shall fall within the protection scope of the technical solutions of the present invention.

Claims

1. A deep learning-based QPD PDAF focusing method, characterized in that, include: Obtain the dataset and validation set and perform data preprocessing; Build a QPD PDAF network model; The final network model is obtained by training the network. as well as Collect test image data and input it into the final network model, outputting the Defocus value; The steps for obtaining the dataset and validation set include: collecting QPD image data; data sampling; generating data labels; and generating the dataset and validation set. The following methods are used to build a QPD PDAF network model: Considering the characteristics of the image data, the first layer is set to a two-channel input; Extract N feature layers of different depths from the network, pass them through 1*1 convolutional layers and fully connected layers respectively to obtain M-dimensional feature vectors, add the input offsets Dx and Dy to form N*M+2 dimensional features; Modify the fully connected layer into two layers.

2. The deep learning-based QPD PDAF focusing method according to claim 1, characterized in that, Image data is acquired using a QPD sensor.

3. The deep learning-based QPD PDAF focusing method according to claim 1, characterized in that, The data sampling involves dividing each image into 6*9 windows with a resolution of 200*200 pixels each.

4. The deep learning-based QPD PDAF focusing method according to claim 1, characterized in that, Methods for generating data tags include: Calculate the contrast of the image; Find N points near the maximum gradient and calculate the location of the focal point, where N is a positive integer; and Based on the focal point position, a Defocus label is generated.

5. The deep learning-based QPD PDAF focusing method according to claim 4, characterized in that, The formula for calculating the contrast of the image is: Here, x and y refer to the positions of the pixels in the image.

6. The deep learning-based QPD PDAF focusing method according to claim 4, characterized in that, The Defocus tag is: in, This refers to the DAC value of the existing acquired images. This refers to the DAC value corresponding to the focal point position; DAC refers to the position where the motor moves.

7. The deep learning-based QPD PDAF focusing method according to claim 1, characterized in that, Methods for generating datasets and validation sets include randomly splitting the data into datasets and validation sets.

8. The deep learning-based QPD PDAF focusing method according to claim 1, characterized in that, Data preprocessing methods include: The data was normalized using the Z-Score algorithm; and Calculate the offset between the acquisition window and the center window.

9. The deep learning-based QPD PDAF focusing method according to claim 1, characterized in that, Methods for training a network to obtain the final network model include: selecting the model with the smallest loss value in the validation set as the final network model within a predetermined number of training iterations.

10. The deep learning-based QPD PDAF focusing method according to claim 1, characterized in that, The evaluation parameters of the QPDPDAF focusing method include curve correlation (PCC), zero-point accuracy (Offset), and overall error (Mean_error). The formula for curve correlation PCC is: The formula for zero-point precision Offset is: The formula for the overall error Mean_error is: Where DAC represents the position the motor moves to, and DF represents the DAC required to move to the focal point. To ensure zero-point accuracy of the focus point, The zero-point precision of the target value.

11. The deep learning-based QPD PDAF focusing method according to claim 10, characterized in that, Curve correlation (PCC) is used to evaluate the correlation between DAC and DF based on 21 points near the focal point, while zero-point accuracy (Offset) is used to evaluate zero-point accuracy based on 21 points near the focal point.