Medical image segmentation algorithm based on yoke and one-dimensional hidden Markov chain

By introducing martingale and one-dimensional hidden Markov chain models in medical image segmentation, combined with Hilbert-Scan and Baum-Welch algorithms, and using structural similarity and Hu moment functions, the local optimal problem in traditional models is solved and significantly improved. Improve the accuracy and consistency of medical image segmentation.

CN118822982APending Publication Date: 2024-10-22JILIN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410882191.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

Traditional one-dimensional hidden Markov chains and EM segmentation models have local optimal problems in medical image segmentation, resulting in poor segmentation results and difficulty in coping with the complexity and diversity of medical images.

Method used

A segmentation model based on martingale and one-dimensional hidden Markov chain is used to convert the two-dimensional image into a one-dimensional sequence through Hilbert-Scan dimensionality reduction scanning. It combines K-means clustering and Baum-Welch algorithm to introduce structural similarity and Hu moment. The function constructs a random power martingale to avoid local optimal solutions and uses Doob's maximum inequality to judge convergence.

Benefits of technology

It effectively avoids local optimal solutions, improves the accuracy and consistency of medical image segmentation, and significantly improves the segmentation effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118822982A_ABST
    Figure CN118822982A_ABST
Patent Text Reader

Abstract

A medical image segmentation algorithm based on a yoke and a one-dimensional hidden Markov chain belongs to the technical field of image processing, and comprises the following steps: preprocessing such as medical image denoising: converting a two-dimensional image into a one-dimensional sequence through Hilbert scanning; performing coarse segmentation on the sequence by using a K-means clustering method, and taking a result as priori knowledge of one-dimensional Markov chain segmentation; a one-dimensional hidden Markov chain is constructed, and priori knowledge is utilized and parameter iteration is carried out through an EM algorithm; constructing a difference function between adjacent iteration results by using a structural similarity function and a Hu moment function, then constructing a random exponential yoke, and performing convergence judgment on the iteration results by using a Doob yoke maximum inequality theorem; and maximizing the edge posterior probability, and recovering the finally obtained one-dimensional result into a two-dimensional image according to a starting scanning sequence, namely a final segmentation result. According to the method, the yoke theory and the EM algorithm of the one-dimensional Markov chain are combined, a local optimal solution is avoided, and a better segmentation effect can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to a medical image segmentation algorithm based on martingale and one-dimensional hidden Markov chain. Background Art

[0002] Over the past few decades, with the increasing breadth and depth of clinical applications of medical images, medical image segmentation technology has become one of the important research directions in the field of medical image processing; especially in computer-aided diagnosis (CAD), image-guided surgery (ICS) and tumor radiotherapy (ORT). With the increasing use of computed tomography (CT) and magnetic resonance imaging (MRI) in diagnosis, treatment planning and clinical research, doctors and physicists must use computers to assist in completing related tasks, such as drawing the outlines of anatomical structures and other areas of interest and calculating surgical paths when planning surgery. Medical image segmentation technology, as a computer-aided diagnosis technology used in the medical field, helps doctors complete the observation and analysis of medical images including MRI, PET, CT, etc. The accuracy of its image segmentation will have a direct impact on clinicians' diagnosis and treatment of patients' organs, judgment of patients' conditions, choice of treatment methods, and even on subsequent clinical work and medical data processing.

[0003] Medical image segmentation technology has not been perfectly solved to this day. One important reason is the complexity and diversity of medical images. Due to the differences in the imaging principles of medical images and the characteristics of the tissues themselves, and the fact that the formation of images is affected by noise, field offset effects, local volume effects, and tissue movement, medical images are inevitably blurred and uneven compared to ordinary images. In addition, the anatomical structure and shape of the human body are complex, and there are considerable differences between people, all of which bring difficulties to medical image segmentation. Therefore, it is necessary to conduct in-depth research in this field, introduce new mathematical theories based on the original traditional models, and develop new algorithms to achieve better segmentation effects. Summary of the invention

[0004] Aiming at the local optimum problem existing in the traditional one-dimensional hidden Markov chain and EM segmentation model, the present invention provides a segmentation model algorithm based on martingale and one-dimensional Markov chain.

[0005] 1. A medical image segmentation algorithm based on martingale and one-dimensional hidden Markov chain, characterized in that it comprises the following steps:

[0006] 1.1 Preprocess the medical images, convert them into one-dimensional sequences, and use the K-means clustering method to obtain prior knowledge, including the following steps:

[0007] 1.1.1 Use image filtering technology to remove noise in the medical image acquisition process, and use the histogram equalization method to adjust the grayscale histogram of the image, enhance the image contrast, and adapt to the local characteristics of the image;

[0008] 1.1.2 Using the Hilbert-Scan method, the medical image preprocessed in step 1.1.1 is scanned for dimensionality reduction. The purpose is to convert the two-dimensional image into a one-dimensional sequence, and then input it into the one-dimensional Markov chain for segmentation. The expression of the Hilbert-Scan scan matrix is:

[0009]

[0010]

[0011] Where: H2 represents the initial matrix; H T Represents the transposition of a matrix; the matrix The representative size is 2 k A matrix of all 1s; Represents the matrix Perform the row transformation operation in the elementary matrix transformation, swap the positions of the i-th row and the ni-th row, where n represents the number of rows in the matrix. Represents the matrix Perform the column transformation operation in the elementary matrix transformation, swap the positions of the i-th column and the ni-th column, where n represents the number of columns in the matrix;

[0012] 1.1.3 Perform K-means clustering on the one-dimensional sequence obtained by the transformation in step 1.1.2. The K-means algorithm first initializes k samples as the initial cluster centers a = a1, a2, a3, ..., a k , for each element x in the sequence i , calculate its distance to k distance centers, and divide it into the class corresponding to the cluster center with the smallest distance, for each class a i , re-cluster centers And calculate the squared error Until the square error reaches the minimum result;

[0013] 1.1.4 Take the result of minimizing the square error obtained in step 1.1.3 as the prior knowledge of the one-dimensional Markov chain for the next step of segmentation;

[0014] 1.2 Combining the one-dimensional Markov chain and the martingale theory to construct a new segmentation model includes the following steps:

[0015] 1.2.1 Redefine the prior knowledge obtained in step 1.1.4 to construct a one-dimensional Markov chain. Define Z = (X, Y) as a one-dimensional Markov chain, where: X = (Xn ) n=1,...,N Defined as a hidden state process; Y = (Y n ) n=1,...,N Defined as the observation state process, in image segmentation, the hidden state represents the category of the pixel point, 0: foreground, 1: background, and the observation state represents the image pixel value;

[0016] 1.2.2 When constructing a one-dimensional Markov chain, the following three assumptions are made by default:

[0017] 1.2.2.1X=(X n ) n=1,...,N is a Markov chain, and the expression of distribution probability is:

[0018]

[0019] 1.2.2.2 Observation process Y=(Y n ) n=1,...,N About the hidden state process X=(X n ) n=1,...,N are conditionally independent:

[0020]

[0021] 1.2.2.3 Each observation y n It depends only on its corresponding hidden state and has nothing to do with other hidden states:

[0022] p(y n |x)=p(y n |x n );

[0023] 1.2.3 Initialize the initial parameters θ of the one-dimensional Markov chain based on the prior knowledge obtained in step 1.1.4 0 ,θ 0 Including the initial probability, that is, the probability of the first point state of the hidden state of the one-dimensional Markov chain L is the number of pixel classes; the transition probability matrix That is x n When the hidden state is i, the next point x n+1 The probability that the state is j; the mean μ for each category i i ; The variance of each category i (σ i ) 2 ; The distribution probability of the observed state under the influence of the hidden state is:

[0024] 1.2.4 Construct the Baum-Welch Algorithm using the initial parameters obtained in step 1.2.3;

[0025] 1.2.4.1 Definition of forward probability α n (i)=p(y1,...,y n ,x n ), whose expression is:

[0026]

[0027] 1.2.4.2 Definition of backward probability β n (i) = p(y n+1 ,...,y N |x n ), whose expression is:

[0028]

[0029] 1.2.4.3 Define the joint posterior probability γ n (i,j)=p(x n =i,x n+1 =j|y n ), whose expression is:

[0030]

[0031] 1.2.4.4 Define the marginal posterior probability x n (i) = p(x n =i|y n ), whose expression is:

[0032]

[0033] 1.3 The parameters and variables are continuously updated through the EM algorithm. In the process of two consecutive parameter iterations, a random martingale is defined, and the Doob martingale maximum inequality theorem is used to determine whether the EM algorithm has converged.

[0034] 1.3.1 Use the Baum-Welch Algorithm to calculate the mathematical expressions of steps 1.2.4.1 to 1.2.4.4;

[0035] 1.3.2 Calculate the mean and variance of each category during the iteration process. The expression of the mean and variance of category i in the q+1th iteration is:

[0036]

[0037] 1.3.3 In each iteration, θ q The parameters are constantly updated, including forward probability, backward probability, joint posterior probability, marginal posterior probability, observation sequence distribution function and probability transfer matrix, and the expressions are:

[0038]

[0039] 1.4 In the iterative process, in order to better judge the convergence and avoid the local optimum, the knowledge of martingale theory is introduced to construct a random power martingale based on the image difference function, and the Doob maximum inequality is used to judge whether convergence has been achieved;

[0040] 1.4.1 In the process of parameter iteration, in order to avoid the local optimal situation, a new difference function between iteration results is constructed. The difference function consists of structural similarity function and Hu moment function.

[0041] 1.4.1.1 Structural similarity function measures the similarity between two images by comparing their brightness, contrast and structural similarity. It mainly consists of three parts, namely brightness similarity, contrast similarity and structural similarity. The final expression is composed of the product of the three parts:

[0042]

[0043] Where: μ x and μ y are the means of image x and image y, σ x and σ y are the standard deviations of image x and image y, σ xy is the covariance between the two images, C1, C2, C3 are very small positive numbers added to prevent the denominator from being zero;

[0044] 1.4.1.2 Hu moment function is an image feature description method used to describe the invariance of image shape and geometric features. It has translation, rotation and scale invariance, and constructs seven unique features for shape description. Each moment in the Hu moment function is obtained by combining the second-order or third-order central moments. The expressions are:

[0045] h0=v 20 +v 02 ;

[0046]

[0047] h2=(v 30 -3v 12 ) 2 +(3v 21 -v 03 ) 2 ;

[0048] h3=(v 30 +v 12 ) 2 +(v 21 +v 03 )2 ;

[0049]

[0050] h5=(v 20 -v 02 )[(v 30 +v 12 ) 2 -(v 21 +v 03 ) 2 ]+4v 11 (v 30 +v 11 )(v 21 +v 03 );

[0051]

[0052] Where: f(x,y) is the image pixel value,

[0053] is the second-order central moment of the image, It is the third-order central moment of the image. The Hu moment function vector of the image is composed of h0, h1, h2, h3, h4, h5, and h6. The Euclidean distance between the moment function vectors of two images is the difference of the Hu moment functions of the two images.

[0054] 1.4.1.3 The difference function between the nth and n-1th iterations is constructed from steps 1.4.1.1 and 1.4.1.2, and its expression is:

[0055] p n,n-1 (x,y)=[1-SSIM(x,y)]·Hu_Moment(x,y);

[0056] 1.5 Construct a random martingale from step 1.4.1.3, whose expression is:

[0057]

[0058] Among them: the random number in ε∈[0,1] is set to 0.92 in the experiment;

[0059] 1.5.1 After constructing the random martingale, use the maximum equality theorem of the martingale to set the threshold and judge the convergence time. The Doob maximum inequality is:

[0060]

[0061] The expectation of a random martingale is generally assumed to be 1, that is:

[0062]

[0063] 1.5.2 After judging convergence, the final segmentation result is obtained through the maximum a posteriori edge probability:

[0064]

[0065] 1.5.3 The result obtained in step 1.5.2 is still a one-dimensional sequence, which is then restored to a two-dimensional image through the above-mentioned Hilbert-Scan scanning matrix, that is, the final segmentation result.

[0066] The present invention starts with a one-dimensional hidden Markov chain, uses SSIM and Hu functions to construct a difference function between images, and constructs a random martingale based on the difference function. Compared with the traditional EM algorithm, the present invention can better avoid the occurrence of local optimal solutions to obtain better image segmentation results. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 It is a flowchart of the medical image segmentation algorithm based on martingale and one-dimensional hidden Markov chain;

[0068] Figure 2 This is a schematic diagram of the Hibert-Scan scanning curve (for example, an image of size 8*8);

[0069] Figure 3 To perform Hilbert-Scan scanning process in 8*8 image;

[0070] Figure 4 This is the experimental effect diagram of medical image segmentation;

[0071] Among them: (a) is a medical image; (b) is a standard image labeled by a doctor in the Department of Radiology; (c) is the experimental result of this algorithm; (d) is the result of K-means algorithm segmentation. DETAILED DESCRIPTION

[0072] The present invention is described below with reference to the accompanying drawings.

[0073] like Figure 1 As shown, the present invention is a medical image segmentation algorithm of martingale and one-dimensional hidden Markov chain, which generally includes converting a two-dimensional image into a one-dimensional sequence by using Hilbert-Scan, segmenting the one-dimensional sequence by using K-means method, constructing a one-dimensional Markov chain segmentation model based on martingale, establishing an EM convergence algorithm based on martingale, and finally obtaining a segmentation result.

[0074] 1.1 Preprocess the medical images, convert them into one-dimensional sequences, and use the K-means clustering method to obtain prior knowledge, including the following steps:

[0075] 1.1.1 Use image filtering technology to remove noise in the medical image acquisition process, and use the histogram equalization method to adjust the grayscale histogram of the image, enhance the image contrast, and adapt to the local characteristics of the image;

[0076] 1.1.2 As Figure 2 and Figure 3 As shown, the Hilbert-Scan method is used to perform dimensionality reduction scanning on the medical image processed in step 1.1.1. The purpose is to convert the two-dimensional image into a one-dimensional sequence, and then input it into the one-dimensional Markov chain for segmentation. The expression of the Hilbert-Scan scanning matrix is:

[0077]

[0078] Where: H2 represents the initial matrix; H T Represents the transposition of a matrix; the matrix The representative size is 2 k A matrix of all 1s; Represents the matrix Perform the row transformation operation in the elementary matrix transformation, swap the positions of the i-th row and the ni-th row, where n represents the number of rows in the matrix. Represents the matrix Perform the column transformation operation in the elementary matrix transformation, swap the positions of the i-th column and the ni-th column, where n represents the number of columns in the matrix;

[0079] 1.1.3 Perform K-means clustering on the one-dimensional sequence obtained by the transformation in step 1.1.2. The K-means algorithm first initializes k samples as the initial cluster centers a = a1, a2, a3, ..., a k , for each element x in the sequence i , calculate its distance to k distance centers, and divide it into the class corresponding to the cluster center with the smallest distance, for each class a i , re-cluster centers And calculate the squared error Until the square error reaches the minimum result;

[0080] 1.1.4 Take the result of minimizing the square error obtained in step 1.1.3 as the prior knowledge of the one-dimensional Markov chain for the next step of segmentation;

[0081] 1.2 Combining the one-dimensional Markov chain and the martingale theory to construct a new segmentation model includes the following steps:

[0082] 1.2.1 Redefine the prior knowledge obtained in step 1.1.4 to construct a one-dimensional Markov chain. Define Z = (X, Y) as a one-dimensional Markov chain, where: X = (Xn ) n=1,...,N Defined as a hidden state process; Y = (Y n ) n=1,...,N Defined as the observation state process, in image segmentation, the hidden state represents the category of the pixel point, 0: foreground, 1: background, and the observation state represents the image pixel value;

[0083] 1.2.2 When constructing a one-dimensional Markov chain, the following three assumptions are made by default:

[0084] 1.2.2.1X=(X n ) n=1,...,N is a Markov chain, and the expression of distribution probability is:

[0085]

[0086] 1.2.2.2 Observation process Y=(Y n ) n=1,...,N About the hidden state process X=(X n ) n=1,...,N are conditionally independent:

[0087]

[0088] 1.2.2.3 Each observation y n It depends only on its corresponding hidden state and has nothing to do with other hidden states:

[0089] p(y n |x)=p(y n |x n );

[0090] 1.2.3 Initialize the initial parameters θ of the one-dimensional Markov chain based on the prior knowledge obtained in step 1.1.4 0 ,θ 0 Including the initial probability, that is, the probability of the first point state of the hidden state of the one-dimensional Markov chain L is the number of pixel classes; the transition probability matrix That is x n When the hidden state is i, the next point x n+1 The probability that the state is j; the mean μ for each category i i ; The variance of each category i (σ i ) 2 ; The distribution probability of the observed state under the influence of the hidden state is:

[0091] 1.2.4 Construct the Baum-Welch Algorithm using the initial parameters defined in step 1.2.3;

[0092] 1.2.4.1 Definition of forward probability α n (i)=p(y1,...,y n ,x n ), whose expression is:

[0093]

[0094] 1.2.4.2 Definition of backward probability β n (i) = p(y n+1 ,...,y N |x n ), whose expression is:

[0095]

[0096] 1.2.4.3 Define the joint posterior probability γ n (i,j)=p(x n =i,x n+1 =j|y n ), whose expression is:

[0097]

[0098] 1.2.4.4 Define the marginal posterior probability x n (i) = p(x n =i|y n ), whose expression is:

[0099]

[0100] 1.3 The parameters and variables are continuously updated through the EM algorithm. In the process of two consecutive parameter iterations, a random martingale is defined, and the Doob martingale maximum inequality theorem is used to determine whether the EM algorithm has converged.

[0101] 1.3.1 Use the Baum-Welch Algorithm to calculate the mathematical expressions of steps 1.2.4.1 to 1.2.4.4;

[0102] 1.3.2 Calculate the mean and variance of each category during the iteration process. The expression of the mean and variance of category i in the q+1th iteration is:

[0103]

[0104] 1.3.3 In each iteration, θ q The parameters are constantly updated, including forward probability, backward probability, joint posterior probability, marginal posterior probability, observation sequence distribution function and probability transfer matrix, and the expressions are:

[0105]

[0106]

[0107] 1.4 In the iterative process, in order to better judge the convergence and avoid the local optimum, the knowledge of martingale theory is introduced to construct a random power martingale based on the image difference function, and the Doob maximum inequality is used to judge whether convergence has been achieved;

[0108] 1.4.1 In the process of parameter iteration, in order to avoid the local optimal situation, a new difference function between iteration results is constructed. The difference function consists of structural similarity function and Hu moment function.

[0109] 1.4.1.1 Structural similarity function measures the similarity between two images by comparing their brightness, contrast and structural similarity. It mainly consists of three parts, namely brightness similarity, contrast similarity and structural similarity. The final expression is composed of the product of the three parts:

[0110]

[0111] Where: μ x and μ y are the means of image x and image y, σ x and σ y are the standard deviations of image x and image y, σ xy is the covariance between the two images, C1, C2, C3 are very small positive numbers added to prevent the denominator from being zero;

[0112] 1.4.1.2 Hu moment function is an image feature description method used to describe the invariance of image shape and geometric features. It has translation, rotation and scale invariance, and constructs seven unique features for shape description. Each moment in the Hu moment function is obtained by combining the second-order or third-order central moments. The expressions are:

[0113] h0=v 20 +v 02 ;

[0114]

[0115] h2=(v 30 -3v 12 ) 2 +(3v 21 -v 03 ) 2 ;

[0116] h3=(v 30 +v 12 )2 +(v 21 +v 03 ) 2 ;

[0117]

[0118] h5=(v 20 -v 02 )[(v 30 +v 12 ) 2 -(v 21 +v 03 ) 2 ]+4v 11 (v 30 +v 11 )(v 21 +v 03 );

[0119]

[0120] Where: f(x,y) is the image pixel value,

[0121] is the second-order central moment of the image, It is the third-order central moment of the image. The Hu moment function vector of the image is composed of h0, h1, h2, h3, h4, h5, and h6. The Euclidean distance between the moment function vectors of two images is the difference of the Hu moment functions of the two images.

[0122] 1.4.1.3 The difference function between the nth and n-1th iterations is constructed from steps 1.4.1.1 and 1.4.1.2, and its expression is:

[0123] p n,n-1 (x,y)=[1-SSIM(x,y)]·Hu_Moment(x,y);

[0124] 1.5 Construct a random martingale from step 4.1.3, and its expression is:

[0125]

[0126] Among them: the random number in ε∈[0,1] is set to 0.92 in the experiment;

[0127] 1.5.1 After constructing the random martingale, use the maximum equality theorem of the martingale to set the threshold and judge the convergence time. The Doob maximum inequality is:

[0128]

[0129] The expectation of a random martingale is generally assumed to be 1, that is:

[0130]

[0131] 1.5.2 After judging convergence, the final segmentation result is obtained through the maximum a posteriori edge probability:

[0132]

[0133] 1.5.3 The result obtained in step 1.5.2 is still a one-dimensional sequence, which is then restored to a two-dimensional image through the above-mentioned Hilbert-Scan scanning matrix, that is, the final segmentation result.

[0134] The feasibility of the medical image segmentation algorithm based on martingale and one-dimensional hidden Markov chain provided by the present invention is verified by a specific test below, and the segmentation result image of the method of the present invention is compared with the K-means segmentation result.

[0135] 1. Working conditions:

[0136] The experiment uses an Intel(R) Core(TM) i5-9400F CPU@2.90GHz processor, a PC running Windows, a GTX 1660 graphics card, and Python as the programming language.

[0137] 2. Experimental content and results analysis:

[0138] By comparing the K-means segmentation results with the four evaluation indicators, it can be seen that this algorithm can better complete the segmentation task and achieve better segmentation results. Table 1 compares this algorithm with the K-means algorithm, specifically the Dice, Jaccard, Recall, and F1 parameters of the gold standard images annotated by the radiologist.

[0139] Table 1 Effect of neural network modeling on integrated imaging display equipment

[0140] Dice Jaccard Recall F1 This algorithm 95.92% 92.15% 98.27% 95.92% K-means 87.90% 78.41% 79.23% 87.90%

[0141] The above experimental results show that the present invention combines the knowledge of martingale theory with the traditional one-dimensional Markov chain and compares it with the traditional classical K-means method, and has achieved great improvements in four important parameter indicators, such as Figure 4 As shown in the segmentation results, we can also intuitively see a better segmentation effect.

Claims

1. A medical image segmentation algorithm based on martingale and one-dimensional hidden Markov chain, characterized in that it comprises the following steps: 1.1 Preprocess the medical images, convert them into one-dimensional sequences, and use the K-means clustering method to obtain prior knowledge, including the following steps: 1.1.1 Use image filtering technology to remove noise in the medical image acquisition process, and use the histogram equalization method to adjust the grayscale histogram of the image, enhance the image contrast, and adapt to the local characteristics of the image; 1.1.2 Using the Hilbert-Scan method, the medical image processed in step 1.1.1 is scanned for dimensionality reduction. The purpose is to convert the two-dimensional image into a one-dimensional sequence, and then input it into the one-dimensional Markov chain for segmentation. The expression of the Hilbert-Scan scan matrix is: in: H2 represents the initial matrix; H T Represents the transposition of a matrix; the matrix The representative size is 2 k A matrix of all 1s; Represents the matrix Perform the row transformation operation in the elementary matrix transformation, swap the positions of the i-th row and the ni-th row, where n represents the number of rows in the matrix. Represents the matrix H 2k Perform the column transformation operation in the elementary matrix transformation, swap the positions of the i-th column and the ni-th column, where n represents the number of columns in the matrix; 1.1.3 Perform K-means clustering on the one-dimensional sequence obtained in step 1.1.

2. The K-means algorithm first initializes k samples as the initial cluster centers a=a1,a2,a3,...,a k , for each element x in the sequence i , calculate its distance to k distance centers, and divide it into the class corresponding to the cluster center with the smallest distance, for each class a i , re-cluster centers And calculate the squared error Until the square error reaches the minimum result; 1.1.4 Take the result of minimizing the square error obtained in step 1.1.3 as the prior knowledge of the one-dimensional Markov chain for the next step of segmentation; 1.2 Combining the one-dimensional Markov chain and the martingale theory to construct a new segmentation model includes the following steps: 1.2.1 Redefine the prior knowledge obtained in step 1.1.4 to construct a one-dimensional Markov chain. Define Z = (X, Y) as a one-dimensional Markov chain, where: X=(X n ) n=1,...,N Defined as a hidden state process; Y = (Y n ) n=1,...,N Defined as the observation state process, in image segmentation, the hidden state represents the category of the pixel point, 0: foreground, 1: background, and the observation state represents the image pixel value; 1.2.2 When constructing a one-dimensional Markov chain, the following three assumptions are made by default: 1.2.2.1X=(X n ) n=1,...,N is a Markov chain, and the expression of distribution probability is: 1.2.2.2 Observation process Y=(Y n ) n=1,...,N About the hidden state process X=(X n ) n=1,...,N are conditionally independent: 1.2.2.3 Each observation y n It only depends on its corresponding hidden state and has nothing to do with other hidden states; p(y n |x)=p(y n |x n ); 1.2.3 Initialize the initial parameters θ of the one-dimensional Markov chain based on the prior knowledge obtained in step 1.1.4 0 ,θ 0 Including the initial probability, that is, the probability of the first point state of the hidden state of the one-dimensional Markov chain L is the number of pixel classes; the transition probability matrix That is x n When the hidden state is i, the next point x n+1 The probability that the state is j; the mean μ for each category i i ; The variance of each category i (σ i ) 2 ; The distribution probability of the observed state under the influence of the hidden state is: 1.2.4 Construct the Baum-Welch Algorithm using the initial parameters obtained in step 1.2.3; 1.2.4.1 Definition of forward probability α n (i)=p(y1,...,y n ,x n ), whose expression is: 1.2.4.2 Definition of backward probability β n (i) = p(y n+1 ,...,y N |x n ), whose expression is: 1.2.4.3 Define the joint posterior probability γ n (i,j)=p(x n =i,x n+1 =j|y n ), whose expression is: 1.2.4.4 Define the marginal posterior probability x n (i) = p(x n =i|y n ), whose expression is: 1.3 The parameters and variables are continuously updated through the EM algorithm. In the process of two consecutive parameter iterations, a random martingale is defined, and the Doob martingale maximum inequality theorem is used to determine whether the EM algorithm has converged. 1.3.1 Use the Baum-Welch Algorithm to calculate the mathematical expressions of steps 1.2.4.1 to 1.2.4.4; 1.3.2 Calculate the mean and variance of each category during the iteration process. The expression of the mean and variance of category i in the q+1th iteration is: 1.3.3 In each iteration, θ q The parameters are constantly updated, including forward probability, backward probability, joint posterior probability, marginal posterior probability, observation sequence distribution function and probability transfer matrix, and the expressions are: 1.4 In the iterative process, in order to better judge the convergence and avoid the local optimum, the knowledge of martingale theory is introduced to construct a random power martingale based on the image difference function, and the Doob maximum inequality is used to judge whether convergence has been achieved; 1.4.1 In the process of parameter iteration, in order to avoid the local optimal situation, a new difference function between iteration results is constructed. The difference function consists of structural similarity function and Hu moment function. 1.4.1.1 Structural similarity function measures the similarity between two images by comparing their brightness, contrast and structural similarity. It mainly consists of three parts, namely brightness similarity, contrast similarity and structural similarity. The final expression is composed of the product of the three parts: in: μ x and μ y are the means of image x and image y, σ x and σ y are the standard deviations of image x and image y, σ xy is the covariance between the two images, C1, C2, C3 are very small positive numbers added to prevent the denominator from being zero; 1.4.1.2 Hu moment function is an image feature description method used to describe the invariance of image shape and geometric features. It has translation, rotation and scale invariance, and constructs seven unique features for shape description. Each moment in the Hu moment function is obtained by combining the second-order or third-order central moments. The expressions are: h0=v 20 +v 02 ; h1=(v 20 -v 02 ) 2 +4v1 2 1; h2=(v 30 -3v 12 ) 2 +(3v 21 -v 03 ) 2 ; h3=(v 30 +v 12 ) 2 +(v 21 +v 03 ) 2 ; h5=(in 20 -in 02 )[(in 30 +v 12 ) 2 -(in 21 +v 03 ) 2 ]+4v 11 (in 30 +v 11 )(in 21 +v 03 ); in: f(x,y) is the image pixel value, is the second-order central moment of the image, It is the third-order central moment of the image. The Hu moment function vector of the image is composed of h0, h1, h2, h3, h4, h5, and h6. The Euclidean distance between the moment function vectors of two images is the difference of the Hu moment functions of the two images. 1.4.1.3 The difference function between the nth and n-1th iterations is constructed from steps 1.4.1.1 and 1.4.1.2, and its expression is: p n,n-1 (x,y)=[1-SSIM(x,y)]·Hu_Moment(x,y); 1.5 Construct a random martingale from step 1.4.1.3, whose expression is: in: The random number in ε∈[0,1] is set to 0.92 in the experiment; 1.5.1 After constructing the random martingale, use the maximum equality theorem of the martingale to set the threshold and judge the convergence time. The Doob maximum inequality is: The expectation of a random martingale is generally assumed to be 1, that is: 1.5.2 After judging convergence, the final segmentation result is obtained through the maximum a posteriori edge probability: 1.5.3 The result obtained in step 1.5.2 is still a one-dimensional sequence, which is then restored to a two-dimensional image through the above-mentioned Hilbert-Scan scanning matrix, that is, the final segmentation result.