Focusing method and device, electronic equipment and storage medium
By redetermining the focus parameter correction amount based on the reliability of the correction results and temperature information during phase focusing, the problem of inaccurate focusing during phase focusing is solved, focusing accuracy and sharpness are improved, and the user experience is enhanced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING XIAOMI MOBILE SOFTWARE CO LTD
- Filing Date
- 2024-11-28
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, phase-detection autofocus suffers from inaccurate focusing and insufficient sharpness, especially when the phase detection values in the horizontal and vertical directions are inconsistent.
The correction is performed based on the focus parameter correction amount in the first direction, and the focus parameter correction amount in the second direction is re-determined according to the reliability of the correction result. Alternatively, if the correction result is unreliable, the focus parameter correction amounts in the first and second directions are re-determined. In conjunction with temperature information, different models are used to redetermine the correction amounts.
It improves the accuracy of phase detection autofocus, reduces the impact of optical distortion on focus sharpness, and enhances the user experience.
Smart Images

Figure CN122120613A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to a focusing method, apparatus, electronic device and storage medium. Background Technology
[0002] In recent years, phase detection autofocus (PDAF) has become the mainstream focusing method in the field of photography due to its fast focusing speed. The calculation of the phase detection value (PD) is crucial in the PDAF focusing process.
[0003] In related technologies, phase-detection autofocus primarily uses a PD offset based on the horizontal (H) direction to correct the PD values in both the H and vertical (V) directions. However, this method can result in inaccurate focusing and insufficient focus sharpness. Summary of the Invention
[0004] To overcome the problems existing in the related technologies, this disclosure provides a focusing method, apparatus, electronic device and storage medium.
[0005] According to a first aspect of the present disclosure, a focusing method is provided, comprising: correcting a first-direction focusing parameter based on a first-direction focusing parameter correction amount, and determining the reliability of the correction result, wherein the reliability of the correction result includes a reliable correction result or an unreliable correction result, wherein a reliable correction result indicates that the focus sharpness meets a condition, and an unreliable correction result indicates that the focus sharpness does not meet the condition; based on the reliability of the correction result, re-determining the focusing parameter correction amount, wherein, if the correction result is reliable, the re-determined focusing parameter correction amount includes a second-direction focusing parameter correction amount, or if the correction result is unreliable, the re-determined focusing parameter correction amount includes a second-direction focusing parameter correction amount and a re-determined first-direction focusing parameter correction amount; correcting the second-direction focusing parameter based on the re-determined focusing parameter correction amount, or correcting the first-direction focusing parameter and the second-direction focusing parameter based on the re-determined focusing parameter correction amount.
[0006] In one implementation, the step of redetermining the focus parameter correction amount based on the reliability of the correction result includes: determining the current focus parameter in a first direction, the current focus parameter in a second direction, and the current temperature, and redetermining the focus parameter correction amount based on the reliability of the correction result, the current focus parameter in the first direction, the current focus parameter in the second direction, and the current temperature; wherein the focus parameter in the first direction, the focus parameter in the second direction, and the current temperature have a corresponding relationship with the redetermined focus parameter correction amount.
[0007] In one implementation, the step of re-determining the focus parameter correction amount based on the reliability of the correction result, the current focus parameter in the first direction, the current focus parameter in the second direction, and the current temperature includes: in response to the reliability of the correction result being reliable, determining the second-direction focus parameter correction amount based on the current focus parameter in the first direction, the current focus parameter in the second direction, the current temperature, and a first model, wherein the input of the first model is the temperature, the first-direction focus parameter, and the second-direction focus parameter, and the output is the second-direction focus parameter correction amount; in response to the reliability of the correction result being unreliable, determining the first-direction focus parameter correction amount based on the current focus parameter in the first direction, the current focus parameter in the second direction, the current temperature, and a second model, and re-determining the second-direction focus parameter correction amount, wherein the input of the second model is the temperature, the first-direction focus parameter, and the second-direction focus parameter, and the output is the first-direction focus parameter correction amount and the second-direction focus parameter correction amount.
[0008] In one implementation, the first model is trained as follows: first-direction focus parameter correction and second-direction focus parameter correction are performed respectively, and the burned-in first-direction focus parameter correction amount, the temperature after correction, and the corrected second-direction focus parameter are recorded to obtain a first training sample; the model is trained based on the first training sample to predict the output second-direction focus parameter correction amount; the above model training process is repeated until the predicted output second-direction focus parameter correction amount satisfies the second convergence condition at the same corrected temperature to obtain the first model.
[0009] In one implementation, the second model is trained as follows: First-direction focus parameter correction and second-direction focus parameter correction are performed respectively, and the temperature, corrected first-direction focus parameters, and corrected second-direction focus parameters are recorded after correction to obtain a second training sample; model training is performed based on the second training sample to predict and output the first-direction focus parameter correction amount and the second-direction focus parameter correction amount; the above model training process is repeated until, at the same corrected temperature, the predicted output first-direction focus parameter correction amount satisfies the first convergence condition, and the predicted output second-direction focus parameter correction amount satisfies the second convergence condition, thus obtaining the second model.
[0010] In one embodiment, before performing the first direction focus parameter correction and the second direction focus parameter correction respectively, the method further includes: determining that a first model does not exist in response to the fact that the correction result is credible; or determining that a second model does not exist in response to the fact that the correction result is uncredible.
[0011] According to a second aspect of the present disclosure, a focusing device is provided, comprising: a determining module, configured to correct a first-direction focusing parameter based on a first-direction focusing parameter correction amount, and determine the reliability of the correction result, wherein the reliability of the correction result includes a reliable correction result or an unreliable correction result, wherein a reliable correction result indicates that the focus sharpness meets a condition, and an unreliable correction result indicates that the focus sharpness does not meet the condition; a processing module, configured to redetermine the focusing parameter correction amount based on the reliability of the correction result, wherein, if the correction result is reliable, the redetermined focusing parameter correction amount includes a second-direction focusing parameter correction amount, or if the correction result is unreliable, the redetermined focusing parameter correction amount includes a second-direction focusing parameter correction amount and a redetermined first-direction focusing parameter correction amount; and a correcting module, configured to correct the second-direction focusing parameter based on the redetermined focusing parameter correction amount, or to correct the first-direction focusing parameter and the second-direction focusing parameter based on the redetermined focusing parameter correction amount.
[0012] In one implementation, the processing module redetermines the focus parameter correction amount based on the reliability of the correction result by: determining the current focus parameter in the first direction, the current focus parameter in the second direction, and the current temperature, and redetermining the focus parameter correction amount based on the reliability of the correction result, the current focus parameter in the first direction, the current focus parameter in the second direction, and the current temperature; wherein the focus parameter in the first direction, the focus parameter in the second direction, and the current temperature have a corresponding relationship with the redetermined focus parameter correction amount.
[0013] In one implementation, the processing module redetermines the focus parameter correction amount based on the reliability of the correction result, the current focus parameter in the first direction, the current focus parameter in the second direction, and the current temperature in the following manner: In response to the reliability of the correction result being reliable, the module determines the second-direction focus parameter correction amount based on the current focus parameter in the first direction, the current focus parameter in the second direction, the current temperature, and a first model, wherein the input of the first model is the temperature, the first-direction focus parameter, and the second-direction focus parameter, and the output is the second-direction focus parameter correction amount; In response to the reliability of the correction result being unreliable, the module determines the first-direction focus parameter correction amount based on the current focus parameter in the first direction, the current focus parameter in the second direction, the current temperature, and a second model, and redetermines the second-direction focus parameter correction amount, wherein the input of the second model is the temperature, the first-direction focus parameter, and the second-direction focus parameter, and the output is the first-direction focus parameter correction amount and the second-direction focus parameter correction amount.
[0014] In one implementation, the first model is trained as follows: first-direction focus parameter correction and second-direction focus parameter correction are performed respectively, and the burned-in first-direction focus parameter correction amount, the temperature after correction, and the corrected second-direction focus parameter are recorded to obtain a first training sample; the model is trained based on the first training sample to predict the output second-direction focus parameter correction amount; the above model training process is repeated until the predicted output second-direction focus parameter correction amount satisfies the second convergence condition at the same corrected temperature to obtain the first model.
[0015] In one implementation, the second model is trained as follows: First-direction focus parameter correction and second-direction focus parameter correction are performed respectively, and the temperature, corrected first-direction focus parameters, and corrected second-direction focus parameters are recorded after correction to obtain a second training sample; model training is performed based on the second training sample to predict and output the first-direction focus parameter correction amount and the second-direction focus parameter correction amount; the above model training process is repeated until, at the same corrected temperature, the predicted output first-direction focus parameter correction amount satisfies the first convergence condition, and the predicted output second-direction focus parameter correction amount satisfies the second convergence condition, thus obtaining the second model.
[0016] In one embodiment, the determining module is further configured to: in response to the calibration result being deemed credible, determine that a first model does not exist before performing first-direction focus parameter calibration and second-direction focus parameter calibration respectively; or in response to the calibration result being deemed uncredible, determine that a second model does not exist before performing first-direction focus parameter calibration and second-direction focus parameter calibration respectively.
[0017] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the focusing method described in the first aspect or any embodiment of the first aspect.
[0018] According to a fourth aspect of the present disclosure, a storage medium is provided, the storage medium storing instructions that, when executed by a processor, can perform the focusing method described in the first aspect or any embodiment of the first aspect.
[0019] The technical solutions provided by the embodiments of this disclosure can include the following beneficial effects: by re-determining the correction amount of the second-direction focusing parameter when the correction result is reliable, and re-determining the correction amount of the first-direction focusing parameter and the second-direction focusing parameter when the correction result is unreliable, the confirmation of the focusing parameter correction amount from different directions is realized, thereby improving the accuracy of phase focusing.
[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0022] Figure 1 This is a flowchart illustrating a focusing method according to an exemplary embodiment.
[0023] Figure 2 This is a flowchart illustrating a method for redetermining the focus parameter correction amount based on temperature, according to an exemplary embodiment.
[0024] Figure 3 This is a flowchart illustrating a method for determining focus parameters using a first model or a second model, according to an exemplary embodiment.
[0025] Figure 4 This is a flowchart illustrating a training method for a first model according to an exemplary embodiment.
[0026] Figure 5 This is a flowchart illustrating a training method for a second model according to an exemplary embodiment.
[0027] Figure 6 This is a flowchart illustrating online training of a model in practical use, according to an exemplary embodiment.
[0028] Figure 7 This is a flowchart illustrating online training of a model in practical use, according to an exemplary embodiment.
[0029] Figure 8 This is a block diagram illustrating a focusing device according to an exemplary embodiment.
[0030] Figure 9 This is a block diagram illustrating a focusing device according to an exemplary embodiment.
[0031] Figure 10 This is a block diagram illustrating a focusing device according to an exemplary embodiment. Detailed Implementation
[0032] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure.
[0033] The focusing method provided in this disclosure is applied to phase-detection autofocus scenarios. For example, it can be applied to scenarios such as camera module correction and camera phase-detection autofocus correction, or to scenarios where adaptive phase-detection autofocus is performed in the photo and video modes of other electronic products such as phase-detection cameras and digital cameras.
[0034] In related technologies, phase detection autofocus, as a fast focusing method in modern smart electronic devices, has seen its field of view (FOV) gradually increase with the improvement of hardware capabilities, resulting in a wider focusing range, especially with telephoto lenses. The phase detection values in the horizontal (H) and vertical (V) directions are the same because phase detection is based on the phase change of light waves, which is independent of the direction of light wave propagation. Therefore, during automatic phase detection autofocus, correction can usually be performed by outputting a phase shift in the horizontal direction to address situations where there are few texture features in the vertical direction, making the phase shift result unreliable, while the horizontal direction has abundant texture features. Alternatively, the phase shift can be calculated in the vertical direction based on the richness of texture features to address situations where there are few texture features in the horizontal direction. In phase detection auto focus calibration (PDAF calibration), a certain number of positions are extracted from the maximum range of lens movement [mac, inf] of the focus value (FV), i.e., the lower bound (mac) and infinity (infimum, inf). Continuous autofocus (CAF) and phase detection calculations are then performed on these positions. Typically, the lens position (lens pos) corresponding to the focus peak (FV peak) calculated from the horizontal focus value is the sharpest position. The phase detection result calculated at this point is the phase offset (pd offset). When the camera performs phase focusing, the result calculated from the phase offset library (pd lib) and then superimposed with the phase offset is the final phase detection result. This phase detection result is used to control the motor to find the sharpest position. However, due to factors such as optical distortion, pixel pairs at different positions on the sensor may have different sensitivities to phase detection values. Therefore, in phase-detection autofocus systems, adjusting the focus position by calculating the correction amount in a single direction can result in poor image sharpness after focusing.
[0035] In view of this, the present disclosure provides a focusing method in which PD offset is corrected based on the H direction and the PD offset in the V direction is re-determined to improve the accuracy of phase focusing and help improve the user experience.
[0036] The focusing method disclosed herein is applied to electronic devices. These electronic devices can be terminals, also known as terminal devices, mobile stations (MS), mobile terminals (MT), etc., and are devices that provide voice and / or data connectivity to users. For example, an electronic device can be a handheld device with wireless connectivity, an in-vehicle device, etc. Examples of current electronic devices include: smartphones (Mobile Phones), pocket personal computers (PPCs), handheld computers, personal digital assistants (PDAs), laptops, tablets, wearable devices, or in-vehicle devices. Furthermore, when it is a vehicle-to-everything (V2X) communication system, the electronic device can also be an in-vehicle device. It should be understood that the embodiments of this disclosure do not limit the specific technology or device form used in the electronic device.
[0037] Figure 1 This is a flowchart illustrating a focusing method according to an exemplary embodiment, such as... Figure 1 As shown, the focusing method is performed through the following steps:
[0038] In step S11, the first direction focusing parameter is corrected based on the first direction focusing parameter correction amount, and the reliability of the correction result is determined. The reliability of the correction result includes whether the correction result is reliable or unreliable. A reliable correction result indicates that the focus sharpness meets the condition, and an unreliable correction result indicates that the focus sharpness does not meet the condition.
[0039] In one embodiment, during automatic phase detection autofocus, phase detection values of pixel pairs in two directions are acquired, namely, the phase offset in the horizontal direction and the phase offset in the vertical direction. The influence of the phase offset is eliminated by setting a focus parameter correction amount, and then the lens motor is driven to adjust to the lens position (lens pos) to achieve correction. The reliability of the image can be determined in various ways. For example, if the focus value of the image after correcting the focus parameters in the first direction based on the first direction focus parameter correction amount reaches a threshold, it is considered reliable; otherwise, it is unreliable. Alternatively, if fine search is not triggered during automatic phase detection autofocus, it is considered reliable; otherwise, it is considered reliable.
[0040] In step S12, based on the reliability of the correction result, the focus parameter correction amount is re-determined. If the correction result is reliable, the re-determined focus parameter correction amount includes the second direction focus parameter correction amount; if the correction result is unreliable, the re-determined focus parameter correction amount includes the second direction focus parameter correction amount and the re-determined first direction focus parameter correction amount.
[0041] In this embodiment, if the correction result of the first direction focusing parameter is reliable, then the correction result of the first direction focusing parameter is considered to meet the focusing requirements. After the correction result of the first direction focusing parameter meets the focusing requirements, the second direction obtained by automatic phase focusing is reconfirmed, that is, the focusing parameter correction amount for the two directions is determined separately. If the correction result is reliable, taking the first direction as the horizontal direction as an example, if the texture richness in the horizontal direction is high and precise focus search is not triggered during phase focusing, then the correction result of the focusing parameter in the horizontal direction is considered reliable, and the focusing parameter correction amount in the vertical direction, i.e., the second direction, is re-determined. Finally, the subsequent correction is performed using the first direction focusing parameter correction amount and the re-determined second direction focusing parameter correction amount. If the correction result is unreliable, taking the first direction as the horizontal direction as an example, if the texture richness in the horizontal direction is insufficient, and a precise focus search is triggered during phase focusing, then the correction result of the focus parameters in the horizontal direction is considered unreliable. It is necessary to redetermine the correction amounts of the focus parameters in the vertical direction (i.e., the second direction) and the focus parameters in the first direction. Finally, subsequent corrections are performed using the redetermined correction amounts of the focus parameters in the first direction and the redetermined correction amounts of the focus parameters in the second direction.
[0042] In step S13, the second-direction focus parameters are corrected based on the redefined focus parameter correction amount, or the first-direction focus parameters and the second-direction focus parameters are corrected based on the redefined focus parameter correction amount.
[0043] In this embodiment of the disclosure, the current phase detection result is superimposed with the phase offset in the corresponding direction for correction. The lens position corresponding to the corrected standard focus position (phase detection 0, pd0) is the clearest position in the camera focusing process, which can be considered as the completion of focusing.
[0044] Through the above embodiments, when performing automatic phase focusing, the correction amount of the first direction focusing parameter and / or the correction amount of the second direction focusing parameter are re-determined based on the reliability of the correction results. This can reduce the impact of different phase offsets in different directions on focusing accuracy, further improve focusing accuracy, and help enhance the user experience.
[0045] It is understandable that during phase shift prediction, as the module hardware iterates and updates, the module's focusing range becomes wider. These hardware changes lead to temperature variations. With varying camera temperatures and different rates of temperature increase, phase shifts in both the horizontal and vertical directions change with temperature. This means that the lens movement corresponding to the standard focusing positions in the two directions is inconsistent; the sharpest position in the horizontal direction is not necessarily the sharpest position in the vertical direction. Compensating with the same amount of focusing parameter correction results in decreased focusing performance. Therefore, it is necessary to redetermine the phase shift in each direction based on the current focusing temperature during the shooting or focusing process, which helps improve the accuracy of the focusing parameter correction. The following embodiments further illustrate the method of redetermining focusing parameter correction based on temperature in this disclosure.
[0046] In one embodiment, Figure 2 This is a flowchart illustrating a method for redetermining focus parameter correction amounts based on temperature, according to an exemplary embodiment. Figure 2 As shown, the focus parameter correction amount is determined through the following steps:
[0047] In step S21, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature are determined.
[0048] In step S22, the focus parameter correction amount is re-determined based on the reliability of the correction result, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature.
[0049] Among them, the first direction focusing parameters, the second direction focusing parameters, and the current temperature have a corresponding relationship with the newly determined focusing parameter correction amount.
[0050] In this embodiment of the disclosure, during the automatic phase focusing process, the temperature corresponding to the focus parameter correction amount is continuously acquired. When re-determining the focus parameter correction amount, the corresponding temperature is used as a constraint, and the correspondence is pre-learned. During actual focusing, this correspondence can be used to redetermine what kind of first-direction focus parameter correction amount and second-direction focus parameter correction amount should be superimposed at that temperature to achieve the standard focus position.
[0051] Through the above embodiments, by redetermining the focus parameter correction amount in conjunction with the corresponding temperature, the influence of camera temperature on phase focusing can be effectively reduced, and the focus blur and out-of-focus phenomena caused by changes in phase detection results due to temperature changes can be reduced, thereby improving the user experience.
[0052] It is understandable that the correspondence can be determined in various ways. For example, the relationship between temperature, focus parameters, and focus parameter correction can be statistically analyzed by curve fitting, or the correspondence can be determined by constructing a lookup table and interpolating, or the correspondence can be learned by a model. This disclosure does not make any specific limitations.
[0053] The following embodiments of this disclosure, taking the determination of focus parameters through a model as an example, will be used for further explanation.
[0054] Figure 3 This is a flowchart illustrating a method for determining focus parameters using a first model or a second model, according to an exemplary embodiment. Figure 3 As shown, the focus parameters are determined using either the first or second model through the following steps:
[0055] In step S31, the reliability of the correction result is determined.
[0056] In step S32, in response to the credibility of the correction result, the correction amount of the second direction focus parameter is determined based on the current focus parameter in the first direction, the current focus parameter in the second direction, the current temperature, and the first model. The input of the first model is the temperature, the focus parameter in the first direction, and the focus parameter in the second direction, and the output is the correction amount of the second direction focus parameter.
[0057] In this embodiment, the focus parameter correction amount needs to be re-determined using different models depending on whether the correction result is reliable or unreliable. When the correction result is reliable, the focus parameter correction amount is re-determined using a first model. The first model can be a neural network model, a combined model, a relational learning model, etc., and this disclosure does not specifically limit its use. The inputs to the first model are the focus parameters in the first direction, the focus parameters in the second direction, and the temperature; the outputs are the focus parameter correction amounts in the first and second directions. However, the focus parameter correction amount output by the first model is the same as the input focus parameter correction amount in the first direction. Therefore, subsequent corrections are performed only using the focus parameter correction amount in the second direction output by the first model.
[0058] In step S33, in response to the case that the correction result is unreliable, the correction amount of the first direction focus parameter is determined based on the current focus parameter of the first direction, the current focus parameter of the second direction, the current temperature, and the second model, and the correction amount of the second direction focus parameter is re-determined. The input of the second model is the temperature, the first direction focus parameter, and the second direction focus parameter, and the output is the correction amount of the first direction focus parameter and the correction amount of the second direction focus parameter.
[0059] In this embodiment, the second model uses the same structure as the first model but sets different parameters. When the reliability of the correction result is deemed unreliable, a precise focus search is triggered, and the focus parameter correction amount is re-determined through the second model. The inputs to the second model are the focus parameters in the first direction, the focus parameters in the second direction, and the temperature; the outputs are the correction amounts for the focus parameters in the first and second directions. The correction amount for the focus parameters in the first direction output by the second model differs from the input correction amount. Therefore, the focus parameters in the first direction need to be corrected separately using the correction amount for the first direction, and the focus parameters in the second direction need to be corrected separately using the correction amount for the second direction.
[0060] Through the above embodiments, by using the first model or the second model to determine the focus parameter correction amount, the focus parameter correction amount in each direction at the current temperature is quickly obtained, so as to control the motor to find the standard focus position, thereby reducing the impact of the decrease in focus sharpness caused by optical distortion. This not only improves focus sharpness but also increases focus speed, which helps to improve the user experience.
[0061] It is understood that the first model and the second model can adopt the same structure, but since they are designed for cases where the correction results are reliable and cases where they are unreliable, respectively, the first model and the second model need to learn the corresponding parameter relationships using different training sets. The following embodiments of this disclosure further illustrate the training method of the first model of this disclosure.
[0062] In yet another embodiment, Figure 4 This is a flowchart illustrating a training method for a first model according to an exemplary embodiment. For example... Figure 4 As shown, the first model was trained in the following manner:
[0063] In step S41, the first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the amount of the first direction focus parameter correction, the temperature after correction, and the corrected second direction focus parameter are recorded to obtain the first training sample.
[0064] In this embodiment, historical samples that underwent phase detection autofocus can be corrected using either contrast detection autofocus (CDAF) or manual correction to obtain training samples; this disclosure does not impose specific limitations. Contrast detection autofocus refers to determining the optimal focus position by analyzing the contrast of an image. The camera moves the lens to gradually find the focus position that maximizes the image contrast, considering the highest contrast to indicate the highest sharpness. However, contrast detection autofocus is slower than phase detection autofocus, requiring continuous adjustment of the lens focal length to find the maximum contrast point. Therefore, contrast detection autofocus is used as the method for obtaining the first model training samples. After contrast detection autofocus, the corrected temperature is obtained as the temperature corresponding to the training sample. Since different temperatures significantly affect the phase detection autofocus results in different directions, and the electronic device has been processing the training sample for a period of time before and after correction, inevitably leading to temperature changes in the electronic device, continuing to use the temperature collected before correction no longer matches the correction amount of the focus parameters obtained after correction. Therefore, the temperature after correction is used as the temperature corresponding to the training sample. Since the first model is used to handle cases where the first-direction focus parameter correction result is reliable, the first training samples should also be samples with reliable first-direction focus parameter correction results. The first-direction focus parameter correction amount, the second-direction focus parameter, and the temperature after correction corresponding to the first training sample are used as inputs to the first model to be trained. The burned-in first-direction focus parameter correction amount is the focus parameter correction amount pre-written for different situations during the production of electronic devices. A reliable first-direction focus parameter correction result means that the burned-in first-direction focus parameter correction amount can offset the offset of the first-direction focus parameter, and no further adjustment is needed, thus selecting the first training sample.
[0065] In step S42, the model is trained based on the first training sample to predict and output the second direction focus parameter correction amount.
[0066] In step S43, the above model training process is repeated until the second direction focusing parameter correction amount of the predicted output satisfies the second convergence condition at the same corrected temperature, thus obtaining the first model.
[0067] In this embodiment, it is necessary to redetermine the correction amounts for different directional focusing parameters under different temperature conditions. Therefore, it is necessary to compare the redetermined second directional focusing parameter correction amounts at each same temperature. At the same temperature, when the second directional focusing parameter correction amount predicted by the first model satisfies the second convergence condition, it is considered that the first model has learned how to correct the first and second directional focusing parameters at the current temperature using the correct second directional focusing parameter correction amount. The second convergence condition is typically that the absolute value of the predicted output second directional focusing parameter correction amount is less than σ / 2, where σ represents the standard deviation. Alternatively, the absolute value of the predicted output second directional focusing parameter correction amount can be less than a fixed value as the second convergence condition; this disclosure does not impose specific limitations.
[0068] Through the above embodiments, by selecting reliable historical samples with corrected results as training samples and training the model to converge the second-direction focus parameter correction amount of the predicted output at the same temperature, the model can learn the relationship between focus parameter correction before and after different temperature conditions. This improves the model's adaptability to different temperatures, reduces the impact of temperature changes on phase focus sharpness, and enhances the user experience.
[0069] Understandably, the second model is used to handle cases where the correction results are unreliable. Therefore, it requires samples from the historical dataset that also have unreliable processing results, and it needs to ensure that the focus parameter correction amounts in both directions of the predicted output are correct. This is to reduce the image blurring caused by inconsistent phase detection results in different directions at various temperatures. The following embodiments further illustrate the training method of the first model of this disclosure.
[0070] In yet another embodiment, Figure 5 This is a flowchart illustrating a training method for a second model according to an exemplary embodiment. For example... Figure 5 As shown, the second model is trained in the following manner:
[0071] In step S51, the first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the temperature, the corrected first direction focus parameter and the corrected second direction focus parameter are recorded after the correction is completed to obtain the second training sample.
[0072] In this embodiment, historical samples with unreliable first-direction focus parameter correction results are obtained, along with corresponding first-direction and second-direction focus parameters. After correction, the corrected temperature, corrected first-direction focus parameters, and corrected second-direction focus parameters are used as second training samples. Since the first-direction focus parameter correction results are unreliable, the first-direction focus parameters, second-direction focus parameters, and corrected temperature are used as inputs to the second model to be trained. The focus parameter correction amounts for both the first and second directions need to be reconfirmed.
[0073] In step S52, the model is trained based on the second training sample to predict and output the first direction focus parameter correction amount and the second direction focus parameter correction amount.
[0074] In step S53, the above model training process is repeated until, at the same corrected temperature, the first direction focusing parameter correction amount of the predicted output satisfies the first convergence condition, and the second direction focusing parameter correction amount of the predicted output satisfies the second convergence condition, thus obtaining the second model.
[0075] In this embodiment, it is necessary to redetermine the correction values for different directional focusing parameters under different temperature conditions. Therefore, it is necessary to compare the second directional focusing parameter correction values redetermined at each of the same temperatures. At the same temperature, when the second directional focusing parameter correction value predicted by the second model satisfies the second convergence condition, the first directional focusing parameter correction value predicted by the second model also needs to satisfy the first convergence condition. Only when both the first and second convergence conditions are satisfied can it be considered that the second model has learned how to correct the first and second directional focusing parameters at the current temperature using the correct values for each direction. The second convergence condition is typically that the absolute value of the predicted second directional focusing parameter correction value is less than σ, where σ represents the standard deviation. Alternatively, the absolute value of the predicted first directional focusing parameter correction value can be less than a fixed value as the first convergence condition; this disclosure does not impose specific limitations.
[0076] Through the above embodiments, by selecting unreliable historical samples as training samples and training the model in a way that ensures the convergence of both the first and second direction focus parameter corrections under the same temperature, the model can learn the relationship between focus parameter corrections before and after different temperature conditions. This improves the model's adaptability to different temperatures, reduces the impact of temperature changes on phase focus sharpness, and enhances the user experience.
[0077] It is understandable that it is difficult to obtain samples of focus parameter correction values for all locations in a production environment, and inaccuracies in the focus parameter correction value burning process are unavoidable in module manufacturing. Therefore, it is necessary to continuously improve and optimize the model through practical applications to increase its effective range and promptly enhance its prediction accuracy. The following embodiments of this disclosure further illustrate the method for real-time model optimization during use.
[0078] In yet another embodiment, Figure 6 This is a flowchart illustrating online training of a model in practical use, according to an exemplary embodiment. For example... Figure 6 As shown, the model is trained online for practical use through the following steps:
[0079] In step S61, if the calibration result is deemed credible, it is determined that the first model does not exist, and the process proceeds to step S62; or if the calibration result is deemed uncredible, it is determined that the second model does not exist, and the process proceeds to step S65.
[0080] In step S62, the first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the amount of the first direction focus parameter correction, the temperature after correction, and the corrected second direction focus parameter are recorded to obtain the first training sample.
[0081] In step S63, the model is trained based on the first training sample to predict and output the second direction focus parameter correction amount.
[0082] In step S64, the above model training process is repeated until the second direction focusing parameter correction amount of the predicted output satisfies the second convergence condition at the same corrected temperature, thus obtaining the first model.
[0083] In step S65, the first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the temperature, the corrected first direction focus parameter and the corrected second direction focus parameter are recorded after the correction is completed to obtain the second training sample.
[0084] In step S66, model training is performed based on the second training samples to predict and output the first direction focus parameter correction amount and the second direction focus parameter correction amount.
[0085] In step S67, the above model training process is repeated until, at the same corrected temperature, the first direction focus parameter correction amount of the predicted output satisfies the first convergence condition, and the second direction focus parameter correction amount of the predicted output satisfies the second convergence condition, thus obtaining the second model.
[0086] In this embodiment of the disclosure, Figure 7This is a flowchart illustrating online training of a model in practical use, according to an exemplary embodiment. For example... Figure 7 As shown, after opening the camera and using automatic phase detection autofocus, taking the horizontal direction as the first direction and the vertical direction as the second direction as an example, the following steps are used to train the model online for actual use:
[0087] The reliability of the correction result for the first-direction focus parameter correction amount is determined by whether a precise focus search is triggered; conversely, the reliability is determined by whether a precise focus search is triggered. The camera module temperature, vertical focus parameters, and horizontal focus parameters are recorded after auto-phase focusing. The inverted focus parameters at the corresponding lens position can be used as the focus parameter correction amount.
[0088] When the horizontal focusing parameter correction result is deemed reliable, a first model exists. By inputting the focused camera module temperature, vertical focusing parameters, and horizontal focusing parameters into the first model, the second-direction focusing parameter correction amount is output.
[0089] If the correction result is deemed reliable, it indicates the absence of a first model. This signifies that in this round of focusing, the phase focusing result cannot be quickly adjusted by re-determining the correction amount of the focusing parameters. The phase focusing result of this round is then processed as the first training sample. The vertical and horizontal focusing parameters of this training sample are collected. Then, the first training sample is automatically corrected using a contrast focusing method, and the corrected temperature and the corrected second-direction focusing parameters are recorded. The vertical, horizontal, and corrected temperatures, as well as the corrected first and second-direction focusing parameters, are used together for model training. The vertical focusing parameter correction amount of the predicted output is recorded. After obtaining a sufficient number of first training samples at the same temperature T, the error of the vertical focusing parameter correction amount at the same temperature is calculated. When this error is less than the second convergence condition, training ends and the online training results are stored.
[0090] When the horizontal focus parameter correction result is deemed unreliable, a second model exists. By inputting the focused camera module temperature, vertical focus parameters, and horizontal focus parameters into the second model, the newly determined first and second direction focus parameter correction values are output.
[0091] When the calibration result is deemed unreliable, it is determined that a second model does not exist. This indicates that in this round of focusing, it is impossible to quickly adjust the phase focusing result by redetermining the focus parameter correction amount. The phase focusing result of this round is then processed as a second training sample. The vertical and horizontal focus parameters of this training sample are collected. Then, the contrast focusing method is used to automatically correct this second training sample, and the corrected temperature, corrected horizontal focus parameters, and corrected vertical focus parameters are recorded. The vertical, horizontal, and corrected focus parameters are used together for model training. The horizontal and vertical focus parameter correction amounts of the predicted output are recorded. After obtaining a sufficient number of second training samples at the same temperature T, the vertical and horizontal focus parameter correction errors at the same temperature are calculated. When the vertical focus parameter correction error is less than the second convergence condition and the horizontal focus parameter correction error is less than the first convergence condition, the training ends and the online training results are stored.
[0092] Through the above embodiments, by processing the data of automatic phase focusing in actual use into online training samples, the first model and the second model are trained online. As the usage increases, the focusing speed, accuracy and applicability will gradually improve, reducing the impact of inaccurate correction of the burning focus parameters and helping to improve the user experience.
[0093] Based on the same concept, embodiments of this disclosure also provide a focusing device.
[0094] It is understood that the focusing device provided in this disclosure includes hardware structures and / or software modules corresponding to each function in order to achieve the above-mentioned functions. In conjunction with the units and algorithm steps of the various examples disclosed in this disclosure, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solutions of this disclosure.
[0095] Figure 8 This is a block diagram illustrating a focusing device 100 according to an exemplary embodiment. (Refer to...) Figure 8 The device 100 includes a determination module 101, a processing module 102, and a correction module 103.
[0096] The determining module 101 is configured to correct the first direction focusing parameter based on the first direction focusing parameter correction amount and determine the reliability of the correction result. The reliability of the correction result includes whether the correction result is reliable or unreliable. A reliable correction result indicates that the focus sharpness meets the condition, and an unreliable correction result indicates that the focus sharpness does not meet the condition.
[0097] The processing module 102 is configured to redetermine the focus parameter correction amount based on the reliability of the correction result. If the correction result is reliable, the redetermined focus parameter correction amount includes the second direction focus parameter correction amount. If the correction result is unreliable, the redetermined focus parameter correction amount includes the second direction focus parameter correction amount and the redetermined first direction focus parameter correction amount.
[0098] The correction module 103 is configured to correct the second-direction focus parameters based on the redetermined focus parameter correction amount, or to correct the first-direction focus parameters and the second-direction focus parameters based on the redetermined focus parameter correction amount.
[0099] In one embodiment, the processing module 102 redetermines the focus parameter correction amount based on the reliability of the correction result in the following manner:
[0100] Determine the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature. Based on the reliability of the correction results, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature, redetermine the focus parameter correction amount.
[0101] Among them, the first direction focusing parameters, the second direction focusing parameters, and the current temperature have a corresponding relationship with the newly determined focusing parameter correction amount.
[0102] In one embodiment, the processing module 102 redetermines the focus parameter correction amount based on the reliability of the correction result, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature:
[0103] In response to the credibility of the correction result, the correction amount of the second direction focus parameter is determined based on the current focus parameter in the first direction, the current focus parameter in the second direction, the current temperature, and the first model. The input of the first model is the temperature, the focus parameter in the first direction and the focus parameter in the second direction, and the output is the correction amount of the second direction focus parameter.
[0104] In response to the case where the correction result is unreliable, the correction amount for the first direction focus parameter is determined based on the current focus parameter in the first direction, the current focus parameter in the second direction, the current temperature, and the second model, and the correction amount for the second direction focus parameter is re-determined. The input of the second model is the temperature, the first direction focus parameter, and the second direction focus parameter, and the output is the correction amount for the first direction focus parameter and the correction amount for the second direction focus parameter.
[0105] In one embodiment, the first model is trained in the following manner:
[0106] The first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the amount of first direction focus parameter correction, the temperature after correction and the corrected second direction focus parameter are recorded to obtain the first training sample.
[0107] The model is trained based on the first training sample, and the predicted output is the second direction focus parameter correction amount.
[0108] Repeat the above model training process until the second direction focusing parameter correction amount of the predicted output satisfies the second convergence condition at the same corrected temperature, and the first model is obtained.
[0109] In one embodiment, the second model is trained as follows:
[0110] The first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the temperature, the corrected first direction focus parameter and the corrected second direction focus parameter are recorded after the correction is completed to obtain the second training sample.
[0111] The model is trained based on the second training sample, and the predicted output is the first direction focus parameter correction amount and the second direction focus parameter correction amount.
[0112] Repeat the above model training process until, at the same corrected temperature, the first direction focus parameter correction amount of the predicted output satisfies the first convergence condition, and the second direction focus parameter correction amount of the predicted output satisfies the second convergence condition, thus obtaining the second model.
[0113] In one embodiment, the determining module 101 is further configured to:
[0114] In response to the assumption that the correction result is reliable, before performing the first-direction focus parameter correction and the second-direction focus parameter correction respectively, it is determined that the first model does not exist; or
[0115] If the calibration result is deemed unreliable, it is determined that a second model does not exist before performing calibration of the first and second direction focusing parameters, respectively.
[0116] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0117] Figure 9 This is a block diagram illustrating a focusing device 200 according to an exemplary embodiment. For example, device 200 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0118] Reference Figure 9 The device 200 may include one or more of the following components: processing component 202, memory 204, power component 206, multimedia component 208, audio component 210, input / output (I / O) interface 212, sensor component 214, and communication component 216.
[0119] Processing component 202 typically controls the overall operation of device 200, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 202 may include one or more processors 220 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 202 may include one or more modules to facilitate interaction between processing component 202 and other components. For example, processing component 202 may include a multimedia module to facilitate interaction between multimedia component 208 and processing component 202.
[0120] Memory 204 is configured to store various types of data to support the operation of device 200. Examples of such data include instructions for any application or method operating on device 200, contact data, phonebook data, messages, pictures, videos, etc. Memory 204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0121] The power supply component 206 provides power to the various components of the device 200. The power supply component 206 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device 200.
[0122] Multimedia component 208 includes a screen that provides an output interface between the device 200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 208 includes a front-facing camera and / or a rear-facing camera. When the device 200 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0123] Audio component 210 is configured to output and / or input audio signals. For example, audio component 210 includes a microphone (MIC) configured to receive external audio signals when device 200 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 204 or transmitted via communication component 216. In some embodiments, audio component 210 also includes a speaker for outputting audio signals.
[0124] I / O interface 212 provides an interface between processing component 202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0125] Sensor assembly 214 includes one or more sensors for providing status assessments of various aspects of device 200. For example, sensor assembly 214 may detect the on / off state of device 200, the relative positioning of components such as the display and keypad of device 200, changes in the position of device 200 or a component of device 200, the presence or absence of user contact with device 200, the orientation or acceleration / deceleration of device 200, and temperature changes of device 200. Sensor assembly 214 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 214 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0126] Communication component 216 is configured to facilitate wired or wireless communication between device 200 and other devices. Device 200 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 216 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 216 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0127] In an exemplary embodiment, the apparatus 200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0128] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 204 including instructions, which can be executed by a processor 220 of the device 200 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0129] Figure 10 This is a block diagram illustrating a focusing device 300 according to an exemplary embodiment. For example, device 300 may be provided as a server. (Refer to...) Figure 10 The device 300 includes a processing component 322, which further includes one or more processors, and memory resources represented by memory 332 for storing instructions, such as application programs, that can be executed by the processing component 322. The application programs stored in memory 332 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 322 is configured to execute instructions to perform the aforementioned focusing method.
[0130] Device 300 may also include a power supply component 326 configured to perform power management of device 300, a wired or wireless network interface 350 configured to connect device 300 to a network, and an input / output (I / O) interface 358. Device 300 may operate on an operating system stored in memory 332, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0131] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 332 including instructions, which can be executed by the processing component 322 of the device 300 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0132] It is understood that in this disclosure, "multiple" refers to two or more, and other quantifiers are similar. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. The singular forms "a," "the," and "the" are also intended to include the plural forms unless the context clearly indicates otherwise.
[0133] It is further understood that the terms "first," "second," etc., are used to describe various types of information, but this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another, and do not indicate a specific order or degree of importance. In fact, the expressions "first," "second," etc., are completely interchangeable. For example, without departing from the scope of this disclosure, first information can also be referred to as second information, and similarly, second information can also be referred to as first information.
[0134] It is further understood that although operations are described in a specific order in the accompanying drawings in the embodiments of this disclosure, this should not be construed as requiring these operations to be performed in the specific order or serial order shown, or requiring all of the shown operations to be performed to obtain the desired result. In certain environments, multitasking and parallel processing may be advantageous.
[0135] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein.
[0136] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A focusing method, characterized in that, include: The first direction focusing parameters are corrected based on the first direction focusing parameter correction amount, and the reliability of the correction result is determined. The reliability of the correction result includes whether the correction result is reliable or unreliable. The reliable correction result indicates that the focus sharpness meets the condition, and the unreliable correction result indicates that the focus sharpness does not meet the condition. Based on the reliability of the correction result, the focus parameter correction amount is re-determined. If the correction result is reliable, the re-determined focus parameter correction amount includes the second direction focus parameter correction amount; if the correction result is unreliable, the re-determined focus parameter correction amount includes the second direction focus parameter correction amount and the re-determined first direction focus parameter correction amount. The second-direction focus parameters are corrected based on the newly determined focus parameter correction amount, or the first-direction focus parameters and the second-direction focus parameters are corrected based on the newly determined focus parameter correction amount.
2. The focusing method according to claim 1, characterized in that, The step of re-determining the focus parameter correction amount based on the reliability of the correction result includes: Determine the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature. Based on the reliability of the correction results, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature, redetermine the focus parameter correction amount. Among them, the first direction focusing parameters, the second direction focusing parameters, and the current temperature have a corresponding relationship with the newly determined focusing parameter correction amount.
3. The focusing method according to claim 2, characterized in that, The step of re-determining the focus parameter correction amount based on the reliability of the correction result, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature includes: In response to the reliability of the correction result, the correction result is reliable. Based on the current focus parameters in the first direction, the current focus parameters in the second direction, the current temperature, and the first model, the correction amount of the focus parameters in the second direction is determined. The input of the first model is the temperature, the focus parameters in the first direction, and the focus parameters in the second direction, and the output is the correction amount of the focus parameters in the second direction. In response to the condition that the correction result is unreliable, based on the current focus parameters in the first direction, the current focus parameters in the second direction, the current temperature, and the second model, the correction amount for the focus parameters in the first direction is determined, and the correction amount for the focus parameters in the second direction is re-determined. The inputs of the second model are the temperature, the focus parameters in the first direction, and the focus parameters in the second direction, and the outputs are the correction amounts for the focus parameters in the first direction and the focus parameters in the second direction.
4. The focusing method according to claim 3, characterized in that, The first model was trained in the following manner: The first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the amount of first direction focus parameter correction, the temperature after correction and the corrected second direction focus parameter are recorded to obtain the first training sample. Based on the first training sample, the model is trained to predict and output the second direction focus parameter correction amount. Repeat the above model training process until the second direction focusing parameter correction amount of the predicted output satisfies the second convergence condition at the same corrected temperature, and the first model is obtained.
5. The focusing method according to claim 3, characterized in that, The second model was trained in the following manner: The first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the temperature, the corrected first direction focus parameter and the corrected second direction focus parameter are recorded after the correction is completed to obtain the second training sample. The model is trained based on the second training sample, and the first direction focus parameter correction amount and the second direction focus parameter correction amount are predicted and output. Repeat the above model training process until, at the same corrected temperature, the first direction focus parameter correction amount of the predicted output satisfies the first convergence condition, and the second direction focus parameter correction amount of the predicted output satisfies the second convergence condition, thus obtaining the second model.
6. The focusing method according to claim 4 or 5, characterized in that, Before performing the first-direction focus parameter correction and the second-direction focus parameter correction respectively, the method further includes: In response to the statement that the correction result is reliable, it is determined that the first model does not exist; or If the calibration result is deemed unreliable, it is determined that a second model does not exist.
7. A focusing device, characterized in that, include: The determination module is used to correct the first direction focus parameter based on the first direction focus parameter correction amount and determine the reliability of the correction result. The reliability of the correction result includes whether the correction result is reliable or unreliable. The reliable correction result indicates that the focus sharpness meets the condition, and the unreliable correction result indicates that the focus sharpness does not meet the condition. The processing module is used to redetermine the focus parameter correction amount based on the reliability of the correction result. If the correction result is reliable, the redetermined focus parameter correction amount includes the second direction focus parameter correction amount. If the correction result is unreliable, the redetermined focus parameter correction amount includes the second direction focus parameter correction amount and the redetermined first direction focus parameter correction amount. The correction module is used to correct the second-direction focus parameters based on the newly determined focus parameter correction amount, or to correct the first-direction focus parameters and the second-direction focus parameters based on the newly determined focus parameter correction amount.
8. The focusing device according to claim 7, characterized in that, The processing module re-determines the focus parameter correction amount based on the reliability of the correction result in the following manner: Determine the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature. Based on the reliability of the correction results, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature, redetermine the focus parameter correction amount. Among them, the first direction focusing parameters, the second direction focusing parameters, and the current temperature have a corresponding relationship with the newly determined focusing parameter correction amount.
9. The focusing device according to claim 8, characterized in that, The processing module redetermines the focus parameter correction amount based on the reliability of the correction result, the current focus parameters in the first direction, the current focus parameters in the second direction, and the current temperature in the following manner: In response to the reliability of the correction result, the correction result is reliable. Based on the current focus parameters in the first direction, the current focus parameters in the second direction, the current temperature, and the first model, the correction amount of the focus parameters in the second direction is determined. The input of the first model is the temperature, the focus parameters in the first direction, and the focus parameters in the second direction, and the output is the correction amount of the focus parameters in the second direction. In response to the condition that the correction result is unreliable, based on the current focus parameters in the first direction, the current focus parameters in the second direction, the current temperature, and the second model, the correction amount for the focus parameters in the first direction is determined, and the correction amount for the focus parameters in the second direction is re-determined. The inputs of the second model are the temperature, the focus parameters in the first direction, and the focus parameters in the second direction, and the outputs are the correction amounts for the focus parameters in the first direction and the focus parameters in the second direction.
10. The focusing device according to claim 9, characterized in that, The first model was trained in the following manner: The first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the amount of first direction focus parameter correction, the temperature after correction and the corrected second direction focus parameter are recorded to obtain the first training sample. Based on the first training sample, the model is trained to predict and output the second direction focus parameter correction amount. Repeat the above model training process until the second direction focusing parameter correction amount of the predicted output satisfies the second convergence condition at the same corrected temperature, and the first model is obtained.
11. The focusing device according to claim 9, characterized in that, The second model was trained in the following manner: The first direction focus parameter correction and the second direction focus parameter correction are performed respectively, and the temperature, the corrected first direction focus parameter and the corrected second direction focus parameter are recorded after the correction is completed to obtain the second training sample. The model is trained based on the second training sample, and the first direction focus parameter correction amount and the second direction focus parameter correction amount are predicted and output. Repeat the above model training process until, at the same corrected temperature, the first direction focus parameter correction amount of the predicted output satisfies the first convergence condition, and the second direction focus parameter correction amount of the predicted output satisfies the second convergence condition, thus obtaining the second model.
12. The focusing device according to claim 10 or 11, characterized in that, The determining module is also used for: In response to the condition that the correction result is reliable, before performing the first direction focus parameter correction and the second direction focus parameter correction respectively, it is determined that the first model does not exist; or In response to the condition that the correction result is unreliable, it is determined that there is no second model before performing the first direction focus parameter correction and the second direction focus parameter correction respectively.
13. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured as follows: Perform the focusing method according to any one of claims 1-6.
14. A storage medium, characterized in that, The storage medium stores instructions that, when executed by a processor, enable the focusing method described in any one of claims 1-6.