A magnetic capsule endoscope positioning method, device, equipment, medium and product

By combining the LM and EM algorithms to optimize the position and posture parameters of the magnetically controlled capsule endoscope, and using the differential magnetic field error evaluation and gradient descent method, the problem of inaccurate positioning of the magnetically controlled capsule endoscope was solved, and a higher precision positioning effect was achieved.

CN119257527BActive Publication Date: 2025-10-24INST OF ELECTRICAL ENG CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The positioning results of existing magnetically controlled capsule endoscope positioning methods are not accurate enough, especially under interference from the external environment, making it difficult to achieve precise control and identification of lesion locations.

Method used

An optimization method combining the Levenberg-Marquardt (LM) algorithm and the expectation-maximization (EM) algorithm is adopted. By iteratively optimizing the position and attitude parameters, the position and attitude parameters are gradually adjusted to improve the positioning accuracy by using the error evaluation of the differential magnetic field and the gradient descent method.

Benefits of technology

The positioning accuracy of the magnetically controlled capsule endoscope is improved, the positioning error and angle error are reduced, and precise positioning is ensured under interference from the external environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119257527B_ABST
    Figure CN119257527B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of magnetic capsule endoscope positioning, and discloses a magnetic capsule endoscope positioning method, device, equipment, medium and product, the method comprising the following steps: initializing position parameters and attitude parameters of a magnetic capsule endoscope; obtaining a first target function error according to the current position parameters and the current attitude parameters; iteratively optimizing the current position parameters based on the first target function error to obtain optimized position parameters; obtaining a second target function error according to the optimized position parameters and the current attitude parameters; iteratively optimizing the current attitude parameters based on the second target function error to obtain optimized attitude parameters; and outputting the optimized position parameters and the optimized attitude parameters when the overall iteration end condition is met. The embodiment of the application is beneficial to finding a global optimal solution and improving the accuracy of the positioning result.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of magnetic capsule endoscope positioning, in particular to a magnetic capsule endoscope positioning method, device, equipment, medium and product. BACKGROUND

[0002] Wireless capsule endoscopy is a convenient, non-invasive and non-cross infection diagnostic tool. It can only rely on its own gravity and intestinal peristalsis movement during the examination process, resulting in high missed detection rate and long examination time. Therefore, the magnetic capsule endoscope with embedded permanent magnet for active control has become a current research hotspot. However, in order to achieve precise control and facilitate doctors to accurately identify the current lesion position, the real-time positioning function of the magnetic capsule endoscope is particularly important. The magnetic capsule endoscope contains a permanent magnet as a component of the magnetic control. When the battery life of the magnetic capsule endoscope has been consumed, and it is unable to transmit information to the signal transmission device again to identify whether the magnetic capsule endoscope is retained in the body.

[0003] The magnetic positioning technology uses one or more permanent magnets as an excitation source, and the generated magnetic field can be measured by a magnetic sensor. Through these signals, the position and direction of the magnet can be estimated, which is used for magnetic capsule endoscope positioning due to its advantages of not being limited by the field of view and low cost. Since the magnetic field density detected by the sensor and the geomagnetic density are in the same order of magnitude, the patient will not lie on the examination bed for a long time during the examination, so the positioning method without considering the external environmental factors is not practical.

[0004] In order to solve the position and attitude function of the magnetic capsule endoscope, some researchers calculate by linear method, although the linear calculation is fast, but it faces high probability of local extremum, and the algorithm accuracy is often low. The Levenberg-Marquardt (LM) algorithm as a nonlinear algorithm is applied to the solution of the positioning algorithm due to its excellent solving speed and calculation accuracy. It depends on the guess of the initial value, and the sensor is easy to cause the estimation error of the initial value due to the disturbance of the environment, so the LM algorithm appears local optimal solution in the calculation process. Some researchers use the combination of LM algorithm and intelligent algorithm for research, but the intelligent algorithm is easy to appear local solution, and the magnetic field model based on integral calculation is time-consuming. Some researchers use machine learning method for research, but the machine learning algorithm is a prediction problem with limited output value, which cannot be widely applied to the estimation of any position of the magnetic capsule endoscope and the magnetic moment of the magnet, and the positioning result is not accurate enough. SUMMARY

[0005] Therefore, the present application provides a magnetic capsule endoscope positioning method, device, equipment, medium and product to solve the technical problem of the inaccurate positioning result of the existing magnetic capsule endoscope positioning method.

[0006] In a first aspect, the present application provides a magnetic control capsule endoscope positioning method, comprising: initializing a position parameter and an attitude parameter of a magnetic control capsule endoscope; obtaining a first target function error according to the current position parameter and the current attitude parameter; iteratively optimizing the current position parameter based on the first target function error to obtain an optimized position parameter; obtaining a second target function error according to the optimized position parameter and the current attitude parameter; iteratively optimizing the current attitude parameter based on the second target function error to obtain an optimized attitude parameter; determining whether a global iteration end condition is met, and when the global iteration end condition is met, outputting the optimized position parameter and the optimized attitude parameter, and when the global iteration end condition is not met, re-optimizing the position parameter and the attitude parameter.

[0007] The magnetic control capsule endoscope positioning method provided by the present application obtains a first target function error according to the current position parameter and the current attitude parameter, iteratively optimizes the current position parameter based on the first target function error to obtain an optimized position parameter, iteratively optimizes the position parameter under the premise of assuming that the current attitude parameter is relatively accurate, obtains a second target function error according to the optimized position parameter and the current attitude parameter after obtaining a local optimal solution of the position parameter through iterative optimization, iteratively optimizes the current attitude parameter based on the second target function error to obtain an optimized attitude parameter, thereby obtaining a local optimal solution of the attitude parameter through optimization calculation under the local optimal solution of the position parameter, and iteratively optimizing the position parameter and the attitude parameter under respective independent conditions through multiple global iterations, which is conducive to finding a global optimal solution and improving the accuracy of the positioning result.

[0008] Optionally, obtaining a first target function error according to the current position parameter and the current attitude parameter comprises: calculating a first calculation value of a differential magnetic field between two sensors according to the current position parameter and the current attitude parameter; and obtaining a first target function error according to the first calculation value and an observation value of the differential magnetic field measured by the sensor.

[0009] By calculating the error between the calculation value and the observation value of the differential magnetic field, quantitative error evaluation is provided for the optimization of the position parameter, which is helpful for more accurately adjusting the position parameter.

[0010] Optionally, the iterative optimization of the current position parameter based on the first target function error obtains an optimized position parameter, comprising: calculating a Jacobian matrix composed of gradients of the position parameter based on the first target function error; and iteratively optimizing the current position parameter based on the gradients of the position parameter by using the LM algorithm, wherein the iterative formula of the position parameter is:

[0011]

[0012] wherein a, b and c are three-axis components of the position parameter, k is the number of position parameter iterations, ee k is the first target function error at the kth position parameter iteration, A ek is the Jacobian matrix composed of gradients of the position parameter at the kth position parameter iteration, μ is a damping coefficient, and E is an identity matrix; it is judged whether the first target function error is less than a first error threshold and whether the number of position parameter iterations is greater than or equal to a first preset iteration number, when the first target 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 iteration number, the position parameter obtained in the current iteration is taken as the optimized position parameter, when the first target 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 iteration number, the next round of position parameter iteration is entered.

[0013] The iterative optimization of the position parameter by using the LM algorithm gradually reduces the error by the gradient descent method until a preset error threshold or iteration number is reached, which improves the efficiency and accuracy of the position parameter optimization, and meanwhile, the instability and overfitting of the algorithm are avoided through the control of the damping coefficient and the iteration number.

[0014] Optionally, the second target function error is obtained according to the optimized position parameter and the current attitude parameter, comprising: calculating a second calculation value of the differential magnetic field between two sensors according to the optimized position parameter and the current attitude parameter; and obtaining the second target function error according to the second calculation value and an observation value of the differential magnetic field measured by the sensor.

[0015] The second target function error is updated based on the optimized position parameter, which provides quantitative error evaluation for the optimization of the attitude parameter and is helpful to more accurately adjust the attitude parameter.

[0016] Optionally, the iterative optimization of the current attitude parameter based on the second target function error obtains the optimized attitude parameter, comprising: calculating a Jacobian matrix composed of the gradient of the attitude parameter based on the second target function error; and iteratively optimizing the current attitude parameter based on the gradient of the attitude parameter by using the LM algorithm, wherein the iterative formula of the attitude parameter is:

[0017]

[0018] wherein m, n and p are three-axis components of the attitude parameter, l is the iteration number of the attitude parameter, em l is the second target function error at the lth iteration of the attitude parameter, A ml is the Jacobian matrix composed of the gradient of the attitude parameter at the lth iteration of the attitude parameter, μ is a damping coefficient, and E is an identity matrix; it is judged whether the second target function error is less than a second error threshold and whether the iteration number of the attitude parameter is greater than or equal to a second preset iteration number, when the second target function error is less than the second error threshold or the iteration number of the attitude parameter is greater than or equal to the second preset iteration number, the attitude parameter obtained in the current iteration is taken as the optimized attitude parameter, and when the second target function error is greater than or equal to the second error threshold and the iteration number of the attitude parameter is less than the second preset iteration number, the next round of attitude parameter iteration is entered.

[0019] The iterative optimization of the attitude parameter by using the LM algorithm gradually reduces the error by using the gradient descent method until a preset error threshold or iteration number is reached, thereby improving the efficiency and accuracy of the optimization of the attitude parameter, and meanwhile, the instability and overfitting of the algorithm are avoided through the control of the damping coefficient and the iteration number.

[0020] Optionally, before judging whether the overall iteration end condition is met, the method further comprises: calculating an overall target error according to the second target function error; and correspondingly, judging whether the overall iteration end condition is met, when the overall iteration end condition is met, outputting the optimized position parameter and the optimized attitude parameter, and when the overall iteration end condition is not met, re-optimizing the position parameter and the attitude parameter, comprising: judging whether the overall target error is less than a preset overall error threshold and whether the overall iteration number is greater than or equal to a preset overall iteration number, when the overall target error is less than the preset overall error threshold or the overall iteration number is greater than or equal to the preset overall iteration number, outputting the optimized position parameter and the optimized attitude parameter, and when the overall target error is greater than or equal to the preset overall error threshold and the overall iteration number is less than the preset overall iteration number, re-optimizing the position parameter and the attitude parameter.

[0021] The calculation and judgment of the overall target error help to end iteration in time after meeting certain accuracy requirements, improve the efficiency of the algorithm, ensure that the result can be output in time after reaching the required accuracy, and avoid possible error accumulation caused by excessive iteration.

[0022] In a second aspect, the present application provides a magnetic capsule endoscope positioning device, comprising: an initialization module, which initializes a position parameter and an attitude parameter of the magnetic capsule endoscope; a first error acquisition module, which is configured to acquire a first target function error according to the current position parameter and the current attitude parameter; a position optimization module, which is configured to iteratively optimize the current position parameter based on the first target function error to obtain an optimized position parameter; a second error acquisition module, which is configured to acquire a second target function error according to the optimized position parameter and the current attitude parameter; an attitude optimization module, which is configured to iteratively optimize the current attitude parameter based on the second target function error to obtain an optimized attitude parameter; and a parameter output module, which is configured to judge whether an overall iteration end condition is met, and when the overall iteration end condition is met, output the optimized position parameter and the optimized attitude parameter, and when the overall iteration end condition is not met, re-optimize the position parameter and the attitude parameter.

[0023] In a third aspect, the present application provides a computer device, comprising: a memory and a processor, which are communicatively connected with each other, and the memory stores computer instructions; the processor executes the computer instructions to perform the magnetic capsule endoscope positioning method of the first aspect or any of the corresponding embodiments thereof.

[0024] In a fourth aspect, the present application provides a computer readable storage medium, which stores computer instructions for making a computer perform the magnetic capsule endoscope positioning method of the first aspect or any of the corresponding embodiments thereof.

[0025] In a fifth aspect, the present application provides a computer program product, which comprises computer instructions for making a computer perform the magnetic capsule endoscope positioning method of the first aspect or any of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS

[0026] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0027] Figure 1 is a schematic diagram of the spatial position of a magnetic control capsule endoscope and a sensor according to an embodiment of the present application;

[0028] Figure 2 is a flowchart of a magnetic control capsule endoscope positioning method according to an embodiment of the present application;

[0029] Figure 3 is a structural block diagram of a magnetic control capsule endoscope positioning device according to an embodiment of the present application;

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

[0031] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme of the embodiments of the present application will be described clearly and completely below with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0032] At present, in order to solve the position and attitude function of the magnetic control capsule endoscope, the related research is carried out by adopting the Levenberg-Marquardt (LM) algorithm and the intelligent algorithm combination mode, but the intelligent algorithm is prone to local solution, and the positioning result is not accurate enough. Based on this, the Expectation-Maximization Algorithm (EM algorithm) is introduced in the embodiments of the present application. The EM algorithm is an iterative method for estimating model parameters, which calculates the expected value of the probability distribution of the hidden variable through the 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 magnetic control capsule endoscope, which is located at P ce (a, b, c). As shown in Figure 1 , it is assumed that the distance between the magnetic control capsule endoscope and the sensor P se (x i , y i , z i ) position is much larger than the geometric size of the magnet, then the magnetic field B se (x i , y i , z i ) generated by the magnetic control capsule endoscope at the position P iThe dipole model can be expressed as:

[0034]

[0035] where, is the position vector of the magnetocapsule endoscope and sensor, i = 1, 2, …, N is the number of sensors is the unit vector of the magnetization direction of the permanent magnet; k, L, M T are the radius, length, and magnetization of the permanent magnet, respectively, and μ0 is the vacuum permeability,

[0036] The three-axis components calculated at the sensor according to equation (1) can be expressed as:

[0037]

[0038] where the constraint of the three-dimensional vector of the magnet field direction is:

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

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

[0041] For magnetic positioning, in order to improve the accuracy of the system, a large amount of data is usually required, and an array of multiple sensors can be used to measure the data. Assuming that N sensors are used to measure the data, according to the magnetic positioning equation set, the collection 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, and the positioning system function is:

[0042]

[0043]

[0044] This is a nonlinear least squares problem, and the positioning problem of the magnetocapsule endoscope can be converted into a nonlinear optimization problem. We find the appropriate parameters (a, b, c) and (m, n, p) through optimization algorithms to minimize the target error.

[0045]

[0046] In order to solve the parameters (a, b, c) and (m, n, p), the embodiment of the application adopts an optimization algorithm combining the LM algorithm and the EM algorithm, estimates 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] Wherein, A k is the Jacobian matrix of the error function at the kth iteration, μ is the damping coefficient, E is the unit matrix, and e k is the error at the kth iteration.

[0050] The EM algorithm is an iterative method for estimating model parameters, which calculates the expected value of the probability distribution of hidden variables based on the observed data, and then updates the model parameters based on the expected value. Through cyclic iteration, a certain stable state position is reached.

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

[0052]

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

[0054] Then the corresponding parameter is obtained by maximizing the likelihood function.

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

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

[0057] The embodiment of the application combines the LM algorithm and the EM algorithm, and provides a magnetically controlled capsule endoscope positioning method embodiment. 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., as shown in Figure 2 The flowchart includes the following steps:

[0059] Step S201, initialize the position parameters and the attitude parameters of the magnetically actuated capsule endoscope.

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

[0061] Step S202, obtain a first target function error according to the current position parameters and the current attitude parameters.

[0062] Specifically, the first target function error is the difference between the calculated values of the magnetic field components between each pair of sensors and the detected magnetic field components of the sensors according to the current position parameters and the current attitude parameters.

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

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

[0065] Specifically, steps S202 and S203 are equivalent to the E step in the EM algorithm, which assumes that the current attitude parameters are relatively accurate, and at this time the attitude parameters are equivalent to the parameters θ in the EM algorithm, and the position parameters are equivalent to the hidden variables Z. The calculated magnetic field components between each pair of sensors according to the current position parameters and the current attitude parameters are the observed values of the parameters X, and the detected magnetic field components of the sensors are the true values of the parameters X. According to the difference between the two, i.e. the first target function error, the hidden variables, i.e. the position parameters (a, b, c), are iteratively optimized based on the position parameters to obtain the position parameters that minimize the first target function error under the current attitude parameters, i.e. to obtain the local optimal solution of the current maximum expectation value.

[0066] Step S204, obtain a second target function error according to the optimized position parameters and the current attitude parameters.

[0067] Specifically, the second target function error is the difference between the calculated values of the magnetic field components between each pair of sensors and the detected magnetic field components of the sensors according to the optimized position parameters and the current attitude parameters in step S203.

[0068] Step S205, iteratively optimize the current attitude parameters based on the second target function error to obtain optimized attitude parameters.

[0069] Specifically, the step S204 and the step S205 correspond to the M step in the EM algorithm, assuming that the position parameters are relatively accurate, at this time the position parameters correspond to the parameter θ in the EM algorithm, the magnetic field components between each pair of sensors calculated according to the optimized position parameters and the current attitude parameters are the observation values of the parameter X, the magnetic field components detected by the sensors are the true values of the parameter X, and the attitude parameters are iteratively optimized according to the difference between the two, that is, the second target function error, to obtain the attitude parameters that minimize the second target function error under the position parameters after this round of optimization, and obtain the optimal solution of the attitude parameters under the local optimal solution of the position parameters.

[0070] In step S206, it is determined whether the overall iteration end condition is met, and when the overall iteration end condition is met, the optimized position parameters and the optimized attitude parameters are output, and when the overall iteration end condition is not met, the position parameters and the attitude parameters are re-optimized.

[0071] In an example, the overall iteration end 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] Through multiple rounds of EM iterations until the overall iteration end condition is met, the optimal solution of the position parameters and the attitude parameters is obtained.

[0073] The magnetic control capsule endoscope positioning method of the embodiment of the application obtains the first target function error according to the current position parameters and the current attitude parameters, iteratively optimizes the current position parameters based on the first target function error to obtain the optimized position parameters, iteratively optimizes the position parameters under the premise of assuming that the current attitude parameters are relatively accurate, obtains the second target function error according to the optimized position parameters and the current attitude parameters after the local optimal solution of the position parameters is obtained through the iterative optimization of the position parameters, iteratively optimizes the current attitude parameters based on the second target function error to obtain the optimized attitude parameters, thereby optimizing and calculating the local optimal solution of the attitude parameters under the local optimal solution of the position parameters, and iteratively optimizing the position parameters and the attitude parameters under independent conditions, which is conducive to finding the global optimal solution and improving the accuracy of the positioning result.

[0074] In some embodiments, in step S202, the first target function error is obtained according to the current position parameters and the current attitude parameters, including:

[0075] In step S2021, the first calculation value of the differential magnetic field between each pair of sensors is calculated according to the current position parameters and the current attitude parameters.

[0076] Specifically, the current position parameter and the current attitude parameter are substituted into formula (1) to calculate the magnetic field corresponding to each sensor position, and then the magnetic fields corresponding to each pair of sensors are subtracted to obtain the differential magnetic field, i.e. the first calculation value.

[0077] In step S2022, a first target function error is obtained according to the first calculation value and an observation value of the differential magnetic field measured by the sensors.

[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 be 4, there are 6 corresponding differential magnetic fields, and there are also 6 corresponding first calculation values and observation values. The square of the difference between each first calculation value and the corresponding observation value is added to obtain the first target function error.

[0079] The embodiment of the present application provides quantitative error evaluation for the optimization of the position parameter by calculating the error between the calculation value and the observation value of the differential magnetic field, which helps to more accurately adjust the position parameter.

[0080] Further, in step S203, the current position parameter is iteratively optimized based on the first target function error to obtain an optimized position parameter, including:

[0081] In step S2031, a Jacobian matrix composed of gradients of the position parameter is calculated based on the first target function error. Specifically, the Jacobian matrix A composed of gradients of the position parameter is calculated as follows: ek

[0082]

[0083] The Jacobian matrix A composed of gradients of the position parameter is calculated as follows: ek including three gradients of the position parameter

[0084] In step S2032, the current position parameter is iteratively optimized based on the gradient of the position parameter by using the LM algorithm, wherein the iterative formula of the position parameter is as follows:

[0085]

[0086] In the formula, a, b and c are three-axis components of the position parameter, k is the iteration number of the position parameter, ee k is the first target function error at the kth iteration of the position parameter, A ek is the Jacobian matrix composed of gradients of the position parameter at the kth iteration of the position parameter, μ is a damping coefficient, and E is a unit matrix.

[0087] ​​Step S2033, judging whether the first target function error is less than the first error threshold and the iteration number of the position parameter is greater than or equal to the first preset iteration number, when the first target function error is less than the first error threshold or the iteration number of the position parameter is greater than or equal to the first preset iteration number, taking the position parameter obtained in the current iteration as the optimized position parameter, when the first target function error is greater than or equal to the first error threshold and the iteration number of the position parameter is less than the first preset iteration number, entering the next round of position parameter iteration.

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

[0089] The embodiment of the application adopts the LM algorithm to iteratively optimize the position parameter, gradually reduces the error through the gradient descent method, and reaches the preset error threshold or the iteration number, thereby improving the efficiency and accuracy of the position parameter optimization, and avoiding the instability and overfitting of the algorithm through the control of the damping coefficient and the iteration number.

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

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

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

[0093] Step S2042, obtaining the second target function error according to the second calculation value and the observation value of the differential magnetic field measured by the sensor.

[0094] The square of the difference between each second calculation value and the corresponding observation value is added, and the first target function error is obtained.

[0095] Based on the optimized position parameter, the second target function error is updated, which provides quantitative error evaluation for the optimization of the attitude parameter, and helps to more accurately adjust the attitude parameter.

[0096] Further, step S205, iteratively optimizing the current attitude parameter based on the second target function error to obtain the optimized attitude parameter, includes:

[0097] Step S205, calculating the Jacobian matrix composed of the gradient of the attitude parameter based on the second target function error.

[0098] Specifically, the Jacobian matrix A composed of gradients of the attitude parameters ml is:

[0099]

[0100] which is mainly composed of three gradients of the attitude parameters and .

[0101] In step S205, the current attitude parameters are iteratively optimized based on the gradients of the attitude parameters by using the LM algorithm, wherein the iterative formula of the attitude parameters is:

[0102]

[0103] wherein m, n and p are three-axis components of the attitude parameters, l is the iteration number of the attitude parameters, em l is the second objective function error in the lth iteration of the attitude parameters, A ml is the Jacobian matrix composed of gradients of the attitude parameters in the lth iteration of the attitude parameters, μ is a damping coefficient, and E is a unit matrix.

[0104] In step S205, it is judged whether the second objective function error is less than a second error threshold and whether the iteration number of the attitude parameters is greater than or equal to a second preset iteration number. When the second objective function error is less than the second error threshold or the iteration number of the attitude parameters is greater than or equal to the second preset iteration number, the attitude parameters obtained in the current iteration are taken as the optimized attitude parameters. When the second objective function error is greater than or equal to the second error threshold and the iteration number of the attitude parameters is less than the second preset iteration number, the next round of iteration of the attitude parameters is entered.

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

[0106] The embodiment of the application iteratively optimizes the attitude parameters by using the LM algorithm, gradually reduces the error by using the gradient descent method, and stops until a preset error threshold or iteration number is reached, thereby improving the efficiency and accuracy of the optimization of the attitude parameters. Meanwhile, the instability and overfitting of the algorithm are avoided by controlling the damping coefficient and the iteration number.

[0107] In some embodiments, before judging whether the overall iteration end condition is met, the method further comprises:

[0108] The overall objective error is calculated according to the second objective function error.

[0109] In an example, the overall objective error is:

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

[0111] Where, 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 reaching the required accuracy, and avoids the possible error accumulation caused by excessive iteration.

[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 position parameters and posture parameters. Taking the setting of four sensors as an example, compared with the LM algorithm, the calculation results of its position error and angle error are shown in the following table:

[0117]

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

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

[0120] The initialization module 301 initializes the position parameters and the attitude parameters of the magnetically controlled capsule endoscope.

[0121] The first error obtaining module 302 obtains a first target function error according to the current position parameters and the current attitude parameters.

[0122] The position optimization module 303 iteratively optimizes the current position parameters based on the first target function error to obtain optimized position parameters.

[0123] The second error obtaining module 304 obtains a second target function error according to the optimized position parameters and the current attitude parameters.

[0124] The attitude optimization module 305 iteratively optimizes the current attitude parameters based on the second target function error to obtain optimized attitude parameters.

[0125] The parameter output module 306 judges whether the overall iteration end condition is met, and outputs the optimized position parameters and the optimized attitude parameters when the overall iteration end condition is met, and re-optimizes the position parameters and the attitude parameters when the overall iteration end condition is not met.

[0126] The magnetically controlled capsule endoscope positioning device of the embodiment of the application obtains a first target function error according to the current position parameters and the current attitude parameters, iteratively optimizes the current position parameters based on the first target function error to obtain optimized position parameters, iteratively optimizes the position parameters on the premise that the current attitude parameters are relatively accurate, obtains a second target function error according to the optimized position parameters and the current attitude parameters after obtaining a local optimal solution of the position parameters through iterative optimization, iteratively optimizes the current attitude parameters based on the second target function error to obtain optimized attitude parameters, thereby obtaining a local optimal solution of the attitude parameters through optimization calculation under the local optimal solution of the position parameters, and iteratively optimizing the position parameters and the attitude parameters under respective independent conditions through multiple rounds of overall iteration, which is conducive to finding a global optimal solution and improving the accuracy of the positioning result.

[0127] Further, the first error obtaining module 302 comprises:

[0128] The first calculation value obtaining module calculates a first calculation value of the differential magnetic field between two sensors according to the current position parameters and the current attitude parameters.

[0129] The first error calculation module obtains the first target function error according to the first calculation value and an observation value of the differential magnetic field measured by the sensor.

[0130] Further, the position optimization module 303 comprises:

[0131] a first matrix calculation module configured to calculate a Jacobian matrix of gradients of the position parameters based on the first target function error;

[0132] a position iteration module configured to iteratively optimize the current position parameters based on the gradients of the position parameters using the LM algorithm, wherein an iterative formula of the position parameters is:

[0133]

[0134] wherein a, b and c are three-axis components of the position parameters, k is an iteration number of the position parameters, ee k is the first target function error at the kth iteration of the position parameters, A ek is the Jacobian matrix of gradients of the position parameters at the kth iteration of the position parameters, μ is a damping coefficient, and E is an identity matrix;

[0135] a position parameter output module configured to determine whether the first target function error is less than a first error threshold and whether the iteration number of the position parameters is greater than or equal to a first preset iteration number, and when the first target function error is less than the first error threshold or the iteration number of the position parameters is greater than or equal to the first preset iteration number, the position parameters obtained in the current iteration are taken as the optimized position parameters, and when the first target function error is greater than or equal to the first error threshold and the iteration number of the position parameters is less than the first preset iteration number, the next round of iteration of the position parameters is entered.

[0136] Further, the second error obtaining module 304 comprises:

[0137] a second error calculation module configured to calculate second calculation values of the differential magnetic fields between two sensors according to the optimized position parameters and the current attitude parameters;

[0138] a second matrix calculation module configured to obtain the second target function error according to the second calculation values and observation values of the differential magnetic fields measured by the sensors.

[0139] Further, the attitude optimization module 305 comprises:

[0140] a second matrix calculation module configured to calculate a Jacobian matrix of gradients of the attitude parameters based on the second target function error;

[0141] an attitude iteration module configured to iteratively optimize the current attitude parameters based on the gradients of the attitude parameters using the LM algorithm, wherein an iterative formula of the attitude parameters is:

[0142]

[0143] wherein m, n and p are three-axis components of the attitude parameters, l is an iteration number of the attitude parameters, eml is the second objective function error during 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;

[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 determining whether the overall iteration end condition is met, the method further includes: calculating the overall target error based on 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 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.

[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, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other 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 the memory 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. Equally, multiple computer devices can be connected, and each device provides part of the 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 can be a central processing unit, a network processing unit, or a combination thereof. The processor 10 can further include a hardware chip. The hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device can be a complex programmable logic device, a field programmable logic device, a general array logic, or any combination thereof.

[0149] The memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform the methods illustrated in the above embodiments.

[0150] The memory 20 can include a program storage area and a data storage area. The program storage area can store an operating system and application programs required by at least one function. The data storage area can store data created according to the use of the computer device, and the like. In addition, the memory 20 can include a high-speed random access memory, and can further include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some alternative embodiments, the memory 20 can optionally include a memory disposed remotely from the processor 10, which can be connected to the computer device through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0151] The memory 20 can include a volatile memory, such as a random access memory, and can also include a non-volatile memory, such as a flash memory, a hard disk, or a solid state disk. The memory 20 can further include a combination of the above-mentioned types of memories.

[0152] The computer device further 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 can be connected by a bus or other means, Figure 4 For example, the connection by the bus is taken as an example.

[0153] The input device 30 can receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointing stick, one or more mouse buttons, a trackball, a joystick, and the like. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), a tactile feedback device (e.g., a vibration motor), and the like. The display device includes, but is not limited to, a liquid crystal display, a light emitting diode, a display, and a plasma display. In some alternative embodiments, the display device can be a touch screen.

[0154] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, 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 drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. 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 portion 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 form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. 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 that can be accessed by the computer.

[0156] Although the embodiments of the present invention have been described with reference to 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 method of positioning a magnetically controlled capsule endoscope, characterized by, The method comprises the following steps: initializing a position parameter and a posture parameter of a magnetically controllable capsule endoscope; obtaining a first target function error according to the current position parameter and the current posture parameter; iteratively optimizing the current position parameter based on the first target function error to obtain an optimized position parameter; obtaining a second target function error according to the optimized position parameter and the current posture parameter; iteratively optimizing the current posture parameter based on the second target function error to obtain an optimized posture parameter; judging whether an overall iteration end condition is met, and outputting the optimized position parameter and the optimized posture parameter when the overall iteration end condition is met, or re-optimizing the position parameter and the posture parameter when the overall iteration end condition is not met; wherein the step of obtaining the first target function error according to the current position parameter and the current posture parameter comprises the following steps: calculating a first calculation value of a differential magnetic field between two sensors according to the current position parameter and the current posture parameter; obtaining the first target function error according to the first calculation value and an observation value of the differential magnetic field measured by the sensors; wherein the step of obtaining the second target function error according to the optimized position parameter and the current posture parameter comprises the following steps: calculating a second calculation value of the differential magnetic field between two sensors according to the optimized position parameter and the current posture parameter; obtaining the second target function error according to the second calculation value and the observation value of the differential magnetic field measured by the sensors.

2. The magnetically controlled capsule endoscope positioning method according to claim 1, characterized by, The step of iteratively optimizing the current position parameter based on the first target function error to obtain the optimized position parameter comprises the following steps: calculating a Jacobian matrix composed of gradients of the position parameter based on the first target function error; iteratively optimizing the current position parameter based on the gradients of the position parameter by using an LM algorithm, wherein an iterative formula of the position parameter is: where a, b and c are the three-axis components of the position parameter, k is the iteration number of the position parameter, ee k is the first target function error at the kth iteration of the position parameter, A ek is the Jacobian matrix composed of the gradient of the position parameter at the kth iteration of the position parameter, μ is the damping coefficient, and E is the unit matrix; judging whether the first target function error is less than a first error threshold and whether a position parameter iteration number is greater than or equal to a first preset iteration number, and taking the position parameter obtained in the current iteration as the optimized position parameter when the first target function error is less than the first error threshold or the position parameter iteration number is greater than or equal to the first preset iteration number, or entering a next round of position parameter iteration when the first target function error is greater than or equal to the first error threshold and the position parameter iteration number is less than the first preset iteration number.

3. The magnetically controlled capsule endoscope positioning method of claim 1, wherein, The step of iteratively optimizing the current posture parameter based on the second target function error to obtain the optimized posture parameter comprises the following steps: calculating a Jacobian matrix composed of gradients of the posture parameter based on the second target function error; iteratively optimizing the current posture parameter based on the gradients of the posture parameter by using an LM algorithm, wherein an iterative formula of the posture parameter is: wherein m, n and p are three-axis components of the attitude parameter, l is the iteration number of the attitude parameter, em l is the second target function error at the lth iteration of the attitude parameter, A ml is the Jacobian matrix composed of the gradient of the attitude parameter at the lth iteration of the attitude parameter, μ is a damping coefficient, and E is a unit matrix. determining whether the second target function error is less than a second error threshold and whether the number of iterations of the attitude parameter is greater than or equal to a second preset number of iterations, when the second target function error is less than the second error threshold or the number of iterations of the attitude parameter is greater than or equal to the second preset number of iterations, taking the attitude parameter obtained in the current iteration as the optimized attitude parameter, and when the second target function error is greater than or equal to the second error threshold and the number of iterations of the attitude parameter is less than the second preset number of iterations, entering the next round of iteration of the attitude parameter.

4. The magnetically controlled capsule endoscope positioning method of claim 1, wherein, Before determining whether the overall iteration end condition is met, further comprising: calculating an overall target error according to the second target function error; correspondingly, determining whether the overall iteration end condition is met, when the overall iteration end condition is met, outputting the optimized position parameter and the optimized attitude parameter, and when the overall iteration end condition is not met, re-optimizing the position parameter and the attitude parameter, comprising: determining whether the overall target error is less than a preset overall error threshold and whether the number of overall 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 number of overall iterations is greater than or equal to the preset overall number of iterations, outputting the optimized position parameter and the optimized attitude parameter, and when the overall target error is greater than or equal to the preset overall error threshold and the number of overall iterations is less than the preset overall number of iterations, re-optimizing the position parameter and the attitude parameter.

5. A magnetically controlled capsule endoscope positioning device, characterized by, comprising: an initialization module, initializing a position parameter and an attitude parameter of a magnetically controlled capsule endoscope; a first error obtaining module, configured to obtain a first target function error according to the current position parameter and the current attitude parameter; a position optimization module, configured to iteratively optimize the current position parameter based on the first target function error to obtain an optimized position parameter; a second error obtaining module, configured to obtain a second target function error according to the optimized position parameter and the current attitude parameter; an attitude optimization module, configured to iteratively optimize the current attitude parameter based on the second target function error to obtain an optimized attitude parameter; a parameter output module, configured to determine whether an overall iteration end condition is met, when the overall iteration end condition is met, outputting the optimized position parameter and the optimized attitude parameter, and when the overall iteration end condition is not met, re-optimizing the position parameter and the attitude parameter; wherein the first error obtaining module comprises: a first calculation value obtaining module, configured to calculate a first calculation value of a differential magnetic field between two sensors according to the current position parameter and the current attitude parameter; a first error calculation module, configured to obtain the first target function error according to the first calculation value and an observation value of the differential magnetic field measured by the sensor; the second error obtaining module comprises: a second error calculation module, configured to calculate a second calculation value of the differential magnetic field between two sensors according to the optimized position parameter and the current attitude parameter; A second matrix calculation module is configured to obtain a second objective function error based on the second calculation value and an observation value of the differential magnetic field measured by the sensor.

6. A computer device, comprising: The application further provides a computer readable storage medium having stored computer instructions for causing a computer to perform the magnetic controlled capsule endoscope positioning method according to any one of claims 1 to 4. The computer readable storage medium has stored computer instructions for causing a computer to perform the magnetic controlled capsule endoscope positioning method according to any one of claims 1 to 4.

7. A computer readable storage medium characterized in that, The computer readable storage medium has stored computer instructions for causing a computer to perform the magnetic controlled capsule endoscope positioning method according to any one of claims 1 to 4.

8. A computer program product, characterised in that, The computer readable storage medium has stored computer instructions for causing a computer to perform the magnetic controlled capsule endoscope positioning method according to any one of claims 1 to 4.

Citation Information

Patent Citations

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

    CN111956171A

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

    CN112515611A