A method for constructing an endoscopic image grading model based on in-domain pre-training
By employing a two-stage transfer learning approach based on in-domain pre-training, the backbone network is first fine-tuned on a large dataset, and then a hierarchical learning rate strategy is configured under small sample conditions. This addresses the issues of insufficient backbone network adaptation and overfitting in endoscopic image grading models, thereby improving the model's grading stability and generalization ability.
Patent Information
- Application Number
- CN202611373898.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-07
- Publication Date
- 2026-11-27
AI Technical Summary
In existing technologies, when weights pre-trained from natural images are directly transferred to endoscopic image tasks, the backbone network fails to effectively adapt to the texture and illumination distribution of endoscopic images, resulting in limited ability to represent endoscopic-specific visual features. Furthermore, inappropriate parameter update strategies for the backbone layer and classification head under small sample conditions lead to overfitting and insufficient generalization.
A two-stage transfer learning approach based on in-domain pre-training is adopted. First, the initial deep learning model is fine-tuned for multi-class classification using a large dataset of publicly available digestive endoscopy images. The backbone network weights are extracted and loaded into the backbone layer of the target hierarchical model. The classification head is randomly initialized. Then, under small sample conditions, a hierarchical learning rate strategy is used to allocate low and high learning rates to the backbone layer and the classification head respectively for transfer fine-tuning.
It improves the feature representation ability of the endoscopic image grading model under small sample conditions, suppresses overfitting, enhances the grading stability and generalization ability of the model, and improves the feasibility of model construction without additional labeled samples.
Smart Images

Figure CN123181918A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent medical image analysis and deep learning modeling technology, and in particular to a method for constructing an endoscopic image grading model based on in-domain pre-training. Background Technology
[0002] In the field of intelligent medical image analysis, transfer learning, which uses convolutional neural network weights pre-trained on large-scale natural image datasets such as ImageNet as the initial parameters of the backbone network and then fine-tunes them on target medical task data, has become a common technical approach for medical image classification, grading, and detection. This approach leverages the diverse natural images covered by ImageNet, enabling the model to possess relatively universal low-level visual feature extraction capabilities, and typically achieves good convergence and generalization in medical image tasks. In endoscopic image grading tasks, existing solutions also largely follow this approach, directly initializing the backbone network with ImageNet pre-trained weights and then fine-tuning the model on digestive endoscopy image data to construct an endoscopic image lesion grading model.
[0003] However, natural images such as those from ImageNet and endoscopic images exhibit significant inter-domain differences in imaging methods, texture structures, and illumination distribution. Directly using pre-trained weights from natural images for fine-tuning means the backbone network hasn't been effectively adapted to the distribution of endoscopic image data. This limits its ability to perceive and represent endoscopic-specific visual features such as lesion texture and illumination changes, thus restricting the model's accuracy in endoscopic grading tasks. Furthermore, when building grading models for specific target diseases, the number of labeled samples is often scarce. If the same parameter update strategy is used indiscriminately for the backbone layer (used to maintain intra-domain features) and the classification head (used to adapt to the target disease's discrimination boundary) during the fine-tuning stage, the learned representations of the backbone layer are easily shifted by small-sample noise, and the classification head struggles to converge sufficiently, leading to overfitting and undergeneralization, thus affecting the model's grading stability under small-sample conditions. Summary of the Invention
[0004] This application provides a method for constructing an endoscopic image grading model based on intradomain pre-training, aiming to solve one of the problems or issues of the prior art mentioned in the background art above.
[0005] This application provides a method for constructing a domain-pretrained endoscopic image grading model, specifically including: Obtain a convolutional neural network backbone network initialized with ImageNet pre-trained weights and a large dataset of publicly available digestive endoscopy images. Use the large dataset of publicly available digestive endoscopy images as source domain training data and construct an initial deep learning model containing a classification layer based on the convolutional neural network backbone network. Based on the source domain training data, the initial deep learning model is subjected to multi-class fine-tuning, which enables the convolutional neural network backbone network to learn the texture and illumination distribution patterns of the endoscopic image. The classification layer is removed from the fine-tuned initial deep learning model and the backbone network weights are extracted to generate in-domain pre-trained backbone weights. The pre-trained backbone weights within the domain are loaded into the backbone layer of the target classification model, and a random initialization operation is performed on the classification head of the target classification model to generate the target transfer learning architecture to be adapted to the target disease. A private small sample queue is obtained as training data for the target domain. Based on the training data for the target domain and the target transfer learning architecture, a hierarchical learning rate strategy configuration is established, and low learning rate and high learning rate are respectively assigned to the backbone layer and the classification head of the target transfer learning architecture. The hierarchical learning rate strategy is used to perform transfer fine-tuning iterative calculations on the target transfer learning architecture to suppress small sample overfitting and optimize the classification head parameters of the target transfer learning architecture, thereby generating an endoscopic image grading model for the target disease.
[0006] This application provides a method for constructing a domain-pretrained endoscopic image grading model, which has the following beneficial effects: A two-stage transfer learning approach based on in-domain pre-training is adopted. First, a large dataset of publicly available digested endoscopy images is used as the source domain training data to perform multi-class fine-tuning on the initial deep learning model, enabling the backbone network to learn the texture and illumination distribution patterns of endoscopy images. Then, the in-domain pre-trained backbone weights extracted from this approach are used to initialize the backbone layer of the target transfer learning architecture for the target disease. This allows the model to have the feature perception and representation foundation of the endoscopy image domain before training with a small sample of the target disease, thus improving the problem of limited ability to represent endoscopy-specific visual features such as lesion texture and illumination changes when directly transferring with natural image weights. Under the condition of small sample size for the target disease, the established hierarchical learning rate strategy is used to allocate low and high learning rates to the backbone layer and classifier head of the target transfer learning architecture, respectively. In the transfer fine-tuning iteration calculation, this is used to suppress overfitting in small sample size and optimize the classifier head parameters. This allows the backbone layer to maintain the learned intra-domain representation during the fine-tuning process and the classifier head to converge to the target disease classification task. This alleviates the overfitting and insufficient generalization caused by the backbone layer representation being easily affected by noise and the classifier head not being able to converge sufficiently under the condition of small sample size. The above technical solution can be achieved by relying on basic steps such as data acquisition, intra-domain pre-training, weight transfer, hierarchical learning rate and transfer fine-tuning. It does not require supplementing the model with additional target disease labeled samples before training, thereby improving the feasibility and stability of endoscopic image grading model construction in the case of limited private labeled data. Attached Figure Description
[0007] Figure 1 This is the main flowchart of a method for constructing an endoscopic image grading model based on in-domain pre-training; Figure 2 This is a sub-flowchart of a method for constructing an endoscopic image grading model based on in-domain pre-training; Figure 3 This is another sub-flowchart of a method for constructing an endoscopic image grading model based on in-domain pre-training. Detailed Implementation
[0008] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0009] The following disclosure provides numerous different embodiments or examples for implementing various embodiments of the invention. To simplify the disclosure, steps and processes of specific embodiments are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples.
[0010] like Figure 1 As shown, this application provides a method for constructing an endoscopic image grading model based on intra-domain pre-training, specifically including: S1: Obtain a convolutional neural network backbone network initialized with ImageNet pre-trained weights and a large dataset of publicly available digestive endoscopy images. Use the large dataset of publicly available digestive endoscopy images as source domain training data, and construct an initial deep learning model containing a classification layer based on the convolutional neural network backbone network.
[0011] By initializing the backbone network with ImageNet pre-trained weights and using a large dataset of publicly available digestive endoscopy images as the source domain training data, the initial deep learning model can obtain a diverse and sufficient number of endoscopy image samples as the basis for in-domain learning while transferring general visual features of natural images.
[0012] S2: Based on the source domain training data, perform multi-class fine-tuning on the initial deep learning model, so that the convolutional neural network backbone network learns the texture and illumination distribution patterns of the endoscopic image, removes the classification layer from the fine-tuned initial deep learning model and extracts the backbone network weights to generate in-domain pre-trained backbone weights.
[0013] Therefore, based on the initial deep learning model and the source domain training data, multi-class fine-tuning is performed to enable the backbone network to form an intra-domain representation ability of the texture and illumination distribution of endoscopic images. This improves the situation where the perception of endoscopic-specific visual features is insufficient when fine-tuning directly with natural image weights. Furthermore, by removing the classification layer and extracting the backbone network weights, this representation ability is solidified into intra-domain pre-trained backbone weights.
[0014] S3: Load the pre-trained backbone weights in the domain into the backbone layer of the target classification model, and perform random initialization on the classification head of the target classification model to generate the target transfer learning architecture to be adapted to the target disease.
[0015] The pre-trained backbone weights within the domain are loaded into the backbone layer of the target grading model, so that the backbone layer of the target model directly inherits the feature knowledge adapted from the big data of the endoscopic domain. This eliminates the need for repeated learning of general visual features and endoscopic domain features under small sample conditions for the target disease. Combined with random initialization of the classification head, a target transfer learning architecture with a complete structure and ready to be adapted to the target disease is formed.
[0016] S4: Obtain a private small sample queue as training data for the target domain, establish a hierarchical learning rate strategy configuration based on the training data for the target domain and the target transfer learning architecture, and assign low learning rate and high learning rate to the backbone layer and the classification head of the target transfer learning architecture, respectively.
[0017] Based on the target domain training data and the target transfer learning architecture, a hierarchical learning rate strategy configuration is established, which enables the backbone layer to maintain the stability of the pre-trained features within the domain with a low learning rate, and the classification head to quickly adapt to the classification boundary of the target disease with a high learning rate. This alleviates the problem that the backbone representation is easily affected by noise shift and the classification head is difficult to converge fully under small sample conditions.
[0018] S5: Utilize the hierarchical learning rate strategy to perform transfer fine-tuning iterative calculations on the target transfer learning architecture, suppress small-sample overfitting, optimize the classification head parameters of the target transfer learning architecture, and generate an endoscopic image grading model for the target disease.
[0019] By combining the aforementioned in-domain pre-training, backbone weight transfer, and hierarchical fine-tuning processes, this approach overcomes the limitations in the ability to represent endoscopy-specific visual features caused by the backbone network not being adapted to the endoscopy domain in existing technologies, as well as the overfitting and insufficient generalization caused by the consistent update strategy of the backbone layer and the classification head in small sample scenarios. This improves the hierarchical stability of the model under small sample conditions.
[0020] The technical principle of this application is that, in response to the dual constraints of inter-domain differences between natural images and endoscopic images and the scarcity of labeled samples for target diseases, the transfer learning process is decomposed into two stages: the pre-acquisition of common representations within the domain and the differential adaptation of the discriminative features of the target disease. This ensures that the parameter updates of each stage of the model are based on an initial state that matches the amount of information it carries.
[0021] The applicant's research found that the weights pre-trained in natural images mainly encode general visual features such as edges and textures that are not related to specific image categories. These features differ significantly from endoscopic images in terms of imaging methods, texture structures, and illumination distribution. If these are directly used as the initialization of the target model, the backbone network still needs to relearn the endoscopic-specific visual patterns on scarce target data, which is both difficult to converge and prone to overfitting.
[0022] Accordingly, this application first uses a large dataset of publicly available digestive endoscopy images as the source domain training data, and performs multi-class fine-tuning on the initial deep learning model. This allows the backbone network to form a representation of the texture and illumination distribution patterns of endoscopy images under the supervision of large-scale intra-domain data. Only the weights of the backbone network after removing the classification layer are extracted as transfer parameters. The reason for this is that the classification layer learns the discrimination boundary of the source domain category label space, which is irrelevant to the target disease classification task and will introduce source domain category bias. In contrast, the backbone weights carry intra-domain visual features that can be reused across diseases. Loading these backbone weights into the backbone layer of the target classification model is equivalent to advancing the initial state of the target model from the natural image domain to the endoscopy image domain, so that the randomly initialized classification head can be established on the matching intra-domain feature input. This is the first convergence guarantee of the feature adaptation link.
[0023] Based on this, the backbone layer in the target classification model, which already carries pre-trained features within the domain, is in a relatively optimal parameter range and only requires minor adjustments to adapt to the target disease. However, the randomly initialized classification head lacks prior knowledge and requires a larger step size in parameter search to establish the discrimination boundary for the target disease. The two have drastically different requirements for parameter update magnitude—if a uniform update strategy is used, a large learning rate will destroy the domain representation already learned by the backbone layer, causing it to shift under noise interference from scarce samples; a small learning rate will cause the classification head to converge too slowly. Therefore, this application, based on obtaining a private small sample queue as training data for the target domain, establishes a hierarchical learning rate strategy configuration that allocates a low learning rate to the backbone layer and a high learning rate to the classification head. This allows the transfer fine-tuning iterative computation to optimize the classification head parameters while suppressing overfitting on small samples, providing a second layer of convergence guarantee for the feature adaptation link at the parameter update granularity level.
[0024] By combining the aforementioned mechanisms of pre-setting common representations within the domain and adapting to differentiated updates, the model, even with limited training data for the target disease, does not need to relearn endoscopic features from the natural image domain, nor does it need to compromise on scarce samples using a uniform update strategy. This overcomes the problem of limited representation ability of endoscopic-specific visual features caused by directly initializing the backbone network with natural image weights without adaptation to the endoscopic image domain. It also alleviates the overfitting and undergeneralization problems caused by using a consistent update strategy between the backbone layer and the classification head under small sample conditions, thus improving the grading stability of the endoscopic image grading model under small sample conditions.
[0025] Step S1: Obtain a convolutional neural network backbone initialized with ImageNet pre-trained weights and a large dataset of publicly available digestive endoscopy images. Use the large dataset of publicly available digestive endoscopy images as the source domain training data, and construct an initial deep learning model including a classification layer based on the convolutional neural network backbone. Specifically, this includes: S1.1: Obtain the weight parameters of a convolutional neural network pre-trained on a large-scale ImageNet dataset as the initial backbone network configuration, and instantiate the model entity to be adapted based on the initial backbone network configuration.
[0026] The ImageNet pre-trained weights are convolutional neural network weights pre-trained based on the publicly available ImageNet large-scale natural image dataset. They can be obtained from publicly available pre-trained model libraries. The convolutional neural network weights include backbone network parameters and classification layer parameters connected to the ends of the backbone network for outputting ImageNet category determination results.
[0027] The initial backbone network configuration includes an input layer, a convolutional module, and a classification layer connected sequentially from input to output. The convolutional module consists of multiple convolutional layers and pooling layers stacked alternately, with a batch normalization layer and an activation layer following each convolutional layer. The classification layer is connected to the end of the convolutional module, and its output dimension matches the number of ImageNet categories. Each convolutional layer is configured with a preset number and size of convolutional kernels to extract visual features from the input image, from edges and textures to high-level semantics.
[0028] Read the weight parameters corresponding to each layer of the initial backbone network configuration from the ImageNet pre-trained weights to obtain a parameter set including convolutional module parameters and classification layer parameters.
[0029] Based on the parameter set, the weight parameters are assigned layer by layer to the corresponding layers of the initial backbone network configuration to obtain the model entity to be adapted after parameter loading is completed.
[0030] S1.2: Perform removal processing or parameter reset operation on the classification layer in the model entity to be adapted, so as to eliminate the bias interference of specific categories of natural images and generate a pure backbone network structure that retains only the ability to extract general features.
[0031] Locate the classification layer and its weight parameters at the end of the entity in the model to be adapted.
[0032] The classification layer is removed from the model entity to be adapted; or the classification layer is reset by randomly initializing the weight parameters of the classification layer to eliminate the classification bias of natural image specific categories introduced by ImageNet pre-training.
[0033] By retaining the convolutional modules after removing or resetting the classification layer and their loaded ImageNet pre-trained weight parameters, a clean backbone network structure that retains only the ability to extract general visual features is obtained.
[0034] For example, taking ResNet-50 as the backbone network corresponding to the model entity to be adapted, its classification layer is a 1000-dimensional fully connected layer connected after the global average pooling layer. After removing the classification layer, the convolutional module containing the initial convolutional layer and 16 residual blocks in 4 stages is retained. The number of parameters of the convolutional module is about 23.5 million, and the output feature vector dimension is 2048.
[0035] S1.3: Obtain a large dataset of publicly available digestive endoscopy images as the source domain training data set, and perform standardization preprocessing and multi-class label mapping processing on the source domain training data set to generate a source domain training sample queue.
[0036] A large dataset of publicly available digestive endoscopy images is obtained as the source domain training data set, wherein each endoscopy image in the source domain training data set is labeled with the corresponding disease type of the digestive endoscopy image.
[0037] Standardization preprocessing is performed on each endoscopic image in the source domain training dataset. Each endoscopic image is uniformly scaled to a preset size that matches the input layer of the backbone network. The pixel values are then normalized according to preset mean and standard deviation to obtain standardized source domain endoscopic images.
[0038] Multi-class label mapping is performed on standardized source domain endoscopic images, mapping the disease type label of each endoscopic image to a preset category index, and the source domain endoscopic images carrying category indexes are organized into preset batches to obtain a source domain training sample queue.
[0039] S1.4: Based on the source domain training sample queue and the pure backbone network structure, configure a randomly initialized fully connected classification head for the pure backbone network structure, map the source domain training sample queue to the input end of the pure backbone network structure, and construct an initial deep learning model for in-domain multi-class fine-tuning.
[0040] Configure a randomly initialized fully connected classification head for the pure backbone network structure. The input dimension of the fully connected classification head matches the feature dimension output by the pure backbone network structure, and the output dimension of the fully connected classification head matches the number of categories in the source domain multi-classification task.
[0041] The fully connected classification head is connected to the output of the pure backbone network structure, and the source domain endoscope images in the source domain training sample queue are used as the input of the pure backbone network structure to construct an initial deep learning model for in-domain multi-class fine-tuning.
[0042] Step S2: Based on the source domain training data, perform multi-class fine-tuning on the initial deep learning model, enabling the convolutional neural network backbone network to learn the texture and illumination distribution patterns of the endoscopic image. Remove the classification layer from the fine-tuned initial deep learning model and extract the backbone network weights to generate domain-specific pre-trained backbone weights. Specifically, this includes: S2.1: Perform random data augmentation processing on the source domain training sample queue to generate an augmented source domain training sample set.
[0043] Obtain the source domain training sample queue generated in S1.3. The source domain training sample queue consists of source domain endoscopic images that have undergone size normalization and pixel value standardization preprocessing and their corresponding category indices.
[0044] Geometric transformation processing is performed on each source domain endoscopic image in the source domain training sample queue. Random horizontal flipping operation is performed with a preset probability, and random rotation operation is performed within a preset angle range to simulate the lesion morphology under different perspectives during endoscopic examination.
[0045] Photometric perturbation processing is performed on the source domain endoscopic image after geometric transformation, and the brightness, contrast and saturation of the image are randomly adjusted within a preset range to cover the illumination changes under different endoscopic light sources.
[0046] The source domain endoscope images processed by geometric transformation and photometric perturbation are combined with their corresponding category indices to obtain an enhanced source domain training sample set. The category index of each source domain endoscope image in the enhanced source domain training sample set is consistent with that before enhancement processing.
[0047] S2.2: Perform forward propagation computation on the initial deep learning model based on the enhanced source domain training sample set, extract multi-level visual feature maps using the pure backbone network structure, and map them to the source domain category probability distribution vector through the fully connected classification head.
[0048] The enhanced source domain training sample set is input into the initial deep learning model. The input source domain endoscopic images are then processed layer by layer using convolutional layers in the clean backbone network structure and activated by an activation function. In the feature map output by each convolutional layer, the element located in the i-th row, j-th column, and k-th channel is determined by the following formula: in, For the first Line number Column, No. Each channel's output feature map element , These are the height and width of the convolution kernel, respectively. Input the number of channels. For the first Each channel convolution kernel is located at position The weight of the position, For the input feature map, the first The first channel Line number Column pixel values, For the first The bias of each channel; through the alternating processing of multiple convolutional layers and pooling layers in the pure backbone network structure, a multi-level visual feature map is obtained.
[0049] Global average pooling is performed on the feature maps output from the backbone network ends of the multi-level visual feature maps to calculate the spatial mean of the feature map for each channel, which is used as the representation value for that channel. The representation value of the k-th channel is determined by the following formula: in, For the first The representation value of each channel, , These represent the height and width of the end feature map, respectively. For the terminal feature map, the first Line number Column, No. The elements of each channel are used to arrange the channel representation values in channel order to obtain the source domain image feature vector v.
[0050] The source domain image feature vector v is input into the fully connected classification head to perform linear mapping, obtaining the unnormalized scores of the source domain endoscopic image to each category, where the score of category c is determined by the following formula: in, The source domain endoscopic image belongs to the first Unnormalized score of the class Let be the dimension of the feature vector of the source domain image. The weight matrix of the fully connected classifier head is the first... Line 1 Column elements, The first feature vector of the source domain image dimensional components, For the first The bias corresponding to the class.
[0051] Normalization index processing is performed on the unnormalized scores of each category to obtain the probability values of the source domain endoscopic image belonging to each category, where the probability of belonging to category c is determined by the following formula: in, The source domain endoscopic image belongs to the first The probability of a class The total number of source domain categories, The natural exponential function is used; by arranging the probability values in order of category, the source domain category probability distribution vector is obtained.
[0052] S2.3: Construct a cross-entropy loss value based on the source domain category probability distribution vector and the true label, perform backpropagation to calculate gradient information based on the cross-entropy loss value, and generate a gradient tensor to be updated for the pure backbone network structure and the fully connected classification head.
[0053] Obtain the source domain category probability distribution vector generated in S2.2, and the category index corresponding to each source domain endoscope image in the source domain training sample queue, and use the category index as the true label.
[0054] Based on the source domain category probability distribution vector and the true label, the difference between the predicted probability distribution and the true label distribution is calculated using the cross-entropy loss function. The cross-entropy loss value L of a single source domain endoscopic image is determined by the following formula: in, The cross-entropy loss value is for a single source domain endoscopic image. The total number of source domain categories, The first for the real label dimensional components, In the source domain category probability distribution vector, the endoscopic image of this source domain belongs to the first... The probability of the class; the average of the cross-entropy loss values of each source domain endoscopic image within the training batch is used to obtain the source domain cross-entropy loss value.
[0055] Backpropagation is performed based on the source domain cross-entropy loss value. The gradient of the source domain cross-entropy loss value relative to each learnable parameter in the pure backbone network structure and the fully connected classifier is calculated layer by layer. The gradients of each layer are aggregated to generate the gradient tensor to be updated.
[0056] S2.4: Use the gradient tensor to be updated to perform iterative optimization and update the learnable parameters of the initial deep learning model, and use an adaptive moment estimation optimizer to minimize the cross-entropy loss value to generate a fine-tuned initial deep learning model.
[0057] Obtain the gradient tensor to be updated generated in S2.3. Based on the adaptive moment estimator optimizer with a preset initial learning rate, and combining the first and second moment estimates of the gradient history, determine the update amount of each learnable parameter. The parameter update amount in the t-th iteration is determined by the following formula: in, For the first The number of learnable parameters updated in each iteration The preset initial learning rate, For the first The first-order moment estimate after bias correction in the next iteration. For the first The second-order moment estimate after bias correction in the next iteration. To prevent smooth terms with a denominator of zero.
[0058] Based on the update amount of each learnable parameter, the learnable parameters of the initial deep learning model are iteratively updated until the source domain cross-entropy loss value converges, generating a fine-tuned initial deep learning model.
[0059] S2.5: Extract the fully connected classification head from the fine-tuned initial deep learning model, extract the weight parameters of the pure backbone network structure, and generate in-domain pre-trained backbone weights.
[0060] Obtain the fine-tuned initial deep learning model generated by S2.4. The fine-tuned initial deep learning model includes a clean backbone network structure that has been fine-tuned in the source domain and a fully connected classification head connected to its end.
[0061] Identify the weight parameters corresponding to the fully connected classifier head in the fine-tuned initial deep learning model. The weight parameters of the fully connected classifier head include its weight matrix and bias vector.
[0062] The fully connected classification head and its weight parameters are stripped from the fine-tuned initial deep learning model, and only the weight parameters of each convolutional layer and batch normalized layer in the pure backbone network structure after source domain fine-tuning are retained.
[0063] The integrity of the weight parameters of each retained convolutional layer and batch normalized layer is checked to verify whether the dimension of each layer weight parameter is consistent with the preset architecture of the pure backbone network structure, so as to avoid structural mismatch caused by the removal of the classification head, and to obtain the domain pre-trained backbone weights.
[0064] like Figure 2 As shown, step S3: Load the pre-trained backbone weights within the domain into the backbone layer of the target classification model, and perform random initialization on the classification head of the target classification model to generate the target transfer learning architecture to be adapted to the target disease. Specifically, this includes: S3.1: The pre-trained backbone weights within the domain are mapped and loaded into the backbone layer of the target hierarchical model to complete the intra-domain knowledge injection of the backbone network features.
[0065] The target grading model is a training model constructed for the endoscopic image grading task of the target disease. Its backbone layer has the same hierarchical structure as the pure backbone network structure and is used to carry the pre-trained backbone weights in the domain.
[0066] Obtain the domain-pretrained backbone weights generated by S2.5. The domain-pretrained backbone weights include the kernel weights and biases of each convolutional layer in the pure backbone network structure, the scaling and offset coefficients of each batch normalized layer, and the runtime statistics.
[0067] The weight parameters of each layer in the pre-trained backbone weights in the domain are compared with the corresponding layer of the backbone layer of the target hierarchical model. When the comparison is consistent, the convolution kernel weights and biases of each convolutional layer, and the scaling coefficients and offset coefficients of each batch normalized layer are assigned to the corresponding layer of the backbone layer of the target hierarchical model.
[0068] The batch normalized layer running statistics in the pre-trained backbone weights within the domain are assigned to the corresponding batch normalized layer of the backbone layer of the target hierarchical model, so that the target hierarchical model uses the batch normalized statistical characteristics determined by the source domain fine-tuning in the initial stage, thus obtaining the target hierarchical model with completed domain knowledge injection.
[0069] S3.2: Based on the output dimension of the backbone layer after injecting knowledge within the domain, construct an initial classification head that matches the number of classification categories of the target disease. Perform random initialization processing on the weight parameters of the initial classification head to generate a randomly initialized classification head.
[0070] Obtain the output dimension at the end of the backbone layer in the target hierarchical model where domain knowledge injection has been completed in S3.1.
[0071] Based on the total number of endoscopic image grading categories for the target disease, an initial classification head is constructed. The initial classification head includes a fully connected layer and an activation layer connected in sequence. The number of input nodes of the fully connected layer is consistent with the output dimension of the backbone layer of the target grading model, and the number of output nodes of the fully connected layer is consistent with the number of grading categories for the target disease. The activation layer is located after the fully connected layer and is used to perform nonlinear mapping on the output of the fully connected layer.
[0072] The weight matrix of the fully connected layer in the initial classification head is initialized using a Xavier uniform distribution. The distribution range of random numbers is determined based on the number of input nodes and output nodes of the fully connected layer to generate the initialized classification head weight matrix.
[0073] Zero-value initialization is performed on the bias vector of the fully connected layer in the initial classification head to generate an initialized classification head bias vector.
[0074] The activation layer has no learnable parameters and does not participate in random initialization; based on the initialized classifier weight matrix and the initialized classifier bias vector, a randomly initialized classifier is obtained, and the randomly initialized classifier is set at the end of the backbone layer of the target hierarchical model.
[0075] S3.3: Connect the backbone layer loaded with the pre-trained backbone weights in the domain to the randomly initialized classification head to generate a complete target transfer learning architecture.
[0076] Obtain the backbone layer of the target hierarchical model that has completed domain knowledge injection in S3.1, and the classification head generated by random initialization in S3.2.
[0077] The randomly initialized classification head is connected to the end of the backbone layer, so that the features output by the backbone layer are mapped by the classification head to outputs for each level of the target disease.
[0078] The connected model is assembled to obtain the target transfer learning architecture, in which the backbone layer carries pre-trained weights within the domain and the classification head carries randomly initialized weights.
[0079] For example, the output dimension at the end of the backbone layer is 512-dimensional, the number of input nodes of the initial fully connected layer of the classification head is set to 512, and the number of output nodes is set to 3, corresponding to the three endoscopic image classification categories of the target disease; after connection, the backbone layer accounts for 95% of the parameters in the target transfer learning architecture, and the classification head accounts for 5%.
[0080] S3.4: Perform a hierarchical freeze configuration on the target transfer learning architecture, freeze the parameter updates of the backbone layer and open the parameter updates of the classification head, so that the target transfer learning architecture has the hierarchical trainable attribute of the backbone layer maintaining intra-domain features and the classification head adapting to the target disease.
[0081] Obtain the target transfer learning architecture generated by S3.3.
[0082] A hierarchical freeze configuration is performed on the target transfer learning architecture, setting the parameters of the backbone layer to a frozen state that remains unchanged during backpropagation, so that the domain pre-trained weights are not updated in subsequent training, thus maintaining the domain features they carry.
[0083] The parameters of the classification head are set to a state that allows updates during backpropagation, so that the randomly initialized weights of the classification head can be updated in subsequent training to adapt to the classification task of the target disease, thus obtaining a target transfer learning architecture with hierarchical trainable attributes.
[0084] S3.5: Perform an integrity check on the target transfer learning architecture configured with hierarchical freezing, and output the target transfer learning architecture to be adapted to the target disease, which will serve as the input object for subsequent hierarchical learning rate strategy configuration.
[0085] Obtain the target transfer learning architecture with hierarchical trainable attributes obtained from S3.4.
[0086] A connectivity check is performed on the target transfer learning architecture to confirm that the input data can flow sequentially through the backbone layer and the classification head.
[0087] Perform dimensionality verification on the target transfer learning architecture to confirm that the output dimension at the end of the backbone layer is consistent with the number of input nodes of the fully connected layer of the classification head.
[0088] Perform a freeze state check on the target transfer learning architecture to confirm that the backbone layer parameters are in a frozen state and the classification head parameters are in an update-allowed state.
[0089] For the target transfer learning architecture that passes the above verification, the output is the target transfer learning architecture to be adapted to the target disease, which will serve as the input object for the subsequent establishment of hierarchical learning rate strategy configuration.
[0090] like Figure 3 As shown, step S4: Obtain a private small sample queue as training data for the target domain; establish a hierarchical learning rate strategy configuration based on the target domain training data and the target transfer learning architecture; and assign low and high learning rates to the backbone layer and classification head of the target transfer learning architecture, respectively. Specifically, this includes: S4.1: Obtain a private small sample queue as target domain training data, perform standardization preprocessing on the target domain training data, and generate a standard target domain training dataset.
[0091] A private small sample queue is obtained as training data for the target domain, which includes endoscopic images of the target disease and corresponding disease grading annotations.
[0092] Size normalization processing is performed on each endoscopic image in the target domain training data. A bilinear interpolation algorithm is used to uniformly adjust the size of each endoscopic image to a preset input dimension to eliminate scale differences caused by different acquisition devices and generate a size-normalized target domain endoscopic image.
[0093] Pixel value standardization is performed on the size-normalized target domain endoscope image. The pixel values of each channel are normalized according to the preset mean and standard deviation to normalize the pixel values of each channel to the preset distribution range, so as to accelerate model convergence and generate a pixel-normalized target domain endoscope image.
[0094] Illumination equalization is performed on the pixel-normalized target domain endoscopic image. Contrast-limited adaptive histogram equalization is used to suppress shadow occlusion and highlight reflection in the endoscopic image, enhance the texture details of the lesion area, and generate an illumination-equalized target domain endoscopic image.
[0095] By combining the endoscopic images of each target domain after illumination equalization with their corresponding disease grading labels, a standard target domain training dataset is generated.
[0096] S4.2: Based on the standard target domain training dataset, count the number of samples, calculate the small sample scarcity coefficient according to the number of samples, and generate a small sample scarcity index to quantify the degree of data scarcity.
[0097] Obtain the standard target domain training dataset generated by S4.1, count the total number of samples in the standard target domain training dataset, and count the number of samples under each disease classification category to obtain the distribution of the number of samples in each category.
[0098] Based on the distribution of sample quantity in each category, the Shannon entropy of the category distribution is calculated. The Shannon entropy is used to characterize the degree of balance in the number of samples in each category.
[0099] Based on the total sample size and the Shannon entropy of the category distribution, the small sample scarcity coefficient is calculated using the following formula: in, This is the scarcity coefficient for small samples. The total number of samples, The Shannon entropy is the distribution of the stated category.
[0100] Normalization is performed on the small sample scarcity coefficients to map them to a preset numerical range, generating a small sample scarcity index. This index is used to quantify the sample scarcity of the standard target domain training dataset and serves as the basis for determining the learning rates for the backbone layer and the classification head.
[0101] S4.3: Use the small sample scarcity index to perform decay mapping on the preset base learning rate to generate a low learning rate parameter configuration for the backbone layer of the target transfer learning architecture, so as to maintain the endoscopy domain features carried by the pre-trained backbone weights in the domain during fine-tuning.
[0102] Obtain the small sample scarcity index generated by S4.2, and obtain the preset base learning rate, which is a pre-set base learning rate for transfer fine-tuning.
[0103] Based on the small sample scarcity index, a decay mapping is performed on the preset base learning rate, and the low learning rate of the backbone layer is calculated using the following formula: in, Due to the low learning rate of the backbone layer, To preset the base learning rate, This is a preset decay control coefficient used to control the degree of decay of the low learning rate of the backbone layer as the scarcity of small samples increases. This is an indicator of the scarcity of small samples.
[0104] The calculated low learning rate of the backbone layer is used as the low learning rate parameter configuration for the backbone layer of the target transfer learning architecture. The low learning rate parameter configuration is used to maintain the endoscopic domain features carried by the pre-trained backbone weights in the domain during subsequent transfer fine-tuning.
[0105] S4.4: Utilize the small sample scarcity index to perform enhanced mapping on the preset base learning rate, generating a high learning rate parameter configuration for the classification head of the target transfer learning architecture, so as to accelerate the convergence of the classification head of the target transfer learning architecture on the target disease.
[0106] Obtain the small sample scarcity index generated by S4.2, and obtain the preset base learning rate.
[0107] Based on the small sample scarcity index, augmentation mapping is performed on the preset base learning rate, and the class head height learning rate is calculated using the following formula: in, To achieve a high learning rate for the classification head, To preset the base learning rate, These are preset enhancement control coefficients used to control the degree of enhancement of the classifier head height learning rate as the scarcity of small samples increases. This is an indicator of the scarcity of small samples.
[0108] The calculated high learning rate of the classifier head is used as the high learning rate parameter configuration for the classifier head of the target transfer learning architecture. The high learning rate parameter configuration is used to accelerate the convergence of the classifier head of the target transfer learning architecture on the target disease in subsequent transfer fine-tuning.
[0109] S4.5: Integrate the low learning rate parameter configuration with the high learning rate parameter configuration, set corresponding learning rates for the backbone layer and classification head of the target transfer learning architecture respectively, and generate a hierarchical learning rate strategy configuration.
[0110] Obtain the low learning rate parameter configuration for the backbone layer of the target transfer learning architecture generated in S4.3, and the high learning rate parameter configuration for the classification head of the target transfer learning architecture generated in S4.4.
[0111] By integrating the low learning rate parameter configuration and the high learning rate parameter configuration, the low learning rate of the backbone layer in the low learning rate parameter configuration is set as the learning rate of the backbone layer of the target transfer learning architecture in transfer fine-tuning, and the high learning rate of the classifier head in the high learning rate parameter configuration is set as the learning rate of the classifier head of the target transfer learning architecture in transfer fine-tuning.
[0112] Based on the learning rate of the backbone layer and the learning rate of the classification head, a hierarchical learning rate strategy configuration is generated. The hierarchical learning rate strategy configuration is used to update the backbone layer parameters of the target transfer learning architecture with a low learning rate and update the classification head parameters of the target transfer learning architecture with a high learning rate during the transfer fine-tuning iteration calculation.
[0113] Step S5: Utilize the hierarchical learning rate strategy to perform transfer fine-tuning iterative calculations on the target transfer learning architecture, suppressing small-sample overfitting and optimizing the classification head parameters of the target transfer learning architecture to generate an endoscopic image grading model for the target disease. Specifically, this includes: S5.1: Obtain endoscopic image data and corresponding disease grading labels from a private small sample queue, perform data augmentation processing on the endoscopic image data with geometric transformation and photometric perturbation, and generate an enhanced target domain training sample set.
[0114] Obtain raw endoscopic image data and corresponding disease grading labels from a private small sample queue as input sources for data augmentation.
[0115] To address the issues of shooting angle differences and uneven illumination in the original endoscopic images, data augmentation processing involving geometric transformation and photometric perturbation is performed on the endoscopic image data. The geometric transformation processing includes random rotation, random horizontal flipping, and random cropping and scaling, while the photometric perturbation processing includes color jitter processing.
[0116] Random rotation processing is performed, rotating the endoscopic image within the range of -15 degrees to 15 degrees to simulate the lesion imaging morphology of the endoscopic probe from different perspectives; horizontal flip processing is applied, mirroring the image with a 50% probability to expand the spatial distribution diversity of the sample and eliminate the left-right bias caused by endoscopic operation habits.
[0117] Color dithering is performed by perturbing the brightness, saturation, and contrast parameters within a preset color space to simulate the differences in light source intensity of different endoscopic devices and the spectral changes caused by body fluid coverage.
[0118] The endoscopic images processed by geometric transformation and photometric perturbation are combined according to their original disease grading labels, while keeping the disease grading labels unchanged, to generate an enhanced target domain training sample set.
[0119] S5.2: Input the enhanced target domain training sample set into the target transfer learning architecture to perform forward propagation, extract target domain image features using the backbone layer of the target transfer learning architecture, and generate the target disease category probability distribution vector through the classification head mapping of the target transfer learning architecture.
[0120] The enhanced target domain training sample set is input into the target transfer learning architecture. The backbone layer of the target transfer learning architecture performs convolution, batch normalization and activation processing on the input target domain endoscopic image layer by layer to extract multi-level feature maps of the target domain image. The backbone layer is a backbone layer loaded with pre-trained backbone weights in the domain to perform multi-level feature extraction on the image and capture the texture details and illumination distribution patterns of the lesion area.
[0121] Global average pooling is performed on the multi-level feature maps of the target domain image to compress the spatial dimension into a one-dimensional feature vector, thereby generating the target domain image feature vector.
[0122] The target domain image feature vector is input into the classification head of the target transfer learning architecture to perform linear mapping, and after normalization exponential processing, the probability value of the target domain endoscopic image belonging to each disease grade category is calculated, generating the target disease category probability distribution vector.
[0123] S5.3: Construct a cross-entropy loss value based on the probability distribution vector of the target disease category and the disease classification label. Perform backpropagation based on the cross-entropy loss value to calculate the gradient information of the cross-entropy loss value relative to the backbone layer parameters and classification head parameters of the target transfer learning architecture, and generate a gradient tensor to be updated.
[0124] Obtain the probability distribution vector of the target disease category generated in S5.2, and the disease grading label corresponding to the endoscopic image of each target domain obtained in S5.1, as the true label.
[0125] Based on the probability distribution vector of the target disease category and the disease classification label, construct the target domain cross-entropy loss value.
[0126] Backpropagation is performed based on the target domain cross-entropy loss value to calculate the gradient of the target domain cross-entropy loss value relative to the backbone layer parameters and classification head parameters of the target transfer learning architecture, and the gradient tensor to be updated is generated by aggregation.
[0127] In one embodiment, the target domain cross-entropy loss value is calculated using the same cross-entropy loss function as the source domain multi-class fine-tuning, and the cross-entropy loss value for each target domain endoscopic image is: in, The total number of disease classification categories. The endoscopic image of the target domain in the disease grading label belongs to the first... Class indicator value, In the probability distribution vector of the target disease category, the endoscopic image of this target domain belongs to the first... The probability value of the class.
[0128] S5.4: Using the hierarchical learning rate strategy, perform weighted scaling on the gradient tensor to be updated, apply a low learning rate parameter configuration to the backbone layer of the target transfer learning architecture, apply a high learning rate parameter configuration to the classification head of the target transfer learning architecture, and generate a differential parameter update step size.
[0129] Obtain the gradient tensor to be updated generated by S5.3, and the hierarchical learning rate policy configuration generated by S4.5.
[0130] The hierarchical learning rate strategy configuration is analyzed to determine the low learning rate parameter configuration for the backbone layer of the target transfer learning architecture and the high learning rate parameter configuration for the classification head of the target transfer learning architecture.
[0131] Based on the backbone layer and classifier head of the target transfer learning architecture, the gradient tensor to be updated is split into backbone layer gradient and classifier head gradient; the low learning rate of the backbone layer in the low learning rate parameter configuration is applied to the backbone layer gradient to generate the backbone layer update step size; the high learning rate of the classifier head in the high learning rate parameter configuration is applied to the classifier head gradient to generate the classifier head update step size.
[0132] The update step size of the backbone layer and the update step size of the classification head are integrated in the order of their corresponding parameters to generate a differentiated parameter update step size. In the differentiated parameter update step size, the update amplitude of the backbone layer parameters is smaller than that of the classification head parameters.
[0133] S5.5: Based on the differential parameter update step size, perform transfer fine-tuning iterative calculation on the target transfer learning architecture until the cross-entropy loss value converges, generating an endoscopic image grading model.
[0134] Obtain the differential parameter update step size generated in S5.4, and use the differential parameter update step size as the update basis for performing transfer fine-tuning iterative calculations on the target transfer learning architecture.
[0135] Based on the differential parameter update step size, a transfer fine-tuning iterative calculation is performed on the target transfer learning architecture: For the backbone layer parameters of the target transfer learning architecture, the backbone layer update step size corresponding to the backbone layer in the differential parameter update step size is applied, so that the backbone layer parameters are slightly offset near the pre-trained backbone layer weights in the domain, so as to maintain the universal texture and illumination representation of the endoscopy domain that the backbone layer has learned, and avoid the universal texture and illumination representation of the endoscopy domain being offset due to small sample noise interference; For the classification head parameters of the target transfer learning architecture, the classification head update step size corresponding to the classification head in the differential parameter update step size is applied, so that the classification head parameters are adjusted more significantly towards the decision boundary that adapts to the target disease classification from the random initialization state, so as to establish the mapping relationship between the lesion classification features of the target disease and the disease classification label.
[0136] In each training round of the transfer fine-tuning iteration calculation, the current update direction and update magnitude of each learnable parameter are determined by combining the historical gradient information accumulated by the optimizer. During the iteration process, the change of cross-entropy loss value on the validation set is monitored. When the change magnitude of the cross-entropy loss value in multiple consecutive training rounds is less than the preset convergence threshold, it is determined that the target transfer learning architecture has reached the convergence state, the iteration is stopped, the weight parameters of the backbone layer and the classification head are solidified, and an endoscopy image grading model is generated.
[0137] In one embodiment, the method for constructing an endoscopic image grading model based on intradomain pre-training provided in this application further includes step S6: inputting the endoscopic image to be tested into the endoscopic image grading model for forward inference processing, and outputting a disease grading result reflecting the severity of the lesion.
[0138] Specifically, the raw image data of the endoscope to be tested undergoes standardized preprocessing, including size normalization, pixel value normalization, and noise suppression, to generate a standard endoscope image tensor. This standard endoscope image tensor is then input into the backbone layer of the endoscope image grading model. Multi-scale features are extracted using the forward propagation mechanism of a convolutional neural network, generating a high-dimensional feature representation vector containing lesion texture and illumination distribution patterns. The high-dimensional feature representation vector is then subjected to fully connected mapping and probability distribution calculation through the classification head of the endoscope image grading model, generating an initial disease grading probability distribution sequence corresponding to each grading category. Finally, the initial disease grading probability distribution sequence is used for maximum value indexing, and the category label corresponding to the probability peak is selected as the final determination result, generating a disease grading result reflecting the severity of the lesions.
[0139] In one embodiment, this application also provides an apparatus for constructing a domain-pretrained endoscopic image grading model, comprising: The initial deep learning model building module is used to obtain a convolutional neural network backbone network initialized with ImageNet pre-trained weights and a large dataset of publicly available digestive endoscopy images. The large dataset of publicly available digestive endoscopy images is used as the source domain training data, and an initial deep learning model containing a classification layer is built based on the convolutional neural network backbone network. The in-domain pre-training module is used to perform multi-class fine-tuning on the initial deep learning model based on the source domain training data, so that the convolutional neural network backbone network learns the texture and illumination distribution patterns of the endoscopic image, removes the classification layer from the fine-tuned initial deep learning model and extracts the backbone network weights to generate in-domain pre-trained backbone weights. The target transfer learning architecture construction module is used to load the pre-trained backbone weights in the domain into the backbone layer of the target classification model, and to perform random initialization operation on the classification head of the target classification model to generate the target transfer learning architecture to be adapted to the target disease. The hierarchical learning rate strategy configuration module is used to obtain a private small sample queue as target domain training data, establish a hierarchical learning rate strategy configuration based on the target domain training data and the target transfer learning architecture, and allocate low learning rate and high learning rate to the backbone layer and classification head of the target transfer learning architecture, respectively. The transfer fine-tuning module is used to perform transfer fine-tuning iterative calculations on the target transfer learning architecture using the hierarchical learning rate strategy configuration, to suppress small sample overfitting and optimize the classification head parameters of the target transfer learning architecture, thereby generating an endoscopic image grading model for the target disease.
[0140] For those skilled in the art, various other corresponding changes and modifications can be made based on the technical solutions and concepts described above, and these changes and modifications do not depart from the scope of the technical solutions disclosed in this application.
[0141] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains. The terms “first,” “second,” “third,” and similar terms used in this specification and claims do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a” and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms “comprising” or “including” and similar terms mean that the elements or objects preceding “comprising” or “including” encompass the elements or objects listed following “comprising” or “including” and their equivalents, and do not exclude other elements or objects. The “multiple” mentioned in the embodiments of this application refers to two or more. A and / or B indicate three possibilities: A; B; and A and B.
[0142] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the scope of the technology disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the technical solution disclosed in this application.
Claims
1. A method for constructing an endoscopic image grading model based on intra-domain pre-training, characterized in that, include: Obtain a convolutional neural network backbone network initialized with ImageNet pre-trained weights and a large dataset of publicly available digestive endoscopy images. Use the large dataset of publicly available digestive endoscopy images as source domain training data and construct an initial deep learning model containing a classification layer based on the convolutional neural network backbone network. Based on the source domain training data, the initial deep learning model is subjected to multi-class fine-tuning, which enables the convolutional neural network backbone network to learn the texture and illumination distribution patterns of the endoscopic image. The classification layer is removed from the fine-tuned initial deep learning model and the backbone network weights are extracted to generate in-domain pre-trained backbone weights. The pre-trained backbone weights within the domain are loaded into the backbone layer of the target classification model, and a random initialization operation is performed on the classification head of the target classification model to generate the target transfer learning architecture to be adapted to the target disease. A private small sample queue is obtained as training data for the target domain. Based on the training data for the target domain and the target transfer learning architecture, a hierarchical learning rate strategy configuration is established, and low learning rate and high learning rate are respectively assigned to the backbone layer and the classification head of the target transfer learning architecture. The hierarchical learning rate strategy is used to perform transfer fine-tuning iterative calculations on the target transfer learning architecture to suppress small sample overfitting and optimize the classification head parameters of the target transfer learning architecture, thereby generating an endoscopic image grading model for the target disease.
2. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 1, characterized in that, The step of acquiring a convolutional neural network backbone network initialized with ImageNet pre-trained weights and a large dataset of publicly available digestive endoscopy images, using the large dataset of publicly available digestive endoscopy images as source domain training data, and constructing an initial deep learning model including a classification layer based on the convolutional neural network backbone network includes: Obtain the weight parameters of a convolutional neural network pre-trained on a large-scale ImageNet dataset as the initial backbone network configuration, and instantiate the model entity to be adapted based on the initial backbone network configuration; Perform removal or parameter reset operations on the classification layer in the model entity to be adapted to generate a clean backbone network structure; A large dataset of publicly available digestive endoscopy images is obtained as the source domain training data set, and the source domain training data set is subjected to standardization preprocessing and multi-class label mapping processing to generate a source domain training sample queue. Based on the source domain training sample queue and the pure backbone network structure, a randomly initialized fully connected classification head is configured for the pure backbone network structure, and the source domain training sample queue is mapped to the input end of the pure backbone network structure to construct an initial deep learning model for in-domain multi-class fine-tuning.
3. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 2, characterized in that, The initial backbone network configuration includes an input layer, a convolutional module, and a classification layer connected sequentially from input to output. The convolutional module consists of multiple convolutional layers and pooling layers stacked alternately, with a batch normalization layer and an activation layer following each convolutional layer. The classification layer is connected to the end of the convolutional module, and its output dimension matches the number of ImageNet categories.
4. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 2, characterized in that, The step of performing multi-class fine-tuning on the initial deep learning model based on the source domain training data, enabling the convolutional neural network backbone network to learn the texture and illumination distribution patterns of the endoscopic image, removing the classification layer from the fine-tuned initial deep learning model and extracting the backbone network weights to generate domain-pre-trained backbone weights, includes: Random data augmentation processing is performed on the source domain training sample queue to generate an augmented source domain training sample set; Based on the enhanced source domain training sample set, the initial deep learning model is subjected to forward propagation computation, and multi-level visual feature maps are extracted using the pure backbone network structure, which are then mapped to the source domain category probability distribution vector through the fully connected classification head. A cross-entropy loss value is constructed based on the source domain category probability distribution vector and the true label. Backpropagation is performed based on the cross-entropy loss value to calculate gradient information and generate a gradient tensor to be updated for the pure backbone network structure and the fully connected classification head. The learnable parameters of the initial deep learning model are iteratively optimized and updated using the gradient tensor to be updated, and the cross-entropy loss value is minimized using an adaptive moment estimation optimizer to generate a fine-tuned initial deep learning model. The fully connected classification head is stripped from the fine-tuned initial deep learning model, and the weight parameters of the pure backbone network structure are extracted to generate in-domain pre-trained backbone weights.
5. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 1, characterized in that, The step of loading the pre-trained backbone weights within the domain into the backbone layer of the target classification model and performing random initialization on the classification head of the target classification model to generate the target transfer learning architecture to be adapted to the target disease includes: The pre-trained backbone weights within the domain are mapped and loaded into the backbone layer of the target hierarchical model to complete the intra-domain knowledge injection of the backbone network features. Based on the output dimension of the backbone layer after injecting domain knowledge, an initial classification head matching the number of classification categories of the target disease is constructed. The weight parameters of the initial classification head are randomly initialized to generate a randomly initialized classification head. The backbone layer loaded with the pre-trained backbone weights in the domain is connected to the randomly initialized classification head to generate a complete target transfer learning architecture. The target transfer learning architecture is configured to freeze the parameter updates of the backbone layer and open the parameter updates of the classification head, so that the target transfer learning architecture has the hierarchical trainable attribute of the backbone layer maintaining domain features and the classification head adapting to the target disease. Perform an integrity check on the target transfer learning architecture configured in a hierarchical and frozen manner, and output the target transfer learning architecture to be adapted to the target disease.
6. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 5, characterized in that, The initial classification head includes a fully connected layer and an activation layer connected in sequence. The number of input nodes of the fully connected layer is consistent with the output dimension of the backbone layer of the target classification model, and the number of output nodes of the fully connected layer is consistent with the number of classification categories of the target disease. The activation layer is located after the fully connected layer and is used to perform nonlinear mapping on the output of the fully connected layer.
7. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 1, characterized in that, The process of acquiring a private small sample queue as training data for the target domain, and establishing a hierarchical learning rate strategy configuration based on the target domain training data and the target transfer learning architecture, assigning low and high learning rates to the backbone layer and classification head of the target transfer learning architecture respectively, includes: A private small sample queue is obtained as training data for the target domain. Standardization preprocessing is performed on the target domain training data to generate a standard target domain training dataset. Based on the standard target domain training dataset, the number of samples is counted, and the small sample scarcity coefficient is calculated according to the number of samples to generate a small sample scarcity index. The small sample scarcity index is used to perform decay mapping on the preset base learning rate to generate a low learning rate parameter configuration for the backbone layer of the target transfer learning architecture. The small sample scarcity index is used to perform enhancement mapping on the preset base learning rate to generate a high learning rate parameter configuration for the classification head of the target transfer learning architecture; By integrating the low learning rate parameter configuration and the high learning rate parameter configuration, corresponding learning rates are set for the backbone layer and the classification head of the target transfer learning architecture, respectively, and a hierarchical learning rate strategy configuration is generated.
8. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 1, characterized in that, The step of configuring the hierarchical learning rate strategy to perform transfer fine-tuning iterative calculations on the target transfer learning architecture, suppressing small-sample overfitting and optimizing the classification head parameters of the target transfer learning architecture, and generating an endoscopic image grading model for the target disease includes: Obtain endoscopic image data and corresponding disease grading labels from a private small sample queue, perform data augmentation processing on the endoscopic image data with geometric transformation and photometric perturbation, and generate an enhanced target domain training sample set; The enhanced target domain training sample set is input into the target transfer learning architecture to perform forward propagation. The backbone layer of the target transfer learning architecture is used to extract target domain image features, and the target disease category probability distribution vector is generated by mapping the classification head of the target transfer learning architecture. A cross-entropy loss value is constructed based on the probability distribution vector of the target disease category and the disease classification label. Backpropagation is performed based on the cross-entropy loss value to calculate the gradient information of the cross-entropy loss value relative to the backbone layer parameters and classification head parameters of the target transfer learning architecture, and to generate the gradient tensor to be updated. The layered learning rate strategy is used to perform weighted scaling on the gradient tensor to be updated, a low learning rate parameter configuration is applied to the backbone layer of the target transfer learning architecture, and a high learning rate parameter configuration is applied to the classification head of the target transfer learning architecture to generate a differential parameter update step size. Based on the differential parameter update step size, the target transfer learning architecture is subjected to transfer fine-tuning iterative calculation until the cross-entropy loss value converges, thereby generating an endoscopic image grading model.
9. The method for constructing an endoscopic image grading model based on intra-domain pre-training according to claim 1, characterized in that, Also includes: The endoscopic image to be tested is input into the endoscopic image grading model for forward inference processing, and the disease grading result reflecting the severity of the lesion is output.
10. A device for constructing an endoscopic image grading model based on intra-domain pre-training, characterized in that, include: The initial deep learning model building module is used to obtain a convolutional neural network backbone network initialized with ImageNet pre-trained weights and a large dataset of publicly available digestive endoscopy images. The large dataset of publicly available digestive endoscopy images is used as the source domain training data, and an initial deep learning model containing a classification layer is built based on the convolutional neural network backbone network. The in-domain pre-training module is used to perform multi-class fine-tuning on the initial deep learning model based on the source domain training data, so that the convolutional neural network backbone network learns the texture and illumination distribution patterns of the endoscopic image, removes the classification layer from the fine-tuned initial deep learning model and extracts the backbone network weights to generate in-domain pre-trained backbone weights. The target transfer learning architecture construction module is used to load the pre-trained backbone weights in the domain into the backbone layer of the target classification model, and to perform random initialization operation on the classification head of the target classification model to generate the target transfer learning architecture to be adapted to the target disease. The hierarchical learning rate strategy configuration module is used to obtain a private small sample queue as target domain training data, establish a hierarchical learning rate strategy configuration based on the target domain training data and the target transfer learning architecture, and allocate low learning rate and high learning rate to the backbone layer and classification head of the target transfer learning architecture, respectively. The transfer fine-tuning module is used to perform transfer fine-tuning iterative calculations on the target transfer learning architecture using the hierarchical learning rate strategy configuration, to suppress small sample overfitting and optimize the classification head parameters of the target transfer learning architecture, thereby generating an endoscopic image grading model for the target disease.
