A training method and segmentation method based on an eyelid margin segmentation model.
By using the U2-Net model and deep learning algorithms, training and validation sets were constructed, and the eyelid margin segmentation model was optimized. This solved the problems of poor eyelid margin segmentation performance and high computational cost in existing technologies, achieving efficient and low-cost eyelid margin segmentation.
Patent Information
- Application Number
- CN202411352007.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-09-26
AI Technical Summary
In existing technologies, eyelid margin segmentation methods rely on manually designed features or pre-trained models, which are not very effective. Target detection technologies have complex network structures and high computational costs, making them difficult to adapt to different working environments.
An eyelid margin segmentation model based on the U2-Net model is adopted. By constructing a training set and a validation set, the model is optimized using the cross-entropy loss function and gradient descent algorithm. Combined with bilinear interpolation and batch normalization to process the feature map, efficient eyelid margin segmentation is achieved.
It reduces dependence on data volume, adapts to different working environments, improves the accuracy and robustness of eyelid margin segmentation, and reduces computational costs.
Smart Images

Figure CN119229123B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning technology, and in particular to a training method and segmentation method based on an eyelid margin segmentation model. Background Technology
[0002] The eyelid margin is the boundary where the eyelid skin meets the conjunctiva, and a healthy eyelid margin is crucial for maintaining a healthy ocular surface. Blepharitis is a manifestation of eyelid margin inflammation and one of the most common eye diseases. It is estimated that 47% of patients seen by ophthalmologists have blepharitis, which often leads to blepharoconjunctivitis (BKC), meibomian gland dysfunction, and dry eye syndrome. BKC can cause astigmatism, corneal lesions, amblyopia, vision loss, or corneal perforation. Eyelid margin segmentation has wide applications in medical imaging, virtual reality, and augmented reality.
[0003] Currently, eyelid margin segmentation mainly relies on manually designed features or pre-trained models, which often perform poorly when dealing with complex scenes. In addition, although many salient object detection techniques have improved in performance, their network architectures are complex and computationally expensive, and most of them rely on pre-trained backbone networks from image classification tasks, making them difficult to adapt to different working environments.
[0004] Artificial intelligence algorithms, represented by deep learning, have achieved remarkable results in fields such as image classification and object detection thanks to their massive datasets and powerful computing resources. Therefore, there is an urgent need for a deep learning-based eyelid margin segmentation model with a relatively simple network architecture that reduces its dependence on large amounts of data. Summary of the Invention
[0005] (a) Technical problems to be solved
[0006] In view of the above-mentioned shortcomings and deficiencies of the existing technology, the present invention provides a training method and segmentation method based on the eyelid margin segmentation model, which solves the technical problems of the current method relying on manually designed features or pre-trained models having poor performance in handling complex scenes, the technical problems of complex network structure and high computational cost of object detection technology, and the technical problems of the backbone network relying on image classification tasks being difficult to adapt to different working environments.
[0007] (II) Technical Solution
[0008] To achieve the above objectives, the main technical solutions adopted by the present invention include:
[0009] In a first aspect, embodiments of the present invention provide a method for training an eyelid margin segmentation model, comprising:
[0010] S1. Construct a data training set based on a pre-set eye image dataset; the data training set includes at least one eye image data and a mask corresponding to each eye image data;
[0011] S2. Train the pre-constructed eyelid margin segmentation model based on the data training set to obtain the trained eyelid margin segmentation model; the eyelid margin segmentation model is based on U... 2 The -Net model includes an N-level first encoder and an N-1-level first decoder; all first encoders and first decoders are composed of feature extraction structures RSU-L or RSU-4F.
[0012] During training, when any first encoder receives input data, it outputs a result according to a pre-set formula:
[0013] E i =RSU(E i-1 );
[0014] Among them, E i For the output of the first encoder at level i, when i = 1, E i-1 This refers to the initial image data input to the eyelid margin segmentation model;
[0015] When any of the first decoders receives input data, it outputs a result according to a pre-set formula two, which is:
[0016] D i =RSU(D i+1 +E i );
[0017] Where, when i = N-1, D i+1 For E i+1 Di is the output of the i-th decoder, i.e., the first decoder.
[0018] Optionally, the method further includes:
[0019] When any feature extraction structure RSU-L or RSU-4F receives input data, the convolutional layer obtains the first process feature map based on the received input data and the pre-set Formula 3;
[0020] Formula 3 is as follows:
[0021] z p,j,o =(x*W o ) i,j +b o ;
[0022] Where p and j are the indices of the first process feature map, z is the first process feature map output by the convolutional layer, * represents the convolution operation, x is the input image data, and Wo For the o-th convolutional kernel, b o This is the o-th bias, where o is the channel number;
[0023] Subsequently, the first process feature map is batch normalized and the input value is activated based on the pre-set batch normalization formula and ReLU activation function;
[0024] The batch normalization formula is:
[0025]
[0026] Among them, u o and σ o These are the mean and variance of the o-th feature map, respectively, and ∈ is a pre-set constant;
[0027] The ReLU activation function is:
[0028]
[0029] Then, the first-process feature map, after batch normalization and ReLU activation function processing, is downsampled according to the pre-set max pooling formula, which is:
[0030] y p,j,o =max s,f (a p+s,j+f,o );
[0031] Where (s, f) is the pre-set pooling window size;
[0032] Finally, the downsampled first process feature map is upsampled according to the pre-set bilinear interpolation formula to obtain the second process feature map;
[0033] The bilinear interpolation formula is as follows:
[0034]
[0035] Where (X, Y) represents the position of the difference in the feature map of the first process, I p,j w represents the pixel values of the four pixels surrounding (X, Y). pj The pre-set interpolation weights.
[0036] Optionally, S2 further includes:
[0037] During training, the difference between the model prediction and the mask is obtained according to the pre-set cross-entropy loss function, and the model is optimized by the pre-set gradient descent algorithm until a well-trained eyelid margin segmentation model is obtained.
[0038] The cross-entropy loss function is:
[0039]
[0040] in, The difference between the model's prediction and the mask is represented by M, where M is the number of eye image data in the training set, and y is the number of images in the training set. k This is the mask corresponding to the eye image data with ID k. This is the prediction result for the eye image data numbered k.
[0041] Optionally, the gradient descent algorithm is the AdamW optimizer, and the update formula of the AdamW optimizer is:
[0042]
[0043] Where, m t and v t Here, η is the momentum term, λ is the learning rate, λ is the weight decay coefficient, θ is the model parameter, β1 and β2 are the momentum parameters, and t is the number of iterations.
[0044] Optionally, if N is 6, then the eyelid margin segmentation model includes a 6-level first encoder, a 5-level first decoder, and a saliency map fusion unit;
[0045] The first four encoders are RSU-7, RSU-6, RSU-5 and RSU-4, and the first four decoders are RSU-7, RSU-6, RSU-5 and RSU-4; the first encoder of the fifth stage, the first encoder of the sixth stage and the first decoder of the fifth stage are all RSU-4F.
[0046] The input of the first encoder of the first level is the initial input of the eyelid margin segmentation model. The input of any first encoder other than the first encoder of the first level is the output of the first encoder of the previous level.
[0047] In the first four levels of the first decoder, the input of any first decoder is the result of concatenating the output of the first encoder at the same level as the first decoder and the output of the first decoder at the next level of the first decoder.
[0048] The input to the first decoder of the fifth stage is the result of concatenating the output of the first encoder of the fifth stage and the output of the first encoder of the sixth stage.
[0049] Optionally, each RSU-L includes L second encoders and L-1 second decoders;
[0050] The RSU-4F is a symmetrical encoder structure with a height of 4, the same as the RSU-L;
[0051] L is a non-zero natural number.
[0052] Optionally, S1 includes:
[0053] All eye image data in the pre-set eye image dataset are preprocessed, and a data training set is constructed based on the preprocessed eye image dataset.
[0054] The preprocessing includes normalization, size scaling, and noise removal.
[0055] Optionally, S2 further includes:
[0056] The trained eyelid margin segmentation model was evaluated using a pre-set data validation set, and the hyperparameters of the eyelid margin segmentation model were adjusted based on the performance evaluation results.
[0057] Secondly, embodiments of the present invention provide a method for segmenting the eyelid margin, the segmentation method being based on a trained eyelid margin segmentation model, comprising:
[0058] S3. Input the received original feature image into the trained eyelid margin segmentation model for image segmentation processing to obtain the segmented image corresponding to the original feature image; the segmented image is the image of the extracted eyelid margin region.
[0059] Optionally, S3 includes:
[0060] The received original feature image is input into the trained eyelid margin segmentation model for image segmentation processing to obtain the segmented image corresponding to the original feature image;
[0061] During this process, the outputs of the last encoder and all decoders are processed by 3×3 convolution and the Sigmoid function to output a corresponding saliency probability map from the first encoder and all first decoders of the last stage, respectively.
[0062] All output saliency probability maps are upsampled to the same size as the original feature image and then fused through a cascade operation;
[0063] A segmented image corresponding to the original feature image is generated by using a 1×1 convolutional layer and a sigmoid function;
[0064] The eyelid margin segmentation model also includes a saliency map fusion unit.
[0065] (III) Beneficial Effects
[0066] The beneficial effects of the present invention are: the eyelid margin model training method of the present invention, by adopting artificial intelligence algorithms represented by deep learning, can reduce the dependence on the amount of data with a relatively simple network architecture compared with the prior art, and can adapt to different working environments. Attached Figure Description
[0067] Figure 1 This is a flowchart of a training method for an eyelid margin segmentation model.
[0068] Figure 2 This is a schematic diagram of the original feature image;
[0069] Figure 3 This is a schematic diagram of the segmentation result corresponding to the original feature map;
[0070] Figure 4 This is a schematic diagram of the eyelid margin segmentation model. Detailed Implementation
[0071] To better explain and facilitate understanding of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0072] The eyelid margin model training method proposed in this invention adopts artificial intelligence algorithms represented by deep learning. Compared with existing technologies, it can reduce the dependence on data volume with a relatively simple network architecture and can adapt to different working environments.
[0073] To better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present invention can be understood more clearly and thoroughly, and that the scope of the present invention can be fully conveyed to those skilled in the art.
[0074] Example 1
[0075] This embodiment provides a training method for an eyelid margin segmentation model and an eyelid margin segmentation method. The training method is as follows: Figure 1 As shown, it includes:
[0076] S1. Construct a training set based on a pre-set dataset of eye images;
[0077] S2. Train the pre-constructed eyelid margin segmentation model based on the data training set to obtain the trained eyelid margin segmentation model.
[0078] S1 includes: collecting eye image data containing the eyelid margin, constructing an eye image dataset, the eye image dataset including high-resolution eye image data, and performing detailed annotation on each eye image data (i.e., the mask corresponding to each eye image data) to ensure the accuracy and integrity of the data.
[0079] All eye images in the eye image dataset are preprocessed, including image normalization, resizing, and noise removal. Normalization helps eliminate differences in brightness and contrast between images, resizing ensures the images meet the model input requirements, and noise removal improves image quality.
[0080] The eye image dataset was divided into a training set and a validation set in an 8:2 ratio.
[0081] S2 includes: training the eyelid margin segmentation model using a data training set; the eyelid margin segmentation model is based on U... 2 -Net model, while U 2 The -Net model is a deep learning network architecture designed specifically for image segmentation tasks. It achieves efficient feature extraction and segmentation through a combination of encoders and decoders.
[0082] During training, the cross-entropy loss function is used to calculate the difference between the model's prediction and the actual label (i.e., the difference between the model's prediction and the mask), and the model parameters are continuously optimized through the gradient descent algorithm to improve the model's segmentation accuracy.
[0083] The cross-entropy loss function is:
[0084]
[0085] in, The difference between the model's prediction and the mask is represented by M, where M is the number of eye image data in the training set, and y is the number of images in the training set. k This is the mask corresponding to the eye image data with ID k. This is the prediction result for the eye image data numbered k.
[0086] The gradient descent algorithm typically uses the AdamW optimizer, whose update formula is:
[0087]
[0088] Where, m t and v t Here, η is the momentum term, λ is the learning rate, λ is the weight decay coefficient, θ is the model parameter, β1 and β2 are the momentum parameters, and t is the number of iterations.
[0089] The trained eyelid margin segmentation model was evaluated using a data validation set. By adjusting the model's hyperparameters, the model's generalization ability on different datasets was ensured, thereby improving the model's robustness and accuracy.
[0090] Eyelid margin segmentation methods include: segmenting the eye image to be processed (i.e., the original feature image, such as...) Figure 2 (As shown) Input the trained eyelid margin segmentation model and perform segmentation processing. The eyelid margin segmentation model generates segmentation results based on the image features of the original feature image, such as... Figure 3 As shown, the eyelid margin region of interest is extracted, and these segmentation results can be used for subsequent eyelid margin health status analysis and diagnosis.
[0091] This embodiment provides a training method and a method for eyelid margin segmentation, which do not rely on a pre-trained backbone network, are trained from scratch, and can adapt to different working environments.
[0092] Example 2
[0093] This embodiment provides a training method for an eyelid margin segmentation model, including:
[0094] Based on a pre-trained eye image dataset, a training set and a validation set are constructed.
[0095] Train the pre-constructed eyelid margin segmentation model based on the data training set to obtain the trained eyelid margin segmentation model;
[0096] The eyelid margin segmentation model is based on U 2 -Net model, such as Figure 4 As shown, it includes a 6-level first encoder and a 5-level first decoder; the first 4 levels of the first encoder (En_1, En_2, En_3, and En_4) are RSU-7, RSU-6, RSU-5, and RSU-4 structures respectively, and the first 4 levels of the first decoder (De_1, De_2, De_3, and De_4) are RSU-7, RSU-6, RSU-5, and RSU-4 structures respectively; the 5th level first encoder, the 6th level first encoder, and the 5th level first decoder (En_5, En_6, and De_5) are all RSU-4F structures; each RSU-L includes L second encoders and L-1 second decoders; RSU-4F is a symmetrical encoder structure with a height of 4 and the same as RSU-L; L is a non-zero natural number.
[0097] The input to the first encoder of the first level is the initial input to the eyelid margin segmentation model. The input to any first encoder other than the first encoder of the first level is the output of the first encoder of the previous level. In the first four first decoders, the input to any first decoder is the result of concatenating the output of the first encoder of the same level as the first decoder and the output of the first decoder of the next level. The input to the first decoder of the fifth level is the result of concatenating the output of the first encoder of the fifth level and the output of the first encoder of the sixth level.
[0098] That is, the input of En_1 is the original feature image of the eyelid margin segmentation model, the input of En_2 is the output of En_1, the input of En_3 is the output of En_2, the input of En_4 is the output of En_3, the input of En_5 is the output of En_4, and the input of En_6 is the output of En_5.
[0099] The input to De_1 is the result of concatenating the outputs of En_1 and De_2; the input to De_2 is the result of concatenating the outputs of En_2 and De_3; the input to De_3 is the result of concatenating the outputs of En_3 and De_4; the input to De_4 is the result of concatenating the outputs of En_4 and De_5; and the input to De_5 is the result of concatenating the outputs of En_5 and En_6.
[0100] That is, during the training process, when any first encoder receives input data, it outputs a result according to a pre-set formula, which is:
[0101] E i =RSU(E i-1 );
[0102] Among them, E i For the output of the first encoder at level i, when i = 1, E i-1 This refers to the initial image data input to the eyelid margin segmentation model;
[0103] When any of the first decoders receives input data, it outputs a result according to a pre-set formula two, which is:
[0104] D i =RSU(D i+1 +E i );
[0105] Where, when i = N-1, D i+1 For E i+1 Di is the output of the i-th decoder, i.e., the first decoder.
[0106] When any feature extraction structure RSU-L or RSU-4F receives input data, the convolutional layer obtains the first process feature map based on the received input data and the pre-set Formula 3;
[0107] Formula 3 is as follows:
[0108] z p,j,o =(x*W o )i,j +b o ;
[0109] Where p and j are the indices of the first process feature map, z is the first process feature map output by the convolutional layer, * represents the convolution operation, x is the input image data, and W o For the o-th convolutional kernel, b o This is the o-th bias, where o is the channel number;
[0110] Subsequently, the first process feature map is batch normalized and the input value is activated based on the pre-set batch normalization formula and ReLU activation function;
[0111] The batch normalization formula is:
[0112]
[0113] Among them, u o and σ o These are the mean and variance of the o-th feature map, respectively, and ∈ is a pre-set constant;
[0114] The ReLU activation function is:
[0115]
[0116] Then, the first-process feature map, after batch normalization and ReLU activation function processing, is downsampled according to the pre-set max pooling formula, which is:
[0117] y p,j,o =max s,f (a p+s,j+f,o );
[0118] Where (s, f) is the pre-set pooling window size;
[0119] Finally, the downsampled first process feature map is upsampled according to the pre-set bilinear interpolation formula to obtain the second process feature map;
[0120] The bilinear interpolation formula is as follows:
[0121]
[0122] Where (X, Y) represents the position of the difference in the feature map of the first process, I p,j w represents the pixel values of the four pixels surrounding (X, Y). pj The pre-set interpolation weights.
[0123] This embodiment provides a training method for an eyelid margin segmentation model, which adopts a double-layer nested U structure and RSU block design. This method can effectively extract multi-scale features and achieve high-precision eyelid margin segmentation. The RSU block maintains high resolution without significantly increasing computational cost, making it suitable for environments with limited computing resources.
[0124] Example 3
[0125] A training method for an eyelid margin segmentation model, which is based on multi-stage adaptive training using contrastive learning and few-shot learning, and is based on the pre-constructed eyelid margin segmentation model in Embodiment 1 or Embodiment 2 above, including:
[0126] We collected a large amount of unlabeled eye image data including eyelid margins to construct a dataset, and used this dataset to perform self-supervised pre-training of the eyelid margin segmentation model using contrastive learning. By comparing the multi-view representations of the images, the eyelid margin segmentation model learns to extract key features of the images without relying on labels.
[0127] We collect a small amount of labeled data to perform few-shot learning on the eyelid margin segmentation model. We adopt a meta-learning framework based on contrastive learning, which enables the model to quickly adapt and learn when faced with a small number of new task samples and generate high-quality segmentation results.
[0128] Building upon contrastive learning and few-shot learning, we designed a multi-stage adaptive training process, with each stage optimized for different individuals or datasets. These stages can combine contrastive learning and few-shot learning techniques to improve the model's generalization ability and learning efficiency on small datasets.
[0129] At each stage of training, task-specific data augmentation samples are dynamically generated using Generative Adversarial Networks (GANs) or Variational Autoencoders (VAEs), particularly for sample types where the model performs poorly on the current task (e.g., complex shapes, low-contrast images). Specifically, a series of data transformation operations, such as image rotation, flipping, and scaling, are designed to generate a sample set based on specific needs. A new dataset is then generated using a pre-trained generative model, such as a GAN or VAE, based on the aforementioned sample set.
[0130] Reinforcement learning mechanisms dynamically adjust task weights in multi-task learning. They use environmental feedback to determine the weights of the loss function for each task (such as edge detection, region segmentation, and semantic segmentation) in each training iteration, thereby optimizing segmentation performance. Essentially, they use a pre-defined search algorithm (such as reinforcement learning) to directly search for the best augmentation strategy on the dataset of interest; these strategies can incorporate hyperparameters of various image processing operations and responses.
[0131] By introducing a dynamic feature fusion and decoupling mechanism, within a multi-task learning framework, the model can automatically select to fuse feature representations from different tasks, or decouple these features when needed to prevent information interference. This dynamic feature fusion and decoupling mechanism allows the model to flexibly switch between shared features or independent learning across different tasks, improving the model's adaptability and segmentation accuracy, especially in complex or variable task environments.
[0132] Subsequently, an adversarial training mechanism is introduced to process the pre-collected original sample set, generating an adversarial example set. By perturbing the input data, the robustness of the model is tested and enhanced. Adversarial training can effectively improve the model's ability to cope with various input disturbances, especially in practical applications where the input data may contain noise, bias, or other issues, yet the model can still maintain stable segmentation results. Specifically, adversarial attack methods (such as FGSM and PGD) are used to generate the adversarial example set, which is then mixed with the original sample set to form an enhanced dataset. The model is trained using this enhanced dataset.
[0133] Subsequently, the uncertainty of the model in each prediction is estimated, and the model's prediction output is adaptively adjusted or post-processed according to the uncertainty level. Bayesian neural networks or Monte Carlo-based Dropout methods can be introduced for uncertainty assessment. Through uncertainty estimation, the model can identify high-risk prediction regions, and further refinement or output adjustment can be performed in these regions, thereby improving the reliability of the overall segmentation.
[0134] Example 4
[0135] A method for training an eyelid margin segmentation model, the method being based on a pre-constructed eyelid margin segmentation model as described in Embodiment 1 or Embodiment 2 above, comprising:
[0136] A pre-built eyelid margin segmentation model is trained based on the data training set, and the loss function value is calculated. The model parameters are updated through backpropagation algorithm. When the number of iterations reaches the maximum, the regularization parameter B with the smallest loss function value obtained during the iteration process is selected as the optimal regularization parameter. The regularization parameter obtained through Bayesian optimization is used to verify the performance of the model using a pre-set validation dataset. After the validation is completed, the model corresponding to the optimal regularization parameter is the final trained eyelid margin segmentation model.
[0137] Specifically, the randomly selected regularization parameter B is used as the input a of F(a), and the corresponding loss value is used as the output R, where R = F(a). The output F(a) is then generated by a Gaussian process and expressed as:
[0138] F(a)~GP(c(a),v(a,a′));
[0139] Where c(a) is the mean function and v(a, a′) is the covariance function;
[0140] For a set of parameters, we obtain an output R, which is used to update the Gaussian process in the next iteration. Let D represent all the data, then we have:
[0141] D={(a1, R1), (a2, R2),…,(a n R n )};
[0142] Then the mean μ(A) and variance σ of the Gaussian process are obtained. 2 .
[0143] Use expectation maximization to select a new a * To perform the next Gaussian process, where a * =arg max a∈A Given μ(x), add an exploration term based on the expected value maximization. If the exploration term is set to a Gaussian distribution, then the new a... * Represented as: a * =arg max a∈A μ(x) + Uσ(x);
[0144] Where U is the exploration coefficient, and σ(x) is the prediction standard deviation of the Gaussian process at sample point a;
[0145] By continuously calculating, the maximum expected value point a is obtained. * The Gaussian process is updated with the minimum value of the highest probability predicted with the fewest computational steps, corresponding to the actual value of R(x).
[0146] Repeat the selection of parameter combinations for the next sampling point and perform Gaussian and update Gaussian processes until the maximum number of iterations is reached or the termination condition is met. At this point, a * The optimal regularization parameter is used to obtain a well-trained eyelid margin segmentation model.
[0147] Bayesian optimization is used to automatically select and adjust the model's hyperparameters, ensuring optimal performance in different application scenarios. Automated hyperparameter optimization reduces manual intervention and trial-and-error costs, improves model tuning efficiency, and ensures high model performance before deployment.
[0148] Example 5
[0149] A method for segmenting the eyelid margin, the method being based on an eyelid margin segmentation model trained in any of the embodiments 1 to 3 above, comprising:
[0150] S3. Employ edge computing or hybrid cloud computing to achieve real-time adaptive deployment of the model;
[0151] The received original feature image is input into the trained eyelid margin segmentation model for image segmentation processing to obtain the segmented image corresponding to the original feature image; the segmented image is the image with the eyelid margin region extracted.
[0152] During this process, the outputs of the last encoder and all decoders are processed by 3×3 convolution and the Sigmoid function to output a corresponding saliency probability map from the first encoder and all first decoders of the last stage, respectively.
[0153] All output saliency probability maps are upsampled to the same size as the original feature image and then fused through a cascade operation;
[0154] A segmented image corresponding to the original feature image is generated by using a 1×1 convolutional layer and a sigmoid function;
[0155] The eyelid margin segmentation model also includes a saliency map fusion unit.
[0156] This embodiment uses a U-based approach. 2 -Net's eyelid margin segmentation model does not rely on a pre-trained backbone network and can be trained from scratch, adapting to different working environments while reducing its dependence on computing resources.
[0157] In the description of this invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0158] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0159] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can mean that the first and second features are in direct contact, or that they are in indirect contact through an intermediate medium. Furthermore, "above," "over," or "on top" the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," or "beneath" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.
[0160] In the description of this specification, the terms "one embodiment," "some embodiments," "embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0161] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make modifications, alterations, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A training method for an eyelid margin segmentation model, characterized in that, include: S1. Generate an adversarial sample set based on the adversarial attack algorithm and a pre-set eye image dataset, and mix the adversarial sample set with the eye image dataset to construct a data training set; The training set of data includes at least one eye image data and a mask corresponding to each eye image data; S2. Train the pre-constructed eyelid margin segmentation model based on the data training set to obtain the trained eyelid margin segmentation model; the eyelid margin segmentation model is based on U... 2 The -Net model includes an N-level first encoder and an N-1-level first decoder; all first encoders and first decoders are composed of feature extraction structures RSU-L or RSU-4F. During training, when any first encoder receives input data, it outputs a result according to a pre-set formula: AND i =RSU(E i-1 ); Among them, E i For the output of the first encoder at level i, when i = 1, E i-1 This refers to the initial image data input to the eyelid margin segmentation model; When any of the first decoders receives input data, it outputs a result according to a pre-set formula two, which is: D i =RSU(D i+1 +E i ); Where, when i = N-1, D i+1 For E i+1 , D i This is the output of the first decoder at stage i; S2 further includes: During training, the difference between the model's prediction and the mask is obtained based on a pre-set cross-entropy loss function. The model is then optimized using a pre-set gradient descent algorithm. When the number of iterations reaches its maximum, a regularization parameter B is randomly selected as the input a of the pre-set mapping function F(a), and the corresponding loss value is used as the output R, where R = F(a). The output F(a) is generated by a Gaussian process and is expressed as: F(a)~GP(c(a),v(a,a′)); Where c(a) is the mean function and v(a,a′) is the covariance function; Based on the mapping function F(a), the output R corresponding to any set of parameters is obtained. This output is used to update the next Gaussian process. Let D represent all the data, then: D={(a1,R1),(a2,R2),…,(a n ,R n )}; Obtain the mean μ(A) and variance σ of the Gaussian process. 2 ; Select a new 'a' based on the expectation-maximization algorithm. * Perform the next Gaussian process, where a * =argmax a∈A μ(x)+Uσ(x), where U is the exploration coefficient and σ(x) is the prediction standard deviation of the Gaussian process at sample point a; Repeat the selection of parameter combinations for the next sampling point and perform Gaussian and update Gaussian processes until the maximum number of iterations is reached or the termination condition is met. At this point, a * The optimal regularization parameters are used to obtain the trained eyelid margin segmentation model. The cross-entropy loss function is: in, The difference between the model's prediction and the mask is represented by M, where M is the number of eye image data in the training set, and y is the number of images in the training set. k This is the mask corresponding to the eye image data with ID k. The prediction result is for the eye image data numbered k; During training, the uncertainty in each prediction is evaluated, and the prediction results are post-processed based on the evaluation results of the uncertainty.
2. The training method for the eyelid margin segmentation model according to claim 1, characterized in that, The method further includes: When any feature extraction structure RSU-L or RSU-4F receives input data, the convolutional layer obtains the first process feature map based on the received input data and the pre-set Formula 3; Formula 3 is as follows: z p,j,o =(x*W o ) i,j +b o ; Where p and j are the indices of the first process feature map, z is the first process feature map output by the convolutional layer, * represents the convolution operation, x is the input image data, and W o For the o-th convolutional kernel, b o This is the o-th bias, where o is the channel number; Subsequently, the first process feature map is batch normalized and the input value is activated based on the pre-set batch normalization formula and ReLU activation function; The batch normalization formula is: Among them, u o and σ o These are the mean and variance of the o-th feature map, respectively, and ∈ is a pre-set constant; The ReLU activation function is: Then, the first-process feature map, after batch normalization and ReLU activation function processing, is downsampled according to the pre-set max pooling formula, which is: and p,j,o =max s,f (to p+s,j+f,o ); Where (s, f) is the pre-set pooling window size; Finally, the downsampled first process feature map is upsampled according to the pre-set bilinear interpolation formula to obtain the second process feature map; The bilinear interpolation formula is as follows: Where (X, Y) represents the position of the difference in the feature map of the first process, I p,j w represents the pixel values of the four pixels surrounding (X, Y). pj The pre-set interpolation weights.
3. The training method for the eyelid margin segmentation model according to claim 1, characterized in that, The gradient descent algorithm is the AdamW optimizer, and the update formula of the AdamW optimizer is: Where, m t and v t Here, η is the momentum term, λ is the learning rate, λ is the weight decay coefficient, θ is the model parameter, β1 and β2 are the momentum parameters, and t is the number of iterations.
4. The training method for the eyelid margin segmentation model according to claim 1, characterized in that, If N is 6, then the eyelid margin segmentation model includes a 6-level first encoder, a 5-level first decoder, and a saliency map fusion unit. The first four encoders are RSU-7, RSU-6, RSU-5 and RSU-4, and the first four decoders are RSU-7, RSU-6, RSU-5 and RSU-4; the first encoder of the fifth stage, the first encoder of the sixth stage and the first decoder of the fifth stage are all RSU-4F. The input of the first encoder of the first level is the initial input of the eyelid margin segmentation model. The input of any first encoder other than the first encoder of the first level is the output of the first encoder of the previous level. In the first four levels of the first decoder, the input of any first decoder is the result of concatenating the output of the first encoder at the same level as the first decoder and the output of the first decoder at the next level of the first decoder. The input to the first decoder of the fifth stage is the result of concatenating the output of the first encoder of the fifth stage and the output of the first encoder of the sixth stage.
5. The training method for the eyelid margin segmentation model according to claim 1, characterized in that, Each RSU-L includes L second encoders and L-1 second decoders; The RSU-4F is a symmetrical encoder structure with a height of 4, the same as the RSU-L; L is a non-zero natural number.
6. The training method for the eyelid margin segmentation model according to claim 1, characterized in that, S1 includes: All eye image data in the pre-set eye image dataset are preprocessed, and a data training set is constructed based on the preprocessed eye image dataset. The preprocessing includes normalization, size scaling, and noise removal.
7. The training method for the eyelid margin segmentation model according to claim 1, characterized in that, S2 further includes: The trained eyelid margin segmentation model was evaluated using a pre-set data validation set, and the hyperparameters of the eyelid margin segmentation model were adjusted based on the performance evaluation results.
8. A method for segmenting the eyelid margin, said segmentation method being based on an eyelid margin segmentation model trained according to any one of claims 1 to 7, characterized in that, The segmentation method includes: S3. Input the received original feature image into the trained eyelid margin segmentation model for image segmentation processing to obtain the segmented image corresponding to the original feature image; the segmented image is the image of the extracted eyelid margin region.
9. The method for segmenting the eyelid margin according to claim 8, characterized in that, S3 includes: The received original feature image is input into the trained eyelid margin segmentation model for image segmentation processing to obtain the segmented image corresponding to the original feature image; During this process, the outputs of the last encoder and all decoders are processed by 3×3 convolution and the Sigmoid function to output a corresponding saliency probability map from the first encoder and all first decoders of the last stage, respectively. All output saliency probability maps are upsampled to the same size as the original feature image and then fused through a cascade operation; A segmented image corresponding to the original feature image is generated by using a 1×1 convolutional layer and a sigmoid function; The eyelid margin segmentation model also includes a saliency map fusion unit.
Citation Information
Patent Citations
Eye upper blepharoptosis automatic identification method based on image deep learning
CN117523633A