Skin Cancer Image Classification Model Training Method and Device
The skin cancer image classification model training method employs meta-learning strategies and data preprocessing to enhance model adaptability and generalization, addressing data limitations and improving diagnostic accuracy for skin cancer recognition.
Patent Information
- Application Number
- CN202510225464.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-02-27
AI Technical Summary
Existing skin cancer image recognition technology faces the problems of scarce data, imbalance in categories and insufficient diagnostic accuracy, especially when faced with new lesion images or complex images.
The meta-learning strategy (MAML) combined with the Inception-ResNetV2 network model is used to iteratively train the skin cancer image classification model. Through internal and external cycle optimization, a small number of samples are used to quickly learn model parameters, build support sets and query sets, and feature extraction and classification are performed.
The classification performance of skin cancer image classification model under small sample conditions has been improved, the data imbalance problem has been solved, and the recognition performance of a few categories has been significantly improved.
Smart Images

Figure CN119723221B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular, to a method, device, storage medium, and electronic device for training a skin cancer image classification model. Background Art
[0002] Skin cancer is one of the most common malignant tumors globally, especially high-risk types such as melanoma, and its incidence is continuously rising. Early detection and diagnosis play a crucial role in the treatment effect and survival rate of patients. However, traditional skin cancer diagnosis relies on experienced dermatologists, and the diagnosis results are greatly affected by the subjective factors of doctors, which easily leads to missed diagnoses and misdiagnoses. In addition, traditional diagnostic methods are usually time-consuming and laborious, and it is difficult to meet the requirements of modern medical efficiency.
[0003] In recent years, the application of artificial intelligence technology in the medical field has become increasingly widespread, bringing new hope for the diagnosis of skin cancer. For example, current skin cancer recognition technology uses GAN to enhance skin cancer image data, and the GAN discriminator is used as a classifier to identify 7 types of skin cancer.
[0004] However, due to the diversity of lesions and the continuous emergence of new lesions, current skin cancer recognition technology is difficult to identify when facing new lesion images or complex images. Summary of the Invention
[0005] Embodiments of this application provide a method, device, storage medium, and electronic device for training a skin cancer image classification model, which can solve the problems of scarce skin cancer image data, class imbalance, insufficient diagnostic accuracy, and limited model generalization ability in the prior art.
[0006] Embodiments of this application provide a method for training a skin cancer image classification model, including:
[0007] Obtain a skin cancer image dataset;
[0008] Preprocess the skin cancer image samples in the skin cancer image dataset;
[0009] Construct a support set and a query set based on the preprocessed skin cancer image dataset;
[0010] Input the skin cancer image dataset in the support set into the skin cancer image classification model to obtain a first skin cancer classification result;
[0011] Construct a first loss function based on the first skin cancer classification result and the true value labels corresponding to the skin cancer image samples in the support set, and based on the first loss function, iteratively train the skin cancer image classification model through a meta-learning strategy;
[0012] Among them, the iterative training of the skin cancer image classification model based on the first loss function includes: performing outer loop optimization and inner loop optimization based on the first loss function to obtain the global parameters of the updated skin cancer image classification model; inputting the query set into the skin cancer image classification model to obtain the second skin cancer classification result, and based on the second skin cancer classification result, updating the updated global parameters again.
[0013] Further, in the above method for training a skin cancer image classification model, wherein performing outer loop optimization based on the first loss function includes:
[0014] Performing outer loop optimization through the first optimization formula to update the global parameters, and the first optimization formula is:
[0015]
[0016] Wherein, is the global parameter, is the learning rate, is the gradient, is the first loss function, represents the skin cancer image classification model, represents an update.
[0017] Further, in the above method for training a skin cancer image classification model, wherein performing inner loop optimization based on the first loss function includes:
[0018] Performing inner loop optimization through the second optimization formula to update the global parameters, and the second optimization formula is:
[0019]
[0020] Wherein, is the global parameter of the updated skin cancer image classification model, is the learning rate.
[0021] Further, in the above method for training a skin cancer image classification model, wherein the re-updating of the updated global parameters based on the second skin cancer classification result includes:
[0022] Constructing a second loss function based on the second skin cancer classification result and the true label corresponding to the skin cancer image sample in the query set;
[0023] Re-updating the updated global parameters based on the second loss function.
[0024] Further, in the above skin cancer image classification model training method, the step of re-updating the updated global parameters based on the second loss function includes:
[0025] Re-updating through a third optimization formula, where the third optimization formula is:
[0026]
[0027] where, is the global parameter of the updated skin cancer image classification model after re-updating, is the learning rate, is the second loss function, represents the i-th task of training, represents the updated skin cancer image classification model.
[0028] Further, in the above skin cancer image classification model training method, after the step of re-updating the updated global parameters based on the second loss function, it includes:
[0029] Performing adaptive optimization on the skin cancer image classification model:
[0030]
[0031]
[0032] where, t is the number of iterations, , are both exponential decay rates of momentum, and are estimated values for bias correction of the first-order moment estimate and the second-order moment estimate, is the learning rate, is a constant, is the gradient.
[0033] Further, in the above skin cancer image classification model training method, the skin cancer image classification model includes:
[0034] A preliminary feature extraction module for preliminarily extracting features from a skin cancer image to obtain preliminary image features;
[0035] A multi-scale feature extraction module for performing multi-scale feature extraction and fusion on the preliminary image features to obtain fused image features;
[0036] A dimensionality reduction processing module for performing dimensionality reduction processing on the fused image features;
[0037] A pooling layer and a linear activation layer are used to further process the fused image after dimensionality reduction and perform feature mapping to obtain the skin cancer classification result.
[0038] An embodiment of the present application further provides a skin cancer image classification model training device, including:
[0039] An acquisition module for acquiring a skin cancer image data set;
[0040] A preprocessing module for preprocessing the skin cancer image samples in the skin cancer image data set;
[0041] A construction module for constructing a support set and a query set based on the preprocessed skin cancer image data set;
[0042] A classification module for inputting the skin cancer image data set in the support set into the skin cancer image classification model to obtain a first skin cancer classification result;
[0043] A training module for constructing a first loss function based on the first skin cancer classification result and the true value label corresponding to the skin cancer image sample in the support set, and iteratively training the skin cancer image classification model based on the first loss function;
[0044] Wherein, the iterative training of the skin cancer image classification model based on the first loss function includes: performing outer loop optimization and inner loop optimization based on the first loss function to obtain the global parameters of the updated skin cancer image classification model; inputting the query set into the skin cancer image classification model to obtain a second skin cancer classification result, and re-updating the updated global parameters based on the second skin cancer classification result.
[0045] An embodiment of the present application further provides a computer-readable storage medium, in which multiple instructions are stored, and the instructions are suitable for being loaded by a processor to execute any one of the above skin cancer image classification model training methods.
[0046] An embodiment of the present application further provides an electronic device, including a processor and a memory, the processor is electrically connected to the memory, the memory is used to store instructions and data, and the processor is used for the steps in any one of the above skin cancer image classification model training methods.
[0047] The skin cancer image classification model training method, device, storage medium and electronic device provided by the present application train the skin cancer image classification model through inner loop optimization and outer loop optimization, optimize the model parameters through rapid learning of a small number of samples, improve the model classification performance under the condition of small samples, solve the problems of small samples and data imbalance, and significantly improve the recognition performance of minority classes. Brief Description of the Drawings
[0048] The following will describe in detail the specific embodiments of the present application in conjunction with the accompanying drawings, and the technical solutions and other beneficial effects of the present application will become obvious.
[0049] Figure 1 It is a flowchart of a skin cancer image classification model training method provided by an embodiment of the present application.
[0050] Figure 2 It is another flowchart of a skin cancer image classification model training method provided by an embodiment of the present application.
[0051] Figure 3 It is a training flowchart of a skin cancer image classification model provided by an embodiment of the present application.
[0052] Figure 4 It is a schematic diagram of the MAML in an embodiment of the present application performing operations at two levels of local update and global update.
[0053] Figure 5 It is a schematic diagram of the structure of the Inception-ResNetV2 network model provided by an embodiment of the present application.
[0054] Figure 6 It is a schematic diagram of the structure of a skin cancer image classification model training device provided by an embodiment of the present application.
[0055] Figure 7 It is another schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed Description of the Embodiments
[0056] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0057] The embodiments of the present application provide a skin cancer image classification model training method, device, storage medium, and electronic device. A skin cancer image classification model training device provided by the embodiments of the present application can be integrated in an electronic device, and the electronic device can be a device such as a terminal or a server. Among them, the terminal can include a tablet computer, a notebook computer, a personal computer (PC), a microprocessing box, or other devices, etc.
[0058] Please refer to Figure 1 And Figure 2 , Figure 1The flowchart of the skin cancer image classification model training method provided by the embodiments of the present application Figure 2 Another flowchart of the skin cancer image classification model training method provided by the embodiments of the present application, which is applied to an electronic device. The skin cancer image classification model training method includes the following steps:
[0059] S1. Obtain a skin cancer image dataset.
[0060] As an example, the publicly available HAM10000 dataset can be used. This dataset contains seven different types of skin lesion images, covering diverse lesion characteristics.
[0061] Divide the skin cancer image dataset into a training set, a validation set, and a test set according to the ratio of 8:1:1, ensuring that the training set has sufficient data volume, and the test set and the validation set can fully evaluate the performance of the skin cancer image classification model.
[0062] S2. Preprocess the skin cancer image samples in the skin cancer image dataset.
[0063] In one embodiment, step S2 includes the following steps:
[0064] S21. Perform missing value processing: For the defective areas or noise in the skin cancer images, use bilateral filtering technology to fill and smooth, eliminating possible interferences.
[0065] S22. Perform data balancing processing: In view of the problem of class imbalance in the HAM10000 dataset, the present invention adopts a random oversampling strategy to optimize the data distribution.
[0066] Specifically, taking the category (NV) with the largest number of samples in the dataset as a benchmark, for the categories with fewer samples, randomly select and repeat their samples until the number of samples in each category is equal to that of the benchmark category, thereby constructing a balanced dataset.
[0067] S23. Perform denoising and normalization processing: Resize all images to a unified size (224×224), and apply Z-score normalization processing:
[0068]
[0069] wherein, is the sample mean, is the standard deviation of the sample.
[0070] In skin cancer images, due to the instability of shooting conditions, uneven illumination and color distortion often occur, resulting in noise in skin cancer images. These noises not only affect the visual quality of the images but also pose challenges to subsequent experiments. To overcome this challenge, the present invention combines the use of Dropout and attention mechanisms for denoising. The Dropout technique enhances the generalization ability of the model by randomly setting the outputs of some neurons to zero, obtaining different network structures in each iteration. In this way, even in noisy images, the model can adapt and learn more robust features during the training process.
[0071] S24, perform data augmentation processing:
[0072] Random transformation: including horizontal and vertical flipping, random rotation (angle range [-45°, 45°]), affine transformation and random cropping, to increase the diversity of skin cancer image samples.
[0073] Color jitter: By randomly adjusting brightness, contrast and saturation, simulate skin lesion images under different lighting conditions to improve the model's adaptability to real scenarios.
[0074] Shape enhancement: Perform shape enhancement processing on images with relatively blurred lesion boundaries to enhance boundary features and help the model capture key regions.
[0075] Random affine transformation: Through operations such as translation, scaling, and shearing of the image, to enrich the features of the image. By training the skin cancer image classification model with rich images, the generalization ability of the skin cancer image classification model can be enhanced.
[0076] S3, construct a support set and a query set based on the preprocessed skin cancer image dataset.
[0077] Specifically, randomly sample multiple groups of skin cancer images from the training set to form a support set , for task-specific optimization of the initial model parameters. The support set samples are subjected to data augmentation (such as affine transformation, cropping, etc.) to enhance the generalization ability of the model, and then a query set is separated from the training data , for verifying the performance of the model after training with the support set.
[0078] S4, input the skin cancer image dataset in the support set into the skin cancer image classification model to obtain the first skin cancer classification result.
[0079] S5, construct a first loss function based on the first skin cancer classification result and the true value labels corresponding to the skin cancer image samples in the support set. Based on the first loss function, iteratively train the skin cancer image classification model through a meta-learning strategy.
[0080] Among them, iterative training of the skin cancer image classification model through the meta-learning strategy based on the first loss function includes: performing outer-loop optimization and inner-loop optimization based on the first loss function to obtain updated global parameters of the skin cancer image classification model; inputting the query set into the skin cancer image classification model to obtain a second skin cancer classification result, and re-updating the updated global parameters based on the second skin cancer classification result. Figure 3 is the training flow chart of the skin cancer image classification model provided by the embodiment of the present application, and the following steps can be referred to Figure 3 .
[0081] In the traditional field of machine learning, the training of a model is usually carried out according to specific task requirements. However, when facing new task challenges, this often means that the model needs to be retrained, which not only takes time but also requires a large amount of data resources as support. In contrast, meta-learning, as a task-oriented method, focuses on accumulating meta-knowledge by training diverse tasks. These meta-knowledges provide valuable information gain for the model, enabling the model to exhibit excellent convergence characteristics and generalization ability when dealing with new tasks.
[0082] In the embodiment of the present application, a model-agnostic meta-learning strategy (MAML) is proposed to train the skin cancer image classification model. MAML is a model-agnostic meta-learning algorithm that can be used to quickly adapt to new tasks. This algorithm considers the model f and the distribution on the task p (T), aiming to train the model f, which can use the knowledge learned in p (T) to find parameters that can quickly adapt to new tasks . As shown in Figure 4 , Figure 4 is a schematic diagram of the MAML provided by the embodiment of the present application for performing operations at two levels of local update and global update. Specifically, in Figure 4 , the blue branch lines symbolize the local update directions of different tasks during the training process, and these updates reflect the adaptive adjustments of the model for specific tasks; while the blue main axis represents the final update trend of the model parameters globally, reflecting the meta-knowledge accumulated by the model through training on multiple tasks. The final dashed line depicts the fine-tuning process of the model when facing new tasks, reflecting the ability of the model to quickly adapt to new tasks using the accumulated meta-knowledge.
[0083] In one embodiment, performing outer-loop optimization based on the first loss function includes:
[0084] S51, performing outer-loop optimization through the first optimization formula to update the global parameters, and the first optimization formula is:
[0085]
[0086] Among them, is a global parameter, is the learning rate, is the gradient, is the first loss function, represents the skin cancer image classification model, represents an update.
[0087] Through outer loop optimization, the global parameters are optimized on the support set with multiple tasks to learn the common features between tasks, ensuring that the skin cancer image classification model can be quickly migrated to new tasks and improving the generalization ability of its initial parameters.
[0088] In one embodiment, the first loss function performs inner loop optimization, including:
[0089] S52, perform inner loop optimization through the second optimization formula to update the global parameters. The second optimization formula is:
[0090]
[0091] Among them, is the global parameter of the updated skin cancer image classification model, is the learning rate.
[0092] Through inner loop optimization, the task-specific global parameters are further optimized within the support set to make them more suitable for the current task and improve the performance on the current task.
[0093] In one embodiment, the updated global parameters are updated again based on the second skin cancer classification result, including:
[0094] S53, construct a second loss function based on the second skin cancer classification result and the true label corresponding to the skin cancer image sample in the query set;
[0095] S54, update the updated global parameters again based on the second loss function.
[0096] Specifically, step S54 includes:
[0097] Perform re-update through the third optimization formula. The third optimization formula is:
[0098]
[0099] Among them, is the global parameter of the updated skin cancer image classification model after re-update, is the learning rate, is the second loss function, Denote the i-th task of training. Denote the updated skin cancer image classification model.
[0100] Furthermore, the skin cancer image classification model is adaptively optimized through the following formula, and the learning rate of the skin cancer image classification model is adjusted to accelerate convergence:
[0101]
[0102]
[0103] Where t is the number of iterations, 、 are both the exponential decay rates of momentum, and are the estimated values for bias correction of the first-order moment estimate and the second-order moment estimate, is the learning rate, is a constant, is the gradient.
[0104] Furthermore, in the model training stage, for the overfitting problem, the embodiment of the present application adopts the L2 regularization strategy. Specifically, in the construction of the optimizer, the Weight_decay parameter is introduced, which is used to control the L2 regularization strength. At the same time, the optimizer will automatically calculate the L2 regularization term based on this parameter and incorporate it into the original loss function to form an enhanced loss function. In each iteration update, the optimizer takes this enhanced loss function as the benchmark to update the model weights, ultimately effectively improving the robustness and generalization ability of the model.
[0105] Furthermore, during the model training process, to prevent overfitting, the embodiment of the present application adopts the early stopping strategy. By monitoring the accuracy (ACC) of the skin cancer image classification model on the validation set, when there is no improvement or a decrease in the validation accuracy after multiple training epochs, it is regarded as an overfitting phenomenon and the training is immediately stopped. At this time, the model with the best previous validation performance is selected as the final model for evaluation. The early stopping strategy not only improves the generalization ability of the model but also saves computational resources.
[0106] As an example, the skin cancer image classification model can use the Inception-ResNetV2 network model. As an advanced deep convolutional neural network architecture, Inception-ResNetV2 significantly combines the multi-scale feature extraction ability of the Inception module with the residual connection mechanism of ResNet. The model starts with an input block and initially extracts image features through convolutional and pooling operations. Its core lies in a series of intertwined Inception modules and residual connections, jointly constructing a feature extraction network. Each Inception module uses convolutional kernels of different sizes to process the input data in parallel, stitches together multi-scale feature maps, and enhances the feature representation ability. At the same time, to reduce the computational complexity, a 1×1 convolution is introduced in front of the large convolutional kernel for dimensionality reduction. The residual connection solves the problem of gradient disappearance through a shortcut mechanism, ensuring the stability of training. These combined blocks deepen the model depth and improve the expressive ability. Finally, the features are processed through a fully connected layer and the prediction results are output. The Inception-ResNetV2 network model includes:
[0107] A preliminary feature extraction module for preliminarily extracting features from skin cancer images to obtain preliminary image features;
[0108] A multi-scale feature extraction module (Inception-ResNet-A / B / C) for performing multi-scale feature extraction and fusion on the preliminary image features to obtain fused image features;
[0109] A dimensionality reduction processing module for performing dimensionality reduction processing on the fused image features;
[0110] A pooling layer and a linear activation layer for further processing and feature mapping of the fused image after dimensionality reduction processing to obtain the skin cancer classification result.
[0111] Figure 5 The structural schematic diagram of the Inception-ResNetV2 network model provided by the embodiment of the present application is as Figure 5 shown. The preliminary feature extraction module includes an input layer and a stem layer (Stem module) connected in sequence. The multi-scale feature processing module and the multi-dimensionality reduction processing module are connected, specifically including 5×Inception-ResNet-A, dimensionality reduction module-A, 10×Inception-ResNet-B, dimensionality reduction module-B, 5×Inception-ResNet-C, and dimensionality reduction module-C connected in sequence. The pooling layer and the linear activation layer include global average pooling (Average Pooling), dropout layer (Dropout), and classification layer (Softmax) connected in sequence.
[0112] Specifically, the feature representation is further optimized through Dropout and Average Pooling, and the Softmax classification head is used to map the features output by the model to seven skin lesion categories to obtain the skin cancer classification results.
[0113] Furthermore, after the skin cancer image classification model is trained, the model performance can be verified and evaluated. Specifically, the model performance is evaluated by calculating evaluation metrics such as accuracy, recall, precision, and F1-Score.
[0114] In one embodiment, in order to explore the influence of the number of filters in the Inception module and the number of elements in the fully connected layer in the skin cancer image classification model on the model performance, the ablation experiment is carried out in this application embodiment. By systematically adjusting the parameters and comparing the experimental results under different configurations, the aim is to find the optimal parameter settings to optimize the classification performance of the skin cancer image classification model.
[0115] The detailed steps of the ablation experiment are as follows: First, other parameters of the Inception-ResNetV2-MAML optimization model are fixed, and only the number of elements in the fully connected layer is adjusted, and the model classification accuracy (ACC) after each adjustment is recorded. Subsequently, after determining the appropriate range of the number of elements in the fully connected layer, the number of filters of the model is further adjusted, and the ACC value after each adjustment is also recorded. Finally, the ACC values under different configurations are compared, and the ablation experiment results are shown in Table 1.
[0116] Table 1 Ablation Experiment Results
[0117]
[0118] It can be seen from the experimental results that when the number of filters increases from 32 to 64, the model classification performance is significantly improved (from 81.47% to 84.97%), indicating that increasing the number of filters helps the model capture more image features to improve the classification accuracy. However, when the number of filters increases to 96, the performance slightly drops to 83.50%, which may be due to the introduction of too much noise or redundant information. For the number of elements in the fully connected layer, when it increases from 2048 to 4096, the performance has a slight improvement (from 90.28% to 90.43%), indicating that a larger fully connected layer can enhance the model representation ability. However, the performance (89.97%) with 1024 elements is not significantly behind, indicating that in a specific task, a smaller fully connected layer may also provide sufficient representation ability.
[0119] This application trains a skin cancer image classification model through inner-loop optimization and outer-loop optimization, optimizes the model parameters through rapid learning with a small number of samples, improves the model classification performance under small sample conditions, solves the problems of small samples and data imbalance, and significantly improves the recognition performance of minority classes.
[0120] According to the method described in the above embodiments, this embodiment will be further described from the perspective of a skin cancer image classification model training device. The skin cancer image classification model training device can be specifically implemented as an independent entity, or integrated in an electronic device, which can be a device such as a terminal or a server. Among them, the terminal can include a tablet computer, a notebook computer, a personal computer (PC), a micro-processing box, or other devices, etc.
[0121] Please refer to Figure 6 , Figure 6 Specifically describes the skin cancer image classification model training device provided in the embodiments of this application, which is applied to an electronic device. The skin cancer image classification model training device may include:
[0122] An acquisition module, configured to acquire a skin cancer image data set;
[0123] A preprocessing module, configured to preprocess the skin cancer image samples in the skin cancer image data set;
[0124] A construction module, configured to construct a support set and a query set based on the preprocessed skin cancer image data set;
[0125] A classification module, configured to input the skin cancer image data set in the support set into the skin cancer image classification model to obtain a first skin cancer classification result;
[0126] A training module, configured to construct a first loss function based on the first skin cancer classification result and the true value label corresponding to the skin cancer image samples in the support set, and iteratively train the skin cancer image classification model based on the first loss function;
[0127] Among them, the iterative training of the skin cancer image classification model based on the first loss function includes: performing outer-loop optimization and inner-loop optimization based on the first loss function to obtain updated global parameters of the skin cancer image classification model; inputting the query set into the skin cancer image classification model to obtain a second skin cancer classification result, and re-updating the updated global parameters based on the second skin cancer classification result.
[0128] In specific implementation, each of the above modules and / or units can be implemented as an independent entity, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation of each of the above modules and / or units, please refer to the foregoing method embodiments. For the specific beneficial effects that can be achieved, please also refer to the beneficial effects in the foregoing method embodiments, which will not be elaborated herein.
[0129] In addition, an embodiment of the present application further provides an electronic device, which can be a device such as a computer or a tablet computer. Figure 7 The specific structural block diagram of the electronic device provided by the embodiment of the present invention is shown. The electronic device can be used to implement the skin cancer image classification model training method provided in the above embodiment. The electronic device 500 can be a device such as a terminal or a server. Among them, the terminal can include a tablet computer, a notebook computer, a personal computer (PC), a microprocessing box, or other devices, etc.
[0130] The RF circuit 510 is used to receive and transmit electromagnetic waves, realizing the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices. The RF circuit 510 may include various existing circuit components for performing these functions. For example, antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, subscriber identity module (SIM) cards, memories, and so on. The RF circuit 510 can communicate with various networks such as the Internet, intranets, wireless networks or communicate with other devices through wireless networks. The above-mentioned wireless networks may include cellular phone networks, wireless local area networks or metropolitan area networks. The above-mentioned wireless networks can use various communication standards, protocols and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (WCDMA), Code Division Access (CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wi-Fi) (such as Institute of Electrical and Electronics Engineers standards IEEE 802.11a, IEEE 802.11b, IEEE 802.11g and / or IEEE 802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access (Wi-Max), other protocols for email, instant messaging and short messages, and any other suitable communication protocols, and may even include those protocols that have not yet been developed currently.
[0131] The memory 520 can be used to store software programs and modules, such as the corresponding program instructions / modules in the above embodiments. The processor 580 executes various functional applications and data processing by running the software programs and modules stored in the memory 520, that is, to implement functions such as taking pictures with the front camera, processing the captured images, and switching the display colors of the display content on the display screen. The memory 520 can include a high-speed random access memory, and can also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 520 can further include a memory remotely disposed relative to the processor 580, and these remote memories can be connected to the electronic device 500 through a network. Examples of the above network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and combinations thereof.
[0132] The input unit 530 can be used to receive input digital or character information, and generate keyboards and mice related to user settings and function controls.
[0133] The display unit 540 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces, and these graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof. The display unit 540 can include a display panel 541. Optionally, the display panel 541 can be configured in the form of an LCD (Liquid Crystal Display) or an OLED (Organic Light-Emitting Diode).
[0134] The audio circuit 560, speaker 561, and microphone 562 can provide an audio interface between the user and the electronic device 500. The audio circuit 560 can transmit the electrical signal converted from the received audio data to the speaker 561, and the speaker 561 converts it into a sound signal for output; on the other hand, the microphone 562 converts the collected sound signal into an electrical signal, which is received by the audio circuit 560 and then converted into audio data. After the audio data is output to the processor 580 for processing, it is sent through the RF circuit 510 to, for example, another terminal, or the audio data is output to the memory 520 for further processing. The audio circuit 560 may also include an earphone jack to provide communication between an external headphone and the electronic device 500.
[0135] The electronic device 500 can help the user receive requests, send information, etc. through the transmission module 570 (such as a Wi-Fi module), and it provides the user with wireless broadband Internet access. Although the transmission module 570 is shown in the figure, it can be understood that it does not belong to the essential components of the electronic device 500 and can be completely omitted within the scope of not changing the essence of the invention according to needs.
[0136] The processor 580 is the control center of the electronic device 500, connecting various parts of the entire mobile phone through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 520, and calling the data stored in the memory 520, it executes various functions of the electronic device 500 and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 580 may include one or more processing cores; in some embodiments, the processor 580 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 580 either.
[0137] The electronic device 500 also includes a power supply 590 (such as a battery) for powering each component. In some embodiments, the power supply can be logically connected to the processor 580 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 590 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0138] Although not shown, the electronic device 500 also includes a camera (such as a front camera, a rear camera), a Bluetooth module, etc., which will not be elaborated here. Specifically, in this embodiment, the display unit of the electronic device is a touch screen display, and the mobile terminal also includes a memory, and one or more programs, where one or more programs are stored in the memory and are configured to be executed by one or more processors. One or more programs include instructions for performing the following operations:
[0139] Obtain a skin cancer image dataset;
[0140] Preprocess the skin cancer image samples in the skin cancer image dataset;
[0141] Construct a support set and a query set based on the preprocessed skin cancer image dataset;
[0142] Input the skin cancer image dataset in the support set into the skin cancer image classification model to obtain a first skin cancer classification result;
[0143] Construct a first loss function based on the first skin cancer classification result and the true value label corresponding to the skin cancer image samples in the support set, and iteratively train the skin cancer image classification model based on the first loss function;
[0144] Among them, the iterative training of the skin cancer image classification model based on the first loss function includes: performing outer-loop optimization and inner-loop optimization based on the first loss function to obtain the global parameters of the updated skin cancer image classification model; inputting the query set into the skin cancer image classification model to obtain a second skin cancer classification result, and re-updating the updated global parameters based on the second skin cancer classification result.
[0145] In specific implementation, each of the above modules can be implemented as an independent entity, or can be arbitrarily combined and implemented as the same or several entities. For the specific implementation of each of the above modules, reference can be made to the foregoing method embodiments, which will not be elaborated herein.
[0146] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the foregoing embodiments can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. For this purpose, an embodiment of the present invention provides a storage medium in which multiple instructions are stored, and the instructions can be loaded by a processor to execute the steps of any one of the embodiments of the skin cancer image classification model training method provided by the embodiments of the present invention.
[0147] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
[0148] Since the instructions stored in the storage medium can execute the steps in any one of the embodiments of the skin cancer image classification model training method provided by the embodiments of the present invention, the beneficial effects achievable by any skin cancer image classification model training method provided by the embodiments of the present invention can be achieved. For details, refer to the foregoing embodiments, which will not be elaborated herein.
[0149] The foregoing has introduced in detail a method, apparatus, storage medium, and electronic device for training a skin cancer image classification model provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A method for training a skin cancer image classification model, characterized in that, The method includes: Obtaining a skin cancer image dataset; Preprocessing the skin cancer image samples in the skin cancer image dataset; Constructing a support set and a query set based on the preprocessed skin cancer image dataset; Inputting the skin cancer image dataset in the support set into a skin cancer image classification model to obtain a first skin cancer classification result; Constructing a first loss function based on the first skin cancer classification result and the true value labels corresponding to the skin cancer image samples in the support set, and iteratively training the skin cancer image classification model through a meta-learning strategy based on the first loss function; Among them, the iterative training of the skin cancer image classification model through the meta-learning strategy based on the first loss function includes: performing outer loop optimization and inner loop optimization based on the first loss function to obtain the global parameters of the updated skin cancer image classification model; inputting the query set into the skin cancer image classification model to obtain a second skin cancer classification result, and further updating the updated global parameters based on the second skin cancer classification result; Among them, performing outer loop optimization based on the first loss function includes: Performing outer loop optimization through a first optimization formula to update the global parameters, and the first optimization formula is: Among them, is a global parameter, is the learning rate, is the gradient, is the first loss function, represents the skin cancer image classification model, represents an update; Among them, performing inner loop optimization based on the first loss function includes: Performing inner loop optimization through a second optimization formula to update the global parameters, and the second optimization formula is: Among them, are the global parameters of the updated skin cancer image classification model, is the learning rate; The skin cancer image classification model includes: a preliminary feature extraction module for performing preliminary feature extraction on a skin cancer image to obtain preliminary image features; a multi-scale feature extraction module for performing multi-scale feature extraction and fusion on the preliminary image features to obtain fused image features; a dimensionality reduction processing module for performing dimensionality reduction processing on the fused image features; a pooling layer and a linear activation layer for further processing and feature mapping of the dimensionality-reduced fused image to obtain a skin cancer classification result.
2. The method for training a skin cancer image classification model according to claim 1, wherein The further updating of the updated global parameters based on the second skin cancer classification result includes: Constructing a second loss function based on the second skin cancer classification result and the true value labels corresponding to the skin cancer image samples in the query set; Further updating the updated global parameters based on the second loss function.
3. The method for training a skin cancer image classification model according to claim 2, wherein The further updating of the updated global parameters based on the second loss function includes: Performing further update through a third optimization formula, and the third optimization formula is: Among them, are the global parameters of the updated skin cancer image classification model updated again, is the learning rate, is the second loss function, represents the i-th task of training, represents the updated skin cancer image classification model.
4. The method for training a skin cancer image classification model according to claim 3, wherein After the step of further updating the updated global parameters based on the second loss function, it includes: Performing adaptive optimization on the skin cancer image classification model: Among them, t is the number of iterations, , are both the exponential decay rates of momentum, and are the estimated values for bias correction of the first-order moment estimate and the second-order moment estimate, is the learning rate, is a constant, is the gradient, is the global parameter of the skin cancer image classification model at iteration t.
5. A training device for a skin cancer image classification model, the training device for a skin cancer image classification model being used to implement the training method for a skin cancer image classification model according to claim 1, characterized in that, Including: An acquisition module for acquiring a skin cancer image dataset; A preprocessing module for preprocessing the skin cancer image samples in the skin cancer image dataset; A construction module for constructing a support set and a query set based on the preprocessed skin cancer image dataset; A classification module for inputting the skin cancer image dataset in the support set into a skin cancer image classification model to obtain a first skin cancer classification result; A training module, configured to construct a first loss function based on the first skin cancer classification result and the ground truth labels corresponding to the skin cancer image samples in the support set, and iteratively train the skin cancer image classification model based on the first loss function through a meta-learning strategy; Wherein, the iteratively training the skin cancer image classification model based on the first loss function through a meta-learning strategy includes: performing outer-loop optimization and inner-loop optimization based on the first loss function to obtain updated global parameters of the skin cancer image classification model; inputting the query set into the skin cancer image classification model to obtain a second skin cancer classification result, and further updating the updated global parameters based on the second skin cancer classification result.
6. A computer-readable storage medium, characterized in that, Multiple instructions are stored in the computer-readable storage medium, and the instructions are adapted to be loaded by a processor to execute the skin cancer image classification model training method according to any one of claims 1 to 4.
7. An electronic device, characterized in that, It includes a processor and a memory, the processor is electrically connected to the memory, the memory is used to store instructions and data, and the processor is used to execute the steps in the skin cancer image classification model training method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Rare fundus disease automatic classification method and system based on OCT image
CN118411573A
Deep interpretable skin disease identification method based on small sample learning
CN119251228A