Magnetic control capsule endoscope positioning method, device, equipment, medium and product

By combining LM algorithm and EM algorithm, the position and attitude parameters of the magnetron capsule endoscope are iteratively optimized, and the differential magnetic field error and gradient Jacobian matrix are used to solve the problem of inaccurate positioning results in the existing technology and improve the magnetic field Control the positioning accuracy and efficiency of the capsule endoscope.

CN119257527AActive Publication Date: 2025-01-07INST OF ELECTRICAL ENG CHINESE ACAD OF SCI
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411159942.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2025-01-07
Estimated Expiration
2044-08-22

AI Technical Summary

Technical Problem

The positioning results of the existing magnetron capsule endoscopic positioning method are not accurate enough, especially when the external environment is disturbed greatly, resulting in low position and posture accuracy.

Method used

Iterative optimization of position and attitude parameters is performed by combining Levenberg-Marquardt (LM) algorithm and Expectation-Maximization (EM), and by calculating the error and gradient of the differential magnetic field. Matrix, gradually reduce the error until the preset error threshold or iteration number is reached, improving positioning accuracy.

Benefits of technology

It improves the accuracy and efficiency of magnetron capsule endoscope positioning, avoids the instability and overfitting of the algorithm, and can end iteration in a timely manner after meeting certain accuracy requirements to ensure the accuracy of the output results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119257527A_ABST
    Figure CN119257527A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of magnetic control capsule endoscope positioning, and discloses a magnetic control capsule endoscope positioning method, device, equipment, medium and product.The method comprises the steps that position parameters and posture parameters of a magnetic control capsule endoscope are initialized, a first objective function error is obtained according to the current position parameters and the current posture parameters, and the first objective function error is calculated; performing iterative optimization on the current position parameter based on the first objective function error to obtain an optimized position parameter, obtaining a second objective function error according to the optimized position parameter and the current attitude parameter, and performing iterative optimization on the current attitude parameter based on the second objective function error to obtain an optimized attitude parameter, when the overall iteration ending condition is met, the optimized position parameters and the optimized attitude parameters are output, the global optimal solution can be found easily, and the accuracy of the positioning result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of magnetically controlled capsule endoscope positioning, and in particular to a magnetically controlled capsule endoscope positioning method, device, equipment, medium and product. Background Art

[0002] Wireless capsule endoscope is a convenient, non-invasive and non-cross-infection diagnostic tool. It can only rely on its own gravity and intestinal peristalsis during the inspection process, resulting in a high missed detection rate and long inspection time. Therefore, the magnetically controlled capsule endoscope, which can be actively controlled by embedding permanent magnets, has become a current research hotspot. However, in order to achieve precise control and facilitate doctors to accurately identify the current lesion location, the real-time positioning function of the magnetically controlled capsule endoscope is particularly important. The magnetically controlled capsule endoscope contains permanent magnets as a component of magnetic control. When the battery life of the magnetically controlled capsule endoscope has been consumed, it is no longer possible to transmit information to the signal transmission device to identify whether the magnetically controlled capsule endoscope is retained in the body.

[0003] Magnetic positioning technology uses one or more permanent magnets as excitation sources, and the generated magnetic field can be measured by magnetic sensors. Through these signals, the position and direction of the magnet can be estimated. It is used for magnetically controlled capsule endoscope positioning due to its advantages of not being restricted by field of view and low cost. Since the magnetic field density of the permanent magnet detected by the sensor is at the same order of magnitude as the earth's magnetic field density, and the patient will not lie on the diagnosis and treatment bed for a long time during the examination, the positioning method that does not consider the influence of the external environment is not very practical.

[0004] In order to solve the position and attitude functions of magnetically controlled capsule endoscopes, some researchers use linear methods to calculate. Although the linear calculation speed is fast, the probability of facing local extreme values ​​is high, and the algorithm accuracy is often low. As a nonlinear algorithm, the Levenberg-Marquardt (LM) algorithm is used to solve the positioning algorithm because of its excellent solution speed and calculation accuracy. It relies on the guessing of the initial value. Due to the interference of the environment, the sensor is prone to initial value estimation errors, so the LM algorithm has a local optimal solution during the calculation process. Some researchers use the LM algorithm and the intelligent algorithm to conduct research, but the intelligent algorithm is prone to local solutions, and the magnetic field model based on integral calculation is also time-consuming. Some use machine learning methods for research, but machine learning algorithms are all prediction problems with limited output values, which cannot be widely applied to the arbitrary position of the magnetically controlled capsule endoscope and the estimation of the magnetic moment of the magnet, and the positioning results are not accurate enough. Summary of the invention

[0005] In view of this, the present invention provides a magnetically controlled capsule endoscope positioning method, device, equipment, medium and product to solve the technical problem that the positioning results of the existing magnetically controlled capsule endoscope positioning method are not accurate enough.

[0006] In the first aspect, the present invention provides a magnetically controlled capsule endoscope positioning method, including: initializing the position parameters and posture parameters of the magnetically controlled capsule endoscope; obtaining a first objective function error based on the current position parameters and the current posture parameters; iteratively optimizing the current position parameters based on the first objective function error to obtain the optimized position parameters; obtaining a second objective function error based on the optimized position parameters and the current posture parameters; iteratively optimizing the current posture parameters based on the second objective function error to obtain the optimized posture parameters; judging whether the overall iteration end condition is met, and when the overall iteration end condition is met, outputting the optimized position parameters and the optimized posture parameters, and when the overall iteration end condition is not met, re-optimizing the position parameters and the posture parameters.

[0007] A magnetically controlled capsule endoscope positioning method of the present invention obtains a first objective function error according to the current position parameter and the current posture parameter, iteratively optimizes the current position parameter based on the first objective function error to obtain the optimized position parameter, iteratively optimizes the position parameter under the premise that the current posture parameter is relatively accurate, after the iterative optimization of the position parameter obtains a local optimal solution, obtains a second objective function error according to the optimized position parameter and the current posture parameter, iteratively optimizes the current posture parameter based on the second objective function error to obtain the optimized posture parameter, thereby optimizing and calculating under the local optimal solution of the position parameter to obtain the local optimal solution of the posture parameter, and after multiple rounds of overall iterations, the position parameter and the posture parameter are iteratively optimized under their respective independent conditions, which is conducive to finding the global optimal solution and improving the accuracy of the positioning result.

[0008] Optionally, obtaining a first objective function error based on the current position parameters and the current attitude parameters includes: calculating a first calculated value of the differential magnetic field between two sensors based on the current position parameters and the current attitude parameters; and obtaining a first objective function error based on the first calculated value and an observed value of the differential magnetic field measured by the sensor.

[0009] By calculating the error between the calculated and observed values ​​of the differential magnetic field, a quantitative error evaluation is provided for the optimization of the position parameters, which helps to adjust the position parameters more accurately.

[0010] Optionally, iteratively optimizing the current position parameter based on the first objective function error to obtain the optimized position parameter includes: calculating a Jacobian matrix formed by the gradient of the position parameter based on the first objective function error; and iteratively optimizing the current position parameter based on the gradient of the position parameter using an LM algorithm, wherein the iterative formula of the position parameter is:

[0011]

[0012] Where a, b and c are the three-axis components of the position parameter, k is the number of iterations of the position parameter, and ee k is the first objective function error at the kth location parameter iteration, A ek is the Jacobian matrix formed by the gradient of the position parameters at the kth position parameter iteration, μ is the damping coefficient, and E is the unit matrix; it is determined whether the error of the first objective function is less than the first error threshold and whether the number of iterations of the position parameter is greater than or equal to the first preset number of iterations. When the error of the first objective function is less than the first error threshold or the number of iterations of the position parameter is greater than or equal to the first preset number of iterations, the position parameters obtained in the current iteration are used as the optimized position parameters. When the error of the first objective function is greater than or equal to the first error threshold and the number of iterations of the position parameter is less than the first preset number of iterations, the next round of position parameter iteration is entered.

[0013] The LM algorithm is used to iteratively optimize the position parameters, and the error is gradually reduced through the gradient descent method until the preset error threshold or number of iterations is reached, which improves the efficiency and accuracy of position parameter optimization. At the same time, the instability and overfitting of the algorithm are avoided by controlling the damping coefficient and the number of iterations.

[0014] Optionally, obtaining a second objective function error based on the optimized position parameters and the current posture parameters includes: calculating a second calculated value of the differential magnetic field between each pair of sensors based on the optimized position parameters and the current posture parameters; and obtaining a second objective function error based on the second calculated value and an observed value of the differential magnetic field measured by the sensor.

[0015] The second objective function error is updated based on the optimized position parameters, which provides a quantitative error evaluation for the optimization of the posture parameters and helps to adjust the posture parameters more accurately.

[0016] Optionally, iteratively optimizing the current posture parameters based on the second objective function error to obtain the optimized posture parameters includes: calculating a Jacobian matrix consisting of the gradients of the posture parameters based on the second objective function error; and iteratively optimizing the current posture parameters based on the gradients of the posture parameters using an LM algorithm, wherein the iterative formula of the posture parameters is:

[0017]

[0018] Where m, n and p are the three-axis components of the attitude parameter, l is the number of iterations of the attitude parameter, and em l is the second objective function error at the lth posture parameter iteration, A ml is the Jacobian matrix formed by the gradient of the posture parameters at the lth posture parameter iteration, μ is the damping coefficient, and E is the unit matrix; it is determined whether the second objective function error is less than the second error threshold and whether the number of posture parameter iterations is greater than or equal to the second preset number of iterations. When the second objective function error is less than the second error threshold or the number of posture parameter iterations is greater than or equal to the second preset number of iterations, the posture parameters obtained in the current iteration are used as the optimized posture parameters. When the second objective function error is greater than or equal to the second error threshold and the number of posture parameter iterations is less than the second preset number of iterations, the next round of posture parameter iteration is entered.

[0019] The LM algorithm is used to iteratively optimize the posture parameters, and the error is gradually reduced through the gradient descent method until the preset error threshold or number of iterations is reached, which improves the efficiency and accuracy of posture parameter optimization. At the same time, the instability and overfitting of the algorithm are avoided by controlling the damping coefficient and the number of iterations.

[0020] Optionally, before determining whether the overall iteration end condition is met, it also includes: calculating the overall target error based on the second objective function error; correspondingly, determining whether the overall iteration end condition is met, and when the overall iteration end condition is met, outputting the optimized position parameters and the optimized posture parameters; when the overall iteration end condition is not met, re-optimizing the position parameters and the posture parameters, including: determining whether the overall target error is less than a preset overall error threshold and whether the overall number of iterations is greater than or equal to a preset overall number of iterations, when the overall target error is less than the preset overall error threshold or the overall number of iterations is greater than or equal to the preset overall number of iterations, outputting the optimized position parameters and the optimized posture parameters, and when the overall target error is greater than or equal to the preset overall error threshold and the overall number of iterations is less than the preset overall number of iterations, re-optimizing the position parameters and the posture parameters.

[0021] The calculation and judgment of the overall target error helps to terminate the iteration in time after meeting certain accuracy requirements, improves the efficiency of the algorithm, ensures that the results can be output in time after the required accuracy is achieved, and avoids possible error accumulation caused by excessive iterations.

[0022] In a second aspect, the present invention provides a magnetically controlled capsule endoscope positioning device, comprising: an initialization module, for initializing the position parameters and posture parameters of the magnetically controlled capsule endoscope; a first error acquisition module, for acquiring a first objective function error based on the current position parameters and the current posture parameters; a position optimization module, for iteratively optimizing the current position parameters based on the first objective function error to obtain the optimized position parameters; a second error acquisition module, for acquiring a second objective function error based on the optimized position parameters and the current posture parameters; a posture optimization module, for iteratively optimizing the current posture parameters based on the second objective function error to obtain the optimized posture parameters; a parameter output module, for judging whether the overall iteration end condition is met, and outputting the optimized position parameters and the optimized posture parameters when the overall iteration end condition is met, and re-optimizing the position parameters and the posture parameters when the overall iteration end condition is not met.

[0023] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the magnetically controlled capsule endoscope positioning method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0024] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the magnetically controlled capsule endoscope positioning method of the first aspect or any corresponding embodiment thereof.

[0025] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the magnetically controlled capsule endoscope positioning method as described in the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 is a schematic diagram of the spatial position of a magnetically controlled capsule endoscope and a sensor according to an embodiment of the present invention;

[0028] Figure 2 is a schematic flow chart of a magnetically controlled capsule endoscope positioning method according to an embodiment of the present invention;

[0029] Figure 3 is a structural block diagram of a magnetically controlled capsule endoscope positioning device according to an embodiment of the present invention;

[0030] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0032] At present, in order to solve the position and posture function of the magnetically controlled capsule endoscope, relevant research has been conducted by combining the Levenberg-Marquardt (LM) algorithm with an intelligent algorithm, but the intelligent algorithm is prone to local solutions and the positioning results are not accurate enough. Based on this, the embodiment of the present invention introduces the expectation-maximization algorithm (EM algorithm). The EM algorithm is an iterative method for estimating model parameters. It calculates the expected value of the probability distribution of implicit variables through observation data, and then updates the model parameters based on the expected value. Therefore, the EM algorithm is introduced to iteratively calculate the expectation and maximization steps to improve the global optimal solution and improve the positioning accuracy.

[0033] It should be understood that a cylindrical permanent magnet is usually embedded in the magnetically controlled capsule endoscope, which is located at P ce (a,b,c). Figure 1 As shown, it is assumed that the magnetically controlled capsule endoscope and the sensor P se (x i ,y i ,z i ) is much larger than the geometric size of the magnet, then the magnetically controlled capsule endoscope is at position P se (x i ,y i ,z i ) produces a magnetic field B iIt can be represented by a dipole model:

[0034]

[0035] in, is the position vector of the magnetically controlled capsule endoscope and the sensor i=1,2,…, N is the number of sensors is the unit vector of the permanent magnet's magnetization direction; its k, L, M T are the radius, length and magnetization of the permanent magnet, μ 0 is the vacuum permeability,

[0036] According to formula (1), the three-axis components calculated at the sensor can be expressed as:

[0037]

[0038] Among them, the constraint of the three-dimensional vector of the magnetic field direction of the magnet is:

[0039] m 2 +n 2 +p 2 =1(5)

[0040] According to equations (2)-(5), the position parameters (a, b, c) and attitude parameters (m, n, p) can be solved.

[0041] For magnetic positioning, in order to improve the accuracy of the system, it is usually necessary to obtain a large amount of data. Multiple sensors can be used to form an array to measure the data. Assuming that N sensors are used to measure the data, according to the magnetic positioning equations, the set of sensor position points and data can be expressed as: {(x i ,y i ,z i ),(B ix ,B iy ,B iz ),i=1,2,…,N, the positioning system function is:

[0042]

[0043]

[0044] This is a nonlinear least squares problem, so the positioning problem of the magnetically controlled capsule endoscope can be transformed into a nonlinear optimization problem. We use the optimization algorithm to find the appropriate parameters (a, b, c) and (m, n, p) to minimize the target error.

[0045]

[0046] In order to solve the parameters (a, b, c) and (m, n, p), the embodiment of the present invention adopts an optimization algorithm combining the LM algorithm and the EM algorithm to estimate the position and direction of the magnetically controlled capsule endoscope by minimizing the error function.

[0047] The LM algorithm is an optimization algorithm for nonlinear least squares problems. It combines the advantages of Newton's method and gradient descent method, and its formula is as follows:

[0048]

[0049] Among them, A k is the Jacobian matrix of the error function at the kth iteration, μ is the damping coefficient, E is the identity matrix, e k is the error at the kth iteration.

[0050] The EM algorithm is an iterative method for estimating model parameters. It calculates the expected value of the probability distribution of the implicit variable through observation data, and then updates the model parameters based on the expected value. It iterates through cycles until a stable state is reached.

[0051] It first calculates the current parameter estimate θ (t) The expected value of the hidden variable under .

[0052]

[0053] Among them, X is the observed data, Z is the hidden variable, and θ is the parameter.

[0054] Then the corresponding parameters are obtained by maximizing the likelihood function.

[0055] θ (t+1) =argmax(θ|θ (t) ) (11)

[0056] Formula (11) indicates that under the condition of the last iteration result t, the current maximum expectation is estimated and the result of t+1 is calculated.

[0057] The embodiment of the present invention combines the LM algorithm and the EM algorithm to provide an embodiment of a magnetically controlled capsule endoscope positioning method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0058] In this embodiment, a magnetically controlled capsule endoscope positioning method is provided, which can be used in mobile terminals, such as mobile phones, computers, etc. Figure 2 As shown, the process includes the following steps:

[0059] Step S201, initializing the position parameters and posture parameters of the magnetically controlled capsule endoscope.

[0060] Specifically, before optimization, the initial values ​​of the position parameters (a, b, c) and the posture parameters (m, n, p) are set. The initial value can be a random value or a pre-set relatively accurate value. The subsequent optimization process is optimized and iterated based on the initial value.

[0061] Step S202, obtaining a first objective function error according to the current position parameter and the current posture parameter.

[0062] Specifically, the first objective function error is the difference between the calculated value of the magnetic field component between two sensors calculated according to the current position parameter and the current posture parameter and the magnetic field component detected by the sensor.

[0063] The magnetic field component is denoted as B ijk , the subscript ij represents sensor i and sensor j, and the subscript k represents that there are three magnetic field component values.

[0064] Step S203, iteratively optimizing the current position parameters based on the first objective function error to obtain optimized position parameters.

[0065] Specifically, step S202 and step S203 are equivalent to step E in the EM algorithm, which assumes that the current posture parameters are relatively accurate. At this time, the posture parameters are equivalent to the parameters θ in the EM algorithm, and the position parameters are equivalent to the hidden variable Z. The magnetic field components between the two sensors calculated according to the current position parameters and the current posture parameters are the observed values ​​of the parameter X, and the magnetic field components detected by the sensors are the true values ​​of the parameter X. According to the difference between the two, that is, the first objective function error, the position parameters are iteratively optimized to learn the hidden variables, that is, the position parameters (a, b, c), and the position parameters with the minimum error of the first objective function under the current posture parameters are obtained, that is, the local optimal solution of the maximum expected value at the current time is obtained.

[0066] Step S204, obtaining a second objective function error according to the optimized position parameters and the current posture parameters.

[0067] Specifically, the second objective function error is the difference between the calculated value of the magnetic field component between the two sensors calculated according to the position parameter optimized in step S203 and the current posture parameter and the magnetic field component detected by the sensor.

[0068] Step S205, iteratively optimizing the current posture parameters based on the second objective function error to obtain optimized posture parameters.

[0069] Specifically, step S204 and step S205 are equivalent to step M in the EM algorithm, which assumes that the position parameters are relatively accurate. At this time, the position parameters are equivalent to parameter θ in the EM algorithm. The magnetic field components between the two sensors calculated according to the optimized position parameters and the current posture parameters are the observed values ​​of parameter X, and the magnetic field components detected by the sensors are the true values ​​of parameter X. The posture parameters are iteratively optimized according to the difference between the two, that is, the second objective function error, to obtain the posture parameters with the smallest second objective function error under the position parameters after this round of optimization, and to obtain the optimal solution of the posture parameters under the local optimal solution of the position parameters.

[0070] Step S206, determining whether the overall iteration end condition is met, when the overall iteration end condition is met, outputting the optimized position parameters and the optimized posture parameters, when the overall iteration end condition is not met, re-optimizing the position parameters and the posture parameters.

[0071] In one example, the overall iteration termination condition is that the overall target error is less than a preset overall error threshold, or the overall iteration number is greater than or equal to a preset overall iteration number.

[0072] After multiple rounds of EM iterations until the overall iteration end condition is met, the optimal solution for the position parameters and attitude parameters is obtained.

[0073] A magnetically controlled capsule endoscope positioning method according to an embodiment of the present invention obtains a first objective function error according to a current position parameter and a current posture parameter, iteratively optimizes the current position parameter based on the first objective function error to obtain an optimized position parameter, iteratively optimizes the position parameter under the premise that the current posture parameter is relatively accurate, and after the iterative optimization of the position parameter obtains a local optimal solution, obtains a second objective function error according to the optimized position parameter and the current posture parameter, iteratively optimizes the current posture parameter based on the second objective function error to obtain the optimized posture parameter, thereby optimizing and calculating under the local optimal solution of the position parameter to obtain the local optimal solution of the posture parameter, and after multiple rounds of overall iterations, the position parameter and the posture parameter are iteratively optimized under their respective independent conditions, which is conducive to finding the global optimal solution and improving the accuracy of the positioning result.

[0074] In some embodiments, step S202, obtaining a first objective function error according to a current position parameter and a current posture parameter, includes:

[0075] Step S2021, calculating a first calculated value of a differential magnetic field between two sensors according to the current position parameter and the current posture parameter.

[0076] Specifically, the current position parameter and the current posture parameter are substituted into formula (1) to calculate the magnetic field corresponding to each sensor position, and then the magnetic fields corresponding to the two sensors are subtracted to obtain the differential magnetic field, that is, the first calculated value.

[0077] Step S2022: Obtain a first objective function error according to the first calculated value and the observation value of the differential magnetic field measured by the sensor.

[0078] Specifically, in order to improve the calculation accuracy, the number of sensors can be set to be multiple. For example, if the number of sensors is set to 4, then there are 6 corresponding differential magnetic fields, and the above-mentioned first calculated values ​​and observed values ​​also correspond to 6. The squares of the differences between each first calculated value and the corresponding observed value are added to obtain the first objective function error.

[0079] The embodiment of the present invention provides a quantitative error evaluation for the optimization of the position parameters by calculating the error between the calculated value and the observed value of the differential magnetic field, which helps to adjust the position parameters more accurately.

[0080] Further, step S203, iteratively optimizing the current position parameter based on the first objective function error to obtain the optimized position parameter, includes:

[0081] Step S2031, based on the first objective function error, the Jacobian matrix composed of the gradient of the position parameters is calculated. Specifically, the Jacobian matrix A composed of the gradient of the position parameters is ek for:

[0082]

[0083] Jacobian matrix A ek Three gradients including position parameters and

[0084] Step S2032, using the LM algorithm, iteratively optimize the current position parameter based on the gradient of the position parameter, wherein the iterative formula of the position parameter is:

[0085]

[0086] Where a, b and c are the three-axis components of the position parameter, k is the number of iterations of the position parameter, and ee k is the first objective function error at the kth location parameter iteration, A ek is the Jacobian matrix formed by the gradient of the position parameters at the kth position parameter iteration, μ is the damping coefficient, and E is the unit matrix;

[0087] Step S2033, determine whether the first objective function error is less than the first error threshold and whether the number of position parameter iterations is greater than or equal to the first preset number of iterations. When the first objective function error is less than the first error threshold or the number of position parameter iterations is greater than or equal to the first preset number of iterations, use the position parameters obtained in the current iteration as the optimized position parameters. When the first objective function error is greater than or equal to the first error threshold and the number of position parameter iterations is less than the first preset number of iterations, enter the next round of position parameter iterations.

[0088] Specifically, the first preset number of iterations and the first error threshold can be set according to actual conditions, and are determined and input before performing iterative optimization.

[0089] The embodiment of the present invention adopts the LM algorithm to iteratively optimize the position parameters, and gradually reduces the error through the gradient descent method until a preset error threshold or number of iterations is reached, thereby improving the efficiency and accuracy of the position parameter optimization. At the same time, by controlling the damping coefficient and the number of iterations, the instability and overfitting of the algorithm are avoided.

[0090] In some embodiments, step S204, obtaining a second objective function error according to the optimized position parameter and the current posture parameter, includes:

[0091] Step S2041, calculating a second calculated value of the differential magnetic field between the two sensors according to the optimized position parameter and the current posture parameter.

[0092] Specifically, the optimized position parameters and the current posture parameters are substituted into formula (1) to calculate the magnetic field corresponding to each sensor position, and then the magnetic fields corresponding to the two sensors are subtracted to obtain the differential magnetic field, i.e., the second calculated value.

[0093] Step S2042: Obtain a second objective function error according to the second calculated value and the observation value of the differential magnetic field measured by the sensor.

[0094] The squares of the differences between each second calculated value and the corresponding observed value are added together to obtain the first objective function error.

[0095] The second objective function error is updated based on the optimized position parameters, which provides a quantitative error evaluation for the optimization of the posture parameters and helps to adjust the posture parameters more accurately.

[0096] Further, step S205, iteratively optimizing the current posture parameters based on the second objective function error to obtain optimized posture parameters, includes:

[0097] Step S205, calculating the Jacobian matrix formed by the gradient of the posture parameters based on the second objective function error.

[0098] Specifically, the Jacobian matrix A formed by the gradient of the posture parameters ml for:

[0099]

[0100] It is mainly composed of three gradients of posture parameters and constitute.

[0101] Step S205, using the LM algorithm, iteratively optimize the current posture parameters based on the gradient of the posture parameters, wherein the iterative formula of the posture parameters is:

[0102]

[0103] Where m, n and p are the three-axis components of the attitude parameters, l is the number of iterations of the attitude parameters, and em l is the second objective function error at the lth posture parameter iteration, A ml is the Jacobian matrix formed by the gradient of the posture parameters at the lth posture parameter iteration, μ is the damping coefficient, and E is the unit matrix.

[0104] Step S205, determine whether the second objective function error is less than the second error threshold and whether the number of posture parameter iterations is greater than or equal to the second preset number of iterations. When the second objective function error is less than the second error threshold or the number of posture parameter iterations is greater than or equal to the second preset number of iterations, use the posture parameters obtained in the current iteration as the optimized posture parameters. When the second objective function error is greater than or equal to the second error threshold and the number of posture parameter iterations is less than the second preset number of iterations, enter the next round of posture parameter iteration.

[0105] Specifically, the second preset number of iterations and the second error threshold can be set according to actual conditions, and determined and input before performing iterative optimization.

[0106] The embodiment of the present invention adopts the LM algorithm to iteratively optimize the posture parameters, and gradually reduces the error through the gradient descent method until a preset error threshold or number of iterations is reached, thereby improving the efficiency and accuracy of the posture parameter optimization. At the same time, by controlling the damping coefficient and the number of iterations, the instability and overfitting of the algorithm are avoided.

[0107] In some embodiments, before determining whether the overall iteration end condition is met, the process further includes:

[0108] The overall objective error is calculated based on the second objective function error.

[0109] In one example, the overall target error is:

[0110] e i =|em i-e i-1 | / |e i-1 |

[0111] In the formula, e i is the overall target error after the i-th round of iteration, em i is the second objective function error after the i-th round of overall iteration, e i-1 is the overall target error after the i-1th round of overall iteration. The initial value of the overall target error can be set to a larger value.

[0112] Correspondingly, step S205 determines whether the overall iteration end condition is met. When the overall iteration end condition is met, the optimized position parameters and the optimized posture parameters are output. When the overall iteration end condition is not met, the position parameters and the posture parameters are optimized again, including:

[0113] Determine whether the overall target error is less than the preset overall error threshold and whether the overall number of iterations is greater than or equal to the preset overall number of iterations. When the overall target error is less than the preset overall error threshold or the overall number of iterations is greater than or equal to the preset overall number of iterations, output the optimized position parameters and the optimized posture parameters. When the overall target error is greater than or equal to the preset overall error threshold and the overall number of iterations is less than the preset overall number of iterations, re-optimize the position parameters and posture parameters.

[0114] The preset overall error threshold and the overall number of iterations can be set according to actual conditions and determined and input before performing iterative optimization.

[0115] The calculation and judgment of the overall target error helps to terminate the iteration in time after meeting certain accuracy requirements, improves the efficiency of the algorithm, ensures that the results can be output in time after the required accuracy is achieved, and avoids possible error accumulation caused by excessive iterations.

[0116] A magnetically controlled capsule endoscope positioning method according to an embodiment of the present invention combines the EM algorithm and the LM algorithm to optimize the position parameters and the posture parameters. Taking the setting of four sensors as an example, compared with the LM algorithm, the calculation results of the position error and the angle error are as follows:

[0117]

[0118] It can be seen from the above table that, compared with the existing LM algorithm, the magnetically controlled capsule endoscope positioning method of the embodiment of the present invention is conducive to finding the global optimal solution, reducing the positioning position error and angle error, and improving the positioning precision and accuracy.

[0119] The embodiment of the present invention also provides a magnetically controlled capsule endoscope positioning device, such as Figure 3 As shown, including:

[0120] Initialization module 301, initializing position parameters and posture parameters of the magnetically controlled capsule endoscope;

[0121] A first error acquisition module 302, used to acquire a first objective function error according to a current position parameter and a current posture parameter;

[0122] A position optimization module 303, configured to iteratively optimize the current position parameters based on the first objective function error to obtain optimized position parameters;

[0123] A second error acquisition module 304, used to acquire a second objective function error according to the optimized position parameters and the current posture parameters;

[0124] A posture optimization module 305 is used to iteratively optimize the current posture parameters based on the second objective function error to obtain optimized posture parameters;

[0125] The parameter output module 306 is used to determine whether the overall iteration end condition is met. When the overall iteration end condition is met, the optimized position parameters and optimized posture parameters are output. When the overall iteration end condition is not met, the position parameters and posture parameters are re-optimized.

[0126] The magnetically controlled capsule endoscope positioning device of the embodiment of the present invention obtains a first objective function error according to the current position parameter and the current posture parameter, iteratively optimizes the current position parameter based on the first objective function error to obtain an optimized position parameter, iteratively optimizes the position parameter under the premise that the current posture parameter is relatively accurate, and after the iterative optimization of the position parameter obtains a local optimal solution, obtains a second objective function error according to the optimized position parameter and the current posture parameter, iteratively optimizes the current posture parameter based on the second objective function error to obtain the optimized posture parameter, thereby optimizing and calculating under the local optimal solution of the position parameter to obtain the local optimal solution of the posture parameter, and after multiple rounds of overall iterations, the position parameter and the posture parameter are iteratively optimized under their respective independent conditions, which is conducive to finding the global optimal solution and improving the accuracy of the positioning result.

[0127] Further, the first error acquisition module 302 includes:

[0128] A first calculation value acquisition module, used for calculating a first calculation value of a differential magnetic field between two sensors according to a current position parameter and a current posture parameter;

[0129] The first error calculation module is used to obtain a first objective function error according to the first calculated value and the observation value of the differential magnetic field measured by the sensor.

[0130] Furthermore, the location optimization module 303 includes:

[0131] A first matrix calculation module, used for calculating a Jacobian matrix composed of the gradient of the position parameter based on the first objective function error;

[0132] The position iteration module is used to iteratively optimize the current position parameters based on the gradient of the position parameters using the LM algorithm, where the iteration formula of the position parameters is:

[0133]

[0134] Where a, b and c are the three-axis components of the position parameter, k is the number of iterations of the position parameter, and ee k is the first objective function error at the kth location parameter iteration, A ek is the Jacobian matrix formed by the gradient of the position parameters at the kth position parameter iteration, μ is the damping coefficient, and E is the unit matrix;

[0135] The position parameter output module is used to determine whether the first objective function error is less than the first error threshold and whether the number of position parameter iterations is greater than or equal to the first preset number of iterations. When the first objective function error is less than the first error threshold or the number of position parameter iterations is greater than or equal to the first preset number of iterations, the position parameters obtained in the current iteration are used as the optimized position parameters. When the first objective function error is greater than or equal to the first error threshold and the number of position parameter iterations is less than the first preset number of iterations, the next round of position parameter iteration is entered.

[0136] Further, the second error acquisition module 304 includes:

[0137] A second error calculation module, used for calculating a second calculated value of a differential magnetic field between two sensors according to the optimized position parameters and the current posture parameters;

[0138] The second matrix calculation module is used to obtain a second objective function error according to the second calculated value and the observation value of the differential magnetic field measured by the sensor.

[0139] Further, the posture optimization module 305 includes:

[0140] A second matrix calculation module, used for calculating the Jacobian matrix composed of the gradient of the posture parameters based on the second objective function error;

[0141] The posture iteration module is used to iteratively optimize the current posture parameters based on the gradient of the posture parameters using the LM algorithm, where the iteration formula of the posture parameters is:

[0142]

[0143] Where m, n and p are the three-axis components of the attitude parameters, l is the number of iterations of the attitude parameters, and eml is the second objective function error at the lth posture parameter iteration, A ml is the Jacobian matrix formed by the gradient of the attitude parameters at the lth attitude parameter iteration, μ is the damping coefficient, and E is the unit matrix;

[0144] The posture parameter output module is used to determine whether the second objective function error is less than the second error threshold and whether the number of posture parameter iterations is greater than or equal to the second preset number of iterations. When the second objective function error is less than the second error threshold or the number of posture parameter iterations is greater than or equal to the second preset number of iterations, the posture parameters obtained in the current iteration are used as the optimized posture parameters. When the second objective function error is greater than or equal to the second error threshold and the number of posture parameter iterations is less than the second preset number of iterations, the next round of posture parameter iteration is entered.

[0145] Furthermore, before judging whether the overall iteration termination condition is met, the method further includes: calculating the overall target error according to the second target function error.

[0146] Correspondingly, the parameter output module 306 is also used to determine whether the overall target error is less than a preset overall error threshold and whether the overall number of iterations is greater than or equal to a preset overall number of iterations. When the overall target error is less than the preset overall error threshold or the overall number of iterations is greater than or equal to the preset overall number of iterations, the optimized position parameters and the optimized posture parameters are output. When the overall target error is greater than or equal to the preset overall error threshold and the overall number of iterations is less than the preset overall number of iterations, the position parameters and posture parameters are re-optimized.

[0147] The embodiment of the present invention also provides a schematic diagram of the structure of a computer device, such as Figure 4 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.

[0148] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0149] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0150] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0151] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0152] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0153] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0154] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0155] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0156] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope of protection.

Claims

1. A magnetically controlled capsule endoscope positioning method, characterized in that: include: Initialize the position parameters and posture parameters of the magnetically controlled capsule endoscope; Acquire a first objective function error according to the current position parameter and the current posture parameter; Iteratively optimizing the current position parameter based on the first objective function error to obtain the optimized position parameter; Obtaining a second objective function error according to the optimized position parameter and the current posture parameter; Iteratively optimizing the current posture parameters based on the second objective function error to obtain the optimized posture parameters; Determine whether the overall iteration end condition is met. When the overall iteration end condition is met, output the optimized position parameters and the optimized posture parameters. When the overall iteration end condition is not met, re-optimize the position parameters and the posture parameters.

2. The magnetically controlled capsule endoscope positioning method according to claim 1, characterized in that: Obtaining a first objective function error according to the current position parameter and the current posture parameter includes: Calculate a first calculated value of a differential magnetic field between two sensors according to the current position parameter and the current posture parameter; A first objective function error is obtained according to the first calculated value and an observed value of the differential magnetic field measured by the sensor.

3. The magnetically controlled capsule endoscope positioning method according to claim 1, characterized in that: Iteratively optimizing the current position parameter based on the first objective function error to obtain the optimized position parameter includes: Calculate a Jacobian matrix consisting of the gradient of the position parameter based on the first objective function error; The LM algorithm is used to iteratively optimize the current position parameter based on the gradient of the position parameter, wherein the iterative formula of the position parameter is: Where a, b and c are the three-axis components of the position parameter, k is the number of iterations of the position parameter, and ee k is the first objective function error at the kth location parameter iteration, A ek is the Jacobian matrix formed by the gradient of the position parameter at the kth position parameter iteration, μ is the damping coefficient, and E is the unit matrix; Determine whether the first objective function error is less than the first error threshold and whether the number of position parameter iterations is greater than or equal to the first preset number of iterations. When the first objective function error is less than the first error threshold or the number of position parameter iterations is greater than or equal to the first preset number of iterations, use the position parameters obtained in the current iteration as the optimized position parameters. When the first objective function error is greater than or equal to the first error threshold and the number of position parameter iterations is less than the first preset number of iterations, enter the next round of position parameter iteration.

4. The magnetically controlled capsule endoscope positioning method according to claim 1, characterized in that: Obtaining a second objective function error according to the optimized position parameter and the current posture parameter, including: Calculate a second calculated value of the differential magnetic field between two sensors according to the optimized position parameter and the current posture parameter; A second objective function error is obtained according to the second calculated value and the observed value of the differential magnetic field measured by the sensor.

5. The magnetically controlled capsule endoscope positioning method according to claim 1, characterized in that: Iteratively optimizing the current posture parameter based on the second objective function error to obtain the optimized posture parameter includes: Calculate a Jacobian matrix consisting of the gradients of the posture parameters based on the second objective function error; The LM algorithm is used to iteratively optimize the current posture parameters based on the gradient of the posture parameters, wherein the iterative formula of the posture parameters is: Where m, n and p are the three-axis components of the attitude parameter, l is the number of iterations of the attitude parameter, and em l is the second objective function error at the lth posture parameter iteration, A ml is the Jacobian matrix formed by the gradient of the posture parameters at the lth posture parameter iteration, μ is the damping coefficient, and E is the unit matrix; Determine whether the second objective function error is less than the second error threshold and whether the number of posture parameter iterations is greater than or equal to the second preset number of iterations. When the second objective function error is less than the second error threshold or the number of posture parameter iterations is greater than or equal to the second preset number of iterations, use the posture parameters obtained in the current iteration as the optimized posture parameters. When the second objective function error is greater than or equal to the second error threshold and the number of posture parameter iterations is less than the second preset number of iterations, enter the next round of posture parameter iteration.

6. The magnetically controlled capsule endoscope positioning method according to claim 1, characterized in that: Before judging whether the overall iteration end condition is met, it also includes: Calculate the overall objective error according to the second objective function error; Correspondingly, judging whether the overall iteration end condition is met, and when the overall iteration end condition is met, outputting the optimized position parameters and the optimized posture parameters, and when the overall iteration end condition is not met, re-optimizing the position parameters and the posture parameters, including: Determine whether the overall target error is less than a preset overall error threshold and whether the overall number of iterations is greater than or equal to a preset overall number of iterations. When the overall target error is less than the preset overall error threshold or the overall number of iterations is greater than or equal to the preset overall number of iterations, output the optimized position parameters and the optimized posture parameters. When the overall target error is greater than or equal to the preset overall error threshold and the overall number of iterations is less than the preset overall number of iterations, re-optimize the position parameters and the posture parameters.

7. A magnetically controlled capsule endoscope positioning device, characterized in that: include: An initialization module is used to initialize the position parameters and posture parameters of the magnetically controlled capsule endoscope; A first error acquisition module, used for acquiring a first objective function error according to the current position parameter and the current posture parameter; A position optimization module, used for iteratively optimizing the current position parameter based on the first objective function error to obtain the optimized position parameter; A second error acquisition module, used for acquiring a second objective function error according to the optimized position parameter and the current posture parameter; A posture optimization module, used for iteratively optimizing the current posture parameters based on the second objective function error to obtain the optimized posture parameters; The parameter output module is used to determine whether the overall iteration end condition is met. When the overall iteration end condition is met, the optimized position parameters and the optimized posture parameters are output. When the overall iteration end condition is not met, the position parameters and the posture parameters are re-optimized.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the magnetically controlled capsule endoscope positioning method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the magnetically controlled capsule endoscope positioning method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the magnetically controlled capsule endoscope positioning method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Motion control method and device of capsule endoscope and terminal equipment

    CN109044250A

  • Capsule endoscope real-time positioning method based on differential signals

    CN111956171A

  • Wireless capsule endoscope positioning method and apparatus, and terminal equipment

    CN112515611A

  • Capsule endoscope positioning method, system and device and storage medium

    CN114469058A

  • Positioning method, system and equipment for capsule endoscope and medium

    CN118078250A