Training method and device of image classification model, equipment and storage medium

By segmenting images to extract foreground and background features, and combining VGG and MLP models to generate an image classification model, the problem of inaccurate classification caused by global feature extraction is solved, achieving higher classification accuracy and applicability.

CN116681971BActive Publication Date: 2026-04-07PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2026-04-07

Smart Images

  • Figure CN116681971B_ABST
    Figure CN116681971B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of training method, device and equipment of image classification model and storage medium, involve artificial intelligence field.The method comprises: obtaining training image set, and determining target image and its corresponding image type from training image set;Image segmentation processing is carried out to the image in training image set, and the foreground feature and background feature of image are obtained;According to the foreground feature and background feature of image, corresponding training data set is generated, and according to target image and image type, the training label corresponding to training data set is determined;According to training data set and training label, label identification result and image classification result are generated;According to label identification result and image classification result, the first model parameter and second model parameter of image classification model are determined, and target image classification model is generated according to the first model parameter and second model parameter.The embodiment of the present application aims to improve the classification precision, applicability and generalization ability of image classification model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of artificial intelligence, and in particular to a training method of an image classification model, a training device of an image classification model, a computer device and a computer readable storage medium. BACKGROUND

[0002] In the prior art, a traditional feature extraction model is used in the task of image classification, specifically, image classification is performed by extracting global features of an image. However, in the task of image classification, a large amount of non-important information is often contained in an image. For example, in the medical field, a large amount of medical images such as patient lung images are often contained, and these medical images often contain a large amount of non-important information.

[0003] Since the prior art extracts global features of an image for image classification, these non-important information is also concerned by the model, which makes the classification accuracy of the model not high, resulting in the problem of inaccurate image classification. SUMMARY

[0004] The present application provides a training method of an image classification model, a training device of an image classification model, a computer device and a computer readable storage medium, which aims to improve the classification accuracy, applicability and generalization ability of the image classification model, improve the classification accuracy of medical images, and accurately extract key features of medical images.

[0005] To achieve the above-mentioned purpose, the present application provides a training method of an image classification model, which comprises:

[0006] obtaining a training image set, and determining a target image and its corresponding image type from the training image set;

[0007] performing image segmentation processing on the images in the training image set to obtain foreground features and background features of the images;

[0008] generating a corresponding training data set according to the foreground features and the background features of the images, and determining a training label corresponding to the training data set according to the target image and the image type;

[0009] generating a label recognition result and an image classification result according to the training data set and the training label;

[0010] determining a first model parameter of the image classification model according to the label recognition result, determining a second model parameter of the image classification model according to the image classification result, and generating a target image classification model according to the first model parameter and the second model parameter.

[0011] To achieve the above object, the present application further provides a training device of an image classification model, comprising:

[0012] an image set obtaining module, configured to obtain a training image set, and determine a target image and a corresponding image type from the training image set;

[0013] an image segmentation module, configured to perform image segmentation processing on images in the training image set to obtain foreground features and background features of the images;

[0014] a label generating module, configured to generate a corresponding training data set according to the target image and the foreground features and the background features of the images, and determine a training label corresponding to the training data set according to the image type;

[0015] a data recognition module, configured to generate a label recognition result and an image classification result according to the training data set and the training label;

[0016] a parameter determining module, configured to determine a first model parameter of the image classification model according to the label recognition result, and determine a second model parameter of the image classification model according to the image classification result;

[0017] a model generating module, configured to generate a target image classification model according to the first model parameter and the second model parameter.

[0018] In addition, to achieve the above object, the present application further provides a computer device, comprising a memory and a processor; the memory is configured to store a computer program; the processor is configured to execute the computer program and realize the training method of the image classification model provided by any one of the embodiments of the present application when the computer program is executed.

[0019] In addition, to achieve the above object, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program makes the processor realize the training method of the image classification model provided by any one of the embodiments of the present application when the computer program is executed by the processor.

[0020] The training method of the image classification model, the training device of the image classification model, the computer device and the computer readable storage medium disclosed by the embodiments of the present application extract corresponding features through the picture type of the target image, and generate corresponding training data sets and corresponding training labels according to the extracted features; the label recognition result and the image classification result are generated according to the training data set and the training label, so as to determine the first model parameter and the second model parameter of the image classification model; and the target image classification model is generated according to the first model parameter and the second model parameter. Therefore, the features with higher priority can be selected for training according to different picture types, so as to improve the classification accuracy, applicability and generalization ability of the image classification model, improve the classification accuracy of the medical image, and accurately extract the key features of the medical image. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0022] Figure 1 is a scene schematic diagram of a training method of an image classification model provided by an embodiment of the present application;

[0023] Figure 2 is a flow schematic diagram of a training method of an image classification model provided by an embodiment of the present application;

[0024] Figure 3 is a flow schematic diagram of determining a training label corresponding to a training data set according to a target image and an image type provided by an embodiment of the present application;

[0025] Figure 4 is a schematic block diagram of a training device of an image classification model provided by an embodiment of the present application;

[0026] Figure 5 is a schematic block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0028] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily need to be performed in the described order. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation. Furthermore, although functional modules are divided in the device diagram, in some cases, a different module division may be used.

[0029] The term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items, as well as all possible combinations, and includes such combinations.

[0030] In existing technologies, image classification is generally performed by extracting global features. Therefore, even these less important features are considered by the model, leading to low classification accuracy and inaccurate image classification. To address this issue, existing technologies typically employ data augmentation to improve the accuracy of image feature recognition. Specifically, methods such as image rotation, cropping, or adding noise are commonly used to enhance the image. However, augmented images can sometimes negatively impact the model. For example, cropped images may remove crucial information, resulting in low classification accuracy and inaccurate image classification models.

[0031] To improve the classification accuracy, applicability, and generalization ability of image classification models, this application proposes a training method, a training device, a computer device, and a computer-readable storage medium for image classification models. This allows for the selection of higher-priority features for training different image types, thereby improving the classification accuracy, applicability, and generalization ability of the image classification model.

[0032] This method can be applied to servers or terminal devices to generate corresponding image classification models. Terminal devices can include fixed terminals such as mobile phones, tablets, and personal digital assistants (PDAs). Servers can be, for example, standalone servers or server clusters. However, for ease of understanding, the following embodiments will describe in detail the training method for image classification models applied to servers.

[0033] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0034] like Figure 1 As shown, the image classification model training method provided in this application embodiment can be applied to, for example... Figure 1The application environment shown. The application environment includes a terminal device 110 and a server 120, wherein the terminal device 110 can communicate with the server 120 through a network. Specifically, the server 120 obtains a training image set, and determines a target image and its corresponding image type from the training image set; performs image segmentation processing on the images in the training image set to obtain foreground features and background features of the images; generates a corresponding training data set according to the foreground features and the background features of the images, and determines a training label corresponding to the training data set according to the target image and the image type; generates a label recognition result and an image classification result according to the training data set and the training label; determines a first model parameter of an image classification model according to the label recognition result, and determines a second model parameter of the image classification model according to the image classification result; generates a target image classification model according to the first model parameter and the second model parameter, and sends the generated target image classification model to the terminal device 110. The server 120 can be an independent server, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms, etc. Basic cloud computing services. The terminal device 110 can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application.

[0035] Please refer to Figure 2 , Figure 2 The image classification model training method provided by the embodiments of the present application is a schematic flow chart of an image classification model training method. The image classification model training method can be applied in a server, so that features with higher priority can be selected for training according to different image types, thereby improving the classification accuracy, applicability and generalization ability of the image classification model, improving the classification accuracy of medical images, and accurately extracting key features of medical images.

[0036] As Figure 2 shown, the image classification model training method includes steps S101 to S105.

[0037] S101, obtaining a training image set, and determining a target image and its corresponding image type from the training image set.

[0038] The training image set includes multiple training images. These images can be filtered before being used to train the image classification model. The target image serves as a standard image, used to assess the classification accuracy of the model. The image type represents the main objects in the image, which can include patient organs, human figures, animals, scenery, and clothing, etc.

[0039] For example, the training image set can be an image set corresponding to medical images, such as lung images corresponding to multiple different patients, or lung images corresponding to the same patient at different times.

[0040] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0041] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0042] For example, an image can be randomly selected from the training image set as the target image, and the image information of the target image can be obtained from the training image set to determine its corresponding image type.

[0043] For example, the training image set may contain images that include multiple image types, such as people and animals. Since the image contains multiple image types, it is not used as a standard image for training the image classification model. Therefore, an image with a relatively clear image type (i.e., the image contains only one image type) can be selected from the training image set as the target image, and the image information of the target image can be obtained from the training image set to determine its corresponding image type.

[0044] S102. Perform image segmentation processing on the images in the training image set to obtain the foreground features and background features of the images.

[0045] Among them, foreground features are those whose pixel gray values ​​are within the gray value threshold range, and background features are those whose pixel gray values ​​are outside the gray value threshold range.

[0046] In some embodiments, the training image set can be randomly sampled to obtain multiple training images; based on a preset image segmentation model, the training images are segmented to obtain foreground and background features. This allows for accurate segmentation of the training images, thereby obtaining foreground and background features.

[0047] Among them, the image segmentation model is used to separate the foreground features and background features of an image. The image segmentation model can be trained by models such as the backbone model.

[0048] Specifically, you can set a batch size and randomly sample multiple images from the training image set according to the batch size as a batch of data, which includes multiple training images for model training.

[0049] The batch size can be 8 or 16, and is generally a multiple of 8.

[0050] Specifically, the training image set is randomly sampled to obtain training images, and features are extracted from the training images to obtain corresponding image features. The image features are then filtered to obtain the foreground and background features of the training images.

[0051] For example, any backbone model that can separate the foreground and background of an image can be used. All images in the batch are input into this backbone model to obtain the foreground and background features of each image, which can be represented as (…).<fg1,bg1> ,<fg2,bg2> , ...,<fgs,bgs> fg is used to represent foreground features, and bg is used to represent background features.

[0052] Specifically, feature extraction is performed on the training image to obtain the corresponding image features. Then, it is determined that the pixel grayscale value of the image feature is within the grayscale value threshold range. If the pixel grayscale value of the image feature is within the grayscale value threshold range, then the image feature is determined to be a foreground feature. If the pixel grayscale value of the image feature is outside the grayscale value threshold range, then the image feature is determined to be a background feature.

[0053] Each training image corresponds to at least two image features: foreground features and background features.

[0054] For example, if the grayscale threshold range is set to 0 to 255, after extracting features from the training image and obtaining the corresponding image features, if the pixel grayscale value of the image feature is detected to be 155, then the pixel grayscale value of the image feature is determined to be within the range of 0 to 255; thus, the image feature is determined to be a foreground feature.

[0055] For example, if the grayscale threshold range is set to 0 to 255, after extracting features from the training image and obtaining the corresponding image features, if the pixel grayscale value of the image feature is detected to be 256, then the pixel grayscale value of the image feature is determined to be outside the range of 0 to 255; thus, the image feature is determined to be a background feature.

[0056] For example, features can be extracted from medical images, such as lung images, to obtain corresponding image features, such as lung shadow features and lung shape features. Then, it is determined that the pixel grayscale value of the above image features is within the grayscale value threshold range. If the pixel grayscale value of the image feature is within the grayscale value threshold range, then the image feature is determined to be a foreground feature. If the pixel grayscale value of the image feature is outside the grayscale value threshold range, then the image feature is determined to be a background feature.

[0057] S103. Generate a corresponding training dataset based on the foreground and background features of the image, and determine the training labels corresponding to the training dataset based on the target image and the image type.

[0058] The training dataset is the dataset used for model training. Training labels can include positive and negative labels. Positive labels represent positive examples of the image classification model, and negative labels represent negative examples. Positive and negative labels can be determined based on the target image and image type.

[0059] In some embodiments, the foreground and background features of the image are randomly combined to obtain multiple feature data pairs, and the training dataset is generated based on the multiple feature data pairs. Thus, multiple feature data pairs can be generated to form a training dataset.

[0060] Among them, the feature data pairs are data pairs formed by random combination of foreground features and background features.

[0061] Specifically, the foreground features of all images can be used as the first dataset, and the background features of all images can be used as the second dataset. By randomly combining the foreground features in the first dataset and the background features in the second dataset, feature data pairs are obtained, and a training dataset is generated based on multiple feature data pairs.

[0062] For example, by obtaining the foreground and background features of each image (e.g., 3 images), the foreground and background features of these 3 images can be represented.<fg1,bg1> ,<fg2,bg2> ,<fg3,bg3> Given a dataset where the first dataset is (fg1, fg2, fg3) and the second dataset is (bg1, bg2, bg3), we randomly combine the foreground features from the first dataset with the background features from the second dataset to obtain feature data pairs. These feature data pairs can be represented as (<fg1,bg1> ,<fg1,bg2> ,<fg1,bg3> ,<fg2,bg1> ,<fg2,bg2> ,<fg2,bg3> ,<fg3,bg1> ,<fg3,bg2> ,<fg3,bg3> ), and generate corresponding training datasets based on these feature data.

[0063] It should be noted that the corresponding information of foreground features and background features in each feature data pair is not consistent.

[0064] In some embodiments, the model training requirements of the image classification model are determined according to the image type; multiple feature data pairs in the training dataset are filtered according to the target image and the model training requirements to obtain target feature data pairs, and these target feature data pairs are used as the training labels corresponding to the training dataset. This allows for accurate determination of training labels based on the model training requirements, thereby generating an image classification model that meets user needs.

[0065] The model training requirements can represent the preferred classification of the image classification model. For example, if the image classification model is generally used to classify portraits, the model training requirements can be foreground feature requirements; if the image classification model is generally used to classify objects, the model training requirements can be background feature requirements. The target feature data pairs are the feature data pairs selected through the model training requirements and are used as positive labels for the image classification model.

[0066] like Figure 3 As shown, specifically, determining the training labels corresponding to the training dataset based on the target image and the image type may include steps S201 to S203.

[0067] S201. Determine the model training requirements of the image classification model based on the image type.

[0068] S202. Based on the target image and the model training requirements, multiple feature data pairs in the training dataset are filtered to obtain target feature data pairs.

[0069] S203. Use the target feature data pairs as the training labels corresponding to the training dataset.

[0070] For example, if the target image is classified as a portrait, then the foreground features have a higher priority in the input information of the image classification model. In this case, the model training requirement is foreground features, indicating that foreground features are more important than background features in the current image classification task. If the target image is classified as a scene, then the background features have a higher priority in the input information of the image classification model. In this case, the model training requirement is for background features, indicating that background features are more important than foreground features in the current image classification task.

[0071] It should be noted that the training requirements for this model can also be determined directly by the user, and no specific restrictions are imposed here.

[0072] In some embodiments, if the model training requirement is a foreground feature requirement, the foreground features corresponding to the target image are obtained; it is determined whether the foreground features in each of the feature data pairs match the foreground features corresponding to the target image; if the foreground features in a feature data pair match the foreground features corresponding to the target image, then that feature data pair is taken as the target feature data pair. This allows for accurate selection of feature data pairs that meet the model training requirements as target feature data pairs.

[0073] Specifically, it is determined whether the foreground features in each of the feature data pairs match the foreground features corresponding to the target image; if the foreground features in a feature data pair match the foreground features corresponding to the target image, then the feature data pair is taken as the target feature data pair; if the foreground features in no feature data pair match the foreground features corresponding to the target image, then re-detection or re-determining the model training requirements is performed.

[0074] For example, it can be determined whether the foreground features in each of the feature data pairs are the same as the foreground features corresponding to the target image; if the foreground features in a feature data pair are the same as the foreground features corresponding to the target image, then the feature data pair is taken as the target feature data pair.

[0075] For example, it can also be determined whether the foreground features in each of the feature data pairs have a similarity of more than 90% with the foreground features corresponding to the target image; if the foreground features in a feature data pair have a similarity of more than 90% with the foreground features corresponding to the target image, then the feature data pair is taken as the target feature data pair.

[0076] For example, if the target image is represented as<fg1,bg1> The model training requirement is foreground feature requirements, and the feature data pairs can include (<fg1,bg1> ,<fg1,bg2> ,<fg1,bg3> ,<fg2,bg1> ,<fg2,bg2> ,<fg2,bg3> ,<fg3,bg1> ,<fg3,bg2> ,<fg3,bg3> If the target feature data pair (i.e., positive label) is obtained by filtering at this time, then it is (<fg1,bg1> ,<fg1,bg2> ,<fg1,bg3> ).

[0077] In some embodiments, if the model training requirement is a background feature requirement, the background features corresponding to the target image are obtained; it is determined whether the background features in each of the feature data pairs match the background features corresponding to the target image; if the background features in a feature data pair match the background features corresponding to the target image, then that feature data pair is taken as the target feature data pair. This allows for accurate selection of feature data pairs that meet the model training requirements as target feature data pairs.

[0078] Specifically, it is determined whether the background features in each of the feature data pairs match the background features corresponding to the target image; if the background features in a feature data pair match the background features corresponding to the target image, then the feature data pair is taken as the target feature data pair; if the background features in no feature data pair match the background features corresponding to the target image, then re-detection or re-determining the model training requirements is performed.

[0079] For example, it can be determined whether the background features in each of the feature data pairs are the same as the background features corresponding to the target image; if the background features in a feature data pair are the same as the background features corresponding to the target image, then the feature data pair is taken as the target feature data pair.

[0080] For example, it can also be determined whether the background features in each of the feature data pairs have a similarity of more than 90% with the background features corresponding to the target image; if the background features in a feature data pair have a similarity of more than 90% with the background features corresponding to the target image, then the feature data pair is taken as the target feature data pair.

[0081] For example, if the target image is represented as<fg1,bg1> The model training requirement is a background feature requirement, at which point the feature data pairs can include (<fg1,bg1> ,<fg1,bg2> ,<fg1,bg3> ,<fg2,bg1> ,<fg2,bg2> ,<fg2,bg3> ,<fg3,bg1> ,<fg3,bg2> ,<fg3,bg3> If the target feature data pair (i.e., positive label) is obtained by filtering at this time, then it is (<fg1,bg1> ,<fg2,bg1> ,<fg3,bg1> ).

[0082] S104. Generate label recognition results and image classification results based on the training dataset and the training labels.

[0083] The label recognition result is the recognition result of the training data and the training labels, which is used to determine the first model parameters of the image classification model; the image classification result is the classification result of the image classification model on the target image, which is used as the second model parameter of the image classification model.

[0084] In some embodiments, similarity calculations can be performed between feature data pairs corresponding to training images in the training dataset and feature data pairs of the target image to obtain similarity values ​​between the training images in the training dataset and the target image; the target image is then classified to obtain a predicted image category value; the similarity value between the training images in the training dataset and the target image is used as the label recognition result, and the predicted image category value corresponding to the target image is used as the image classification result. This allows for accurate determination of the label recognition result and the image classification result, thereby determining the first and second model parameters of the image classification model.

[0085] The similarity value between the training images in the training dataset and the target image is used to represent the degree of similarity between each training image in the training dataset and the target image, and the image category prediction value is used to represent the predicted image category corresponding to the training image in the training dataset.

[0086] Specifically, the similarity between the feature data pairs corresponding to each training image in the training dataset and the feature data pairs of the target image is calculated. By comparing the features of each training image with the features of the target image, the similarity value between each training image in the training dataset and the target image is obtained, thereby generating the corresponding label recognition result.

[0087] For example, the feature data corresponding to the training image is paired<fg2,bg1> Pair with feature data of the target image respectively<fg1,bg1> Similarity calculation is performed by comparing the features of each training image with the features of the target image, thus obtaining a similarity value of 80% between each training image and the target image in the training dataset.

[0088] Specifically, the feature data corresponding to the target image can be input into the image classification model to classify the target image and obtain the predicted image category value corresponding to the target image.

[0089] For example, the feature data corresponding to the target image can be paired.<fg1,bg1> The image is input into an image classification model to classify the target image. The predicted value for human figures is 80%, for animals it is 19%, and for scenery it is 1%. Therefore, the target image is classified as a human figure.

[0090] S105. Determine the first model parameters of the image classification model based on the label recognition result, determine the second model parameters of the image classification model based on the image classification result, and generate the target image classification model based on the first model parameters and the second model parameters.

[0091] The first model parameter can be determined by the label recognition results and used to train the VGG model; the second model parameter can be determined by the image classification results and used to train the MLP model; the image classification model can be composed of a combination of the VGG model and the MLP model. The target image classification model is an image classification model with high classification accuracy, strong applicability, and good generalization ability.

[0092] Specifically, the VGG model's parameters are trained, resulting in the first set of model parameters. Next, an MLP model is added after the VGG model for further classification training. During training, the VGG model's parameters are frozen and not updated. Then, the MLP model's parameters are trained, resulting in the second set of model parameters. Finally, the image classification model's parameters are set based on these first and second model parameters to generate the target image classification model.

[0093] In some embodiments, a loss function is calculated based on the similarity values ​​between the training images and the target image in the training dataset and the training labels to obtain the first model parameters of the image classification model. This allows for the accurate determination of the first model parameters of the image classification model by calculating the loss function.

[0094] Specifically, the similarity values ​​between the training images and the target images in the training dataset are calculated using the infoNCE loss function along with the training labels (positive labels) to obtain the corresponding loss error values. The VGG model is then trained using backpropagation based on the loss error values ​​to obtain the first model parameters of the image classification model.

[0095] In some embodiments, error gradients are obtained by calculating the predicted image category value corresponding to the target image; the error gradients are then backpropagated to train the image classification model, thereby obtaining the second model parameters of the image classification model. This allows for the accurate determination of the second model parameters of the image classification model by calculating the error gradients.

[0096] Specifically, the error gradient can be obtained by using traditional cross-entropy to calculate the error of the image category prediction value corresponding to the target image. The error gradient is then backpropagated to train the image classification model, thereby obtaining the second model parameters of the image classification model, so as to continuously update the model parameters of the image classification model.

[0097] The image classification model training method, training device, computer equipment, and computer-readable storage medium disclosed in this application extract corresponding features based on the image type of the target image, and generate corresponding training datasets and training labels based on the extracted features; generate label recognition results and image classification results based on the training dataset and training labels, thereby determining the first model parameters and second model parameters of the image classification model; and generate the target image classification model based on the first model parameters and second model parameters. This allows for the selection of higher-priority features for training different image types, thereby improving the classification accuracy, applicability, and generalization ability of the image classification model, enhancing the classification accuracy of medical images, and accurately extracting key features from medical images.

[0098] This application focuses on the fusion of foreground and background in an image. By separating the foreground and background of an image, swapping the background features within a batch, and then re-fusing them with the foreground before classifying the image, the generalization ability of the model can be significantly improved.

[0099] Please see Figure 4 , Figure 4 This is a schematic block diagram of a training device for an image classification model provided in one embodiment of this application. The training device for the image classification model can be configured in a server to execute the aforementioned training method for the image classification model.

[0100] like Figure 4 As shown, the training device 300 for the image classification model includes: a training image set acquisition module 301, an image segmentation module 302, a label generation module 303, a data recognition module 304, and a model generation module 305.

[0101] The image set acquisition module 301 is used to acquire a training image set and determine the target image and its corresponding image type from the training image set.

[0102] Image segmentation module 302 is used to perform image segmentation processing on images in the training image set to obtain foreground features and background features of the images;

[0103] The label generation module 303 is used to generate a corresponding training dataset based on the target image and the foreground and background features of the image, and to determine the training labels corresponding to the training dataset based on the image type.

[0104] Data recognition module 304 is used to generate label recognition results and image classification results based on the training dataset and the training labels;

[0105] The model generation module 305 is used to determine the first model parameters of the image classification model based on the label recognition result, determine the second model parameters of the image classification model based on the image classification result, and generate a target image classification model based on the first model parameters and the second model parameters.

[0106] In some embodiments, the image segmentation module 302 is further configured to perform random sampling processing on the training image set to obtain multiple training images; and perform image segmentation processing on the training images based on a preset image segmentation model to obtain the foreground features and background features of the training images.

[0107] In some embodiments, the label generation module 303 is further configured to randomly combine the foreground features and background features of the image to obtain multiple feature data pairs, and generate the training dataset based on the multiple feature data pairs.

[0108] In some embodiments, the label generation module 303 is further configured to determine the model training requirements of the image classification model according to the image type; filter multiple feature data pairs in the training dataset according to the target image and the model training requirements to obtain target feature data pairs, and use the target feature data pairs as training labels corresponding to the training dataset.

[0109] In some embodiments, the label generation module 303 is further configured to: if the model training requirement is a foreground feature requirement, obtain the foreground features corresponding to the target image; determine whether the foreground features in each of the feature data pairs match the foreground features corresponding to the target image; and if the foreground features in a feature data pair match the foreground features corresponding to the target image, then use the feature data pair as the target feature data pair.

[0110] In some embodiments, the label generation module 303 is further configured to: if the model training requirement is a background feature requirement, obtain the background features corresponding to the target image; determine whether the background features in each of the feature data pairs match the background features corresponding to the target image; if the background features in a feature data pair match the background features corresponding to the target image, then use the feature data pair as the target feature data pair.

[0111] In some embodiments, the data recognition module 304 is further configured to perform similarity calculation between the feature data pairs corresponding to the training images in the training dataset and the feature data pairs of the target image to obtain a similarity value between the training images in the training dataset and the target image; perform classification processing on the target image to obtain an image category prediction value corresponding to the target image; use the similarity value between the training images in the training dataset and the target image as the label recognition result, and use the image category prediction value corresponding to the target image as the image classification result.

[0112] In some embodiments, the model generation model 305 is further configured to calculate a loss function based on the similarity values ​​between the training images and the target images in the training dataset and the training labels to obtain the first model parameters of the image classification model.

[0113] In some embodiments, the model generation model 305 is further configured to perform error calculation based on the image category prediction value corresponding to the target image to obtain the error gradient; and to perform backpropagation training on the error gradient to obtain the second model parameters of the image classification model.

[0114] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the devices, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0115] The methods and apparatus of this application can be used in a wide variety of general-purpose or special-purpose computing system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer terminal devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0116] For example, the above-described method and apparatus can be implemented as a computer program, which can be used in, for example... Figure 5 It runs on the computer device shown.

[0117] Please see Figure 5 , Figure 5This is a schematic diagram of a computer device provided in an embodiment of this application. The computer device may be a server.

[0118] like Figure 5 As shown, the computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include volatile storage media, non-volatile storage media, and internal memory.

[0119] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform a training method for any image classification model.

[0120] The processor provides computing and control capabilities, supporting the operation of the entire computer device.

[0121] Internal memory provides an environment for the execution of computer programs stored in non-volatile storage media. When these computer programs are executed by a processor, the processor can perform any training method for an image classification model.

[0122] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that the structure of this computer device is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0123] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.

[0124] In some embodiments, the processor is used to run a computer program stored in a memory to perform the following steps: acquiring a training image set and determining a target image and its corresponding image type from the training image set; performing image segmentation processing on the images in the training image set to obtain foreground features and background features of the images; generating a corresponding training dataset based on the foreground features and background features of the images, and determining training labels corresponding to the training dataset based on the target image and the image type; generating label recognition results and image classification results based on the training dataset and the training labels; determining a first model parameter of the image classification model based on the label recognition results, determining a second model parameter of the image classification model based on the image classification results, and generating a target image classification model based on the first model parameter and the second model parameter.

[0125] In some embodiments, the processor is further configured to perform random sampling processing on the training image set to obtain multiple training images; and to perform image segmentation processing on the training images based on a preset image segmentation model to obtain the foreground features and background features of the training images.

[0126] In some implementations, the processor is further configured to randomly combine the foreground and background features of the image to obtain multiple feature data pairs, and generate the training dataset based on the multiple feature data pairs.

[0127] In some implementations, the processor is further configured to determine the model training requirements of the image classification model based on the image type; filter multiple feature data pairs in the training dataset according to the target image and the model training requirements to obtain target feature data pairs, and use the target feature data pairs as training labels corresponding to the training dataset.

[0128] In some implementations, the processor is further configured to, if the model training requirement is a foreground feature requirement, acquire the foreground features corresponding to the target image; determine whether the foreground features in each of the feature data pairs match the foreground features corresponding to the target image; and if the foreground features in a feature data pair match the foreground features corresponding to the target image, then use that feature data pair as the target feature data pair.

[0129] In some implementations, the processor is further configured to: if the model training requirement is a background feature requirement, acquire the background features corresponding to the target image; determine whether the background features in each of the feature data pairs match the background features corresponding to the target image; and if the background features in a feature data pair match the background features corresponding to the target image, then use that feature data pair as the target feature data pair.

[0130] In some embodiments, the processor is further configured to perform similarity calculation between feature data pairs corresponding to training images in the training dataset and feature data pairs of the target image to obtain similarity values ​​between the training images in the training dataset and the target image; perform classification processing on the target image to obtain image category prediction values ​​corresponding to the target image; use the similarity values ​​between the training images in the training dataset and the target image as the label recognition result, and use the image category prediction values ​​corresponding to the target image as the image classification result.

[0131] In some implementations, the processor is further configured to calculate a loss function based on the similarity values ​​between the training images and the target images in the training dataset and the training labels to obtain the first model parameters of the image classification model.

[0132] In some implementations, the processor is further configured to perform error calculation based on the image category prediction value corresponding to the target image to obtain an error gradient; and to perform backpropagation training on the error gradient to obtain the second model parameters of the image classification model.

[0133] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed, implement a training method for any image classification model provided in this application.

[0134] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.

[0135] Furthermore, the computer-readable storage medium may primarily include a program storage area and a data storage area, wherein the program storage area may store the operating system, at least one application required for a function, etc.; and the data storage area may store data created based on the use of blockchain nodes, etc.

[0136] This invention refers to a novel application model of computer technologies such as storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms in the blockchain language model. A blockchain, essentially a decentralized database, is a chain of data blocks linked using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0137] The above description is merely a specific 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 equivalent modifications or substitutions within the technical scope disclosed in this application, and such 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 claims.

Claims

1. A training method for an image classification model, characterized in that, The method includes: Obtain a training image set, and determine the target image and its corresponding image type from the training image set; Image segmentation processing is performed on the images in the training image set to obtain the foreground and background features of the images; A corresponding training dataset is generated based on the foreground and background features of the image, and training labels corresponding to the training dataset are determined based on the target image and the image type. Generate label recognition results and image classification results based on the training dataset and the training labels; The first model parameters of the image classification model are determined based on the label recognition result, the second model parameters of the image classification model are determined based on the image classification result, and the target image classification model is generated based on the first model parameters and the second model parameters. Determining the training labels corresponding to the training dataset based on the target image and the image type includes: The training requirements for the image classification model are determined based on the image type. Based on the target image and the model training requirements, multiple feature data pairs in the training dataset are filtered to obtain target feature data pairs, and the target feature data pairs are used as the training labels corresponding to the training dataset.

2. The method according to claim 1, characterized in that, The step of performing image segmentation processing on the images in the training image set to obtain the foreground and background features of the images includes: The training image set is randomly sampled to obtain multiple training images; Based on a preset image segmentation model, the training image is segmented to obtain the foreground and background features of the training image.

3. The method according to claim 1, characterized in that, The step of generating a corresponding training dataset based on the foreground and background features of the image includes: The foreground and background features of the image are randomly combined to obtain multiple feature data pairs, and the training dataset is generated based on the multiple feature data pairs.

4. The method according to claim 1, characterized in that, The step of filtering multiple feature data pairs in the training dataset according to the model training requirements to obtain target feature data pairs includes: If the model training requirement is foreground feature requirement, obtain the foreground features corresponding to the target image; Determine whether the foreground features in each of the feature data pairs match the foreground features corresponding to the target image; If a foreground feature in the feature data pair matches the foreground feature corresponding to the target image, then the feature data pair is taken as the target feature data pair.

5. The method according to claim 1, characterized in that, The step of filtering multiple feature data pairs in the training dataset according to the model training requirements to obtain target feature data pairs includes: If the model training requirement is a background feature requirement, obtain the background features corresponding to the target image; Determine whether the background features in each of the feature data pairs match the background features corresponding to the target image; If a background feature in a feature data pair matches the background feature corresponding to the target image, then that feature data pair is taken as the target feature data pair.

6. The method according to claim 1, characterized in that, The step of generating label recognition results and image classification results based on the training dataset and the training labels includes: The similarity between the training images in the training dataset and the target images is obtained by calculating the similarity between the feature data pairs corresponding to the training images in the training dataset and the feature data pairs of the target images. The target image is classified to obtain the image category prediction value corresponding to the target image; The similarity value between the training images in the training dataset and the target image is used as the label recognition result, and the image category prediction value corresponding to the target image is used as the image classification result.

7. A training device for an image classification model, characterized in that, include: An image set acquisition module is used to acquire a training image set and determine the target image and its corresponding image type from the training image set. The image segmentation module is used to perform image segmentation processing on the images in the training image set to obtain the foreground features and background features of the images; The label generation module is used to generate a corresponding training dataset based on the target image and the foreground and background features of the image, and to determine the training labels corresponding to the training dataset based on the image type. The data recognition module is used to generate label recognition results and image classification results based on the training dataset and the training labels; The model generation module is used to determine the first model parameters of the image classification model based on the label recognition result, determine the second model parameters of the image classification model based on the image classification result, and generate a target image classification model based on the first model parameters and the second model parameters. Determining the training labels corresponding to the training dataset based on the target image and the image type includes: The training requirements for the image classification model are determined based on the image type. Based on the target image and the model training requirements, multiple feature data pairs in the training dataset are filtered to obtain target feature data pairs, and the target feature data pairs are used as the training labels corresponding to the training dataset.

8. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, in executing the computer program, implement: The training method for the image classification model as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement the training method for the image classification model as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Image segmentation network processing method and device, image segmentation method and device and computer equipment

    CN112232355A

  • Model training method, image recognition method, terminal equipment and computer medium

    CN114548213A