Image classification method, image classification model training method and device
By extracting and adjusting target and background image feature information in medical images, adaptive processing is achieved, which solves the problem of low accuracy of medical image classification in the existing technology and improves the identification ability of lesion areas and the accuracy of classification results.
Patent Information
- Application Number
- CN201910620467.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-10
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2039-07-10
AI Technical Summary
Existing image analysis methods based on SE-Net are difficult to effectively adapt weighted features in medical images due to problems such as insufficient information and small brightness differences, resulting in low classification accuracy and the inability to use segmentation information in medical images to improve classification accuracy. .
By extracting feature information and weight information of target images and background images in medical images, machine learning models are used to perform feature extraction and weight adjustment, and are applied to different areas of the image to achieve adaptive processing and improve the accuracy of classification results.
Effective use of segmentation information in medical images improves the accuracy of image classification, avoids the loss of important features and the confusion of interference features, and enhances the ability to identify lesion areas.
Smart Images

Figure CN110348515B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image classification method and device, an image classification model training method and device, and an electronic device. Background Art
[0002] Medical imaging refers to the technology and process of obtaining images of internal tissues of the human body or a part of the human body in a non-invasive manner for medical treatment or medical research. Medical imaging can serve as an important means and reference factor to assist clinical diagnosis. The intrinsic heterogeneity of different symptoms is also reflected in their imaging phenotypes (appearance and shape). Medical image analysis has also become a very challenging task.
[0003] Among the existing image analysis technologies, there is an image analysis method based on SE-Net (Squeeze and Excitation Network), which has achieved good results on the natural image database ImageNet. However, compared with natural images, most medical images are grayscale images, so there are problems such as less effective information, small brightness differences between different organs, blurred boundaries between different regions, and large differences in the size and shape of lesion areas / ROIs between different patients. As a result, the image analysis method based on SE-Net cannot effectively perform adaptive weighting on different channels to amplify important channel features and reduce noise channel features to improve classification accuracy.
[0004] In view of this, there is an urgent need to develop a new image processing method in this field.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The embodiments of the present invention provide an image classification method, an image classification device, an image classification model training method, an image classification model training device and an electronic device, which can perform different processing on different segmented areas in medical images, at least to a certain extent, thereby improving the accuracy of image classification results.
[0007] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.
[0008] According to one aspect of an embodiment of the present invention, there is provided an image classification method, comprising: obtaining an image to be processed and an annotated area in the image to be processed, and extracting a target image corresponding to the annotated area and a background image corresponding to an area outside the annotated area; obtaining first weight information of the target image and the background image respectively according to first feature information of the target image and the background image; inputting the first feature information into a first machine learning model to obtain second feature information of the image to be processed; and inputting the first weight information into the first machine learning model to obtain converted second weight information; and obtaining a classification result of the image to be processed according to the second feature information and the second weight information.
[0009] According to one aspect of an embodiment of the present invention, there is provided an image classification model training method, comprising: obtaining a sample image and an annotated area in the sample image, and extracting a target image corresponding to the annotated area and a background image corresponding to an area outside the annotated area; obtaining first weight information of the target image and the background image respectively according to first feature information of the target image and the background image; inputting the first feature information into a first machine learning model to obtain second feature information of the sample image; and, inputting the first weight information into the first machine learning model to obtain converted second weight information; obtaining a classification result of the sample image according to the second feature information and the second weight information; comparing the classification result with a true classification result corresponding to the sample image, and adjusting parameters of the first machine learning model according to the comparison result.
[0010] According to one aspect of an embodiment of the present invention, there is provided an image classification device, comprising: an image segmentation module, used to obtain an image to be processed and an annotated area in the image to be processed, and extract a target image corresponding to the annotated area and a background image corresponding to an area outside the annotated area; a first data acquisition module, used to obtain first weight information of the target image and the background image respectively according to first feature information of the target image and the background image; a second data acquisition module, used to input the first feature information into a first machine learning model to obtain second feature information of the image to be processed; and input the first weight information into the first machine learning model to obtain converted second weight information; and a classification result generation module, used to obtain a classification result of the image to be processed according to the second feature information and the second weight information.
[0011] In some embodiments of the present invention, based on the above-mentioned solution, the image segmentation module is: performing image segmentation on the image to be processed according to the marked area to obtain the target area and the background area.
[0012] In some embodiments of the present invention, based on the aforementioned scheme, the first data acquisition module also includes: a first feature information acquisition unit, used to use a residual network layer to perform feature extraction on the target image and the background image to obtain first feature information corresponding to the target image and the background image; a first weight information acquisition unit, used to use a global pooling layer to respectively perform pooling processing on the first feature information corresponding to the target image and the background image to obtain first weight information corresponding to the target image and the background image.
[0013] In some embodiments of the present invention, the first weight information acquisition unit is: based on the first feature information of the target image and the background image and the feature information of each channel of the image to be processed, respectively calculate the average value of the feature matrix corresponding to the target image and the background image, and use the average value as the first weight information of the target image and the background image.
[0014] In some embodiments of the present invention, based on the aforementioned scheme, the second data acquisition module includes: a second weight information acquisition unit, which is used to use the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, nonlinear activation, full connection and classification processing on the first weight information in sequence to obtain the converted second weight information.
[0015] In some embodiments of the present invention, based on the aforementioned scheme, the second data acquisition module includes: a second feature information acquisition unit, which uses the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, non-linear activation, full connection and classification processing on the first feature information in sequence to obtain the second feature information.
[0016] In some embodiments of the present invention, based on the aforementioned scheme, the classification result generation module includes: a second weight information processing unit, used to obtain the intermediate feature information corresponding to the image to be processed based on the second feature information and the second weight information; a classification result acquisition unit, used to obtain the classification result of the image to be processed based on the intermediate feature information.
[0017] In some embodiments of the present invention, based on the aforementioned scheme, the second weight information processing unit is: applying the second weight information corresponding to the target image and the background image to the second feature information corresponding to the target image and the background image, respectively, to obtain the intermediate feature information corresponding to the image to be processed.
[0018] In some embodiments of the present invention, based on the above scheme, the classification result acquisition unit is: mapping the intermediate feature information into a probability vector corresponding to the classification result, and selecting the category corresponding to the maximum value of the probability vector as the classification result of the image to be processed.
[0019] In some embodiments of the present invention, based on the aforementioned scheme, the image classification device also includes: an image preprocessing module, used to perform normalization processing and image expansion processing on the image to be processed in sequence; wherein the image expansion processing includes any one or a combination of any two or more of the following: flipping, rotation, scaling and contrast enhancement.
[0020] In some embodiments of the present invention, based on the above solution, the image to be processed and the marked area in the image to be processed have the same image size.
[0021] According to one aspect of an embodiment of the present invention, there is provided an image classification model training device, comprising: a sample image acquisition module, used to acquire a sample image and an annotated area in the sample image, and extract a target image corresponding to the annotated area and a background image corresponding to an area outside the annotated area; a first data acquisition module, used to acquire first weight information of the target image and the background image, respectively, based on first feature information of the target image and the background image; a second data acquisition module, used to input the first feature information into a first machine learning model to acquire second feature information of the sample image; and, input the first weight information into the first machine learning model to acquire converted second weight information; a classification result generation module, used to acquire a classification result of the sample image based on the second feature information and the second weight information; and a parameter optimization module, used to compare the classification result with a true classification result corresponding to the sample image, and adjust the parameters of the first machine learning model according to the comparison result.
[0022] In some embodiments of the present invention, based on the above-mentioned solution, the image segmentation module is: performing image segmentation on the sample image according to the marked area to obtain the target area and the background area.
[0023] In some embodiments of the present invention, based on the aforementioned scheme, the first data acquisition module also includes: a first feature information acquisition unit, used to use a residual network layer to perform feature extraction on the target image and the background image to obtain first feature information corresponding to the target image and the background image; a first weight information acquisition unit, used to use a global pooling layer to respectively perform pooling processing on the first feature information corresponding to the target image and the background image to obtain first weight information corresponding to the target image and the background image.
[0024] In some embodiments of the present invention, the first weight information acquisition unit is: based on the first feature information of the target image and the background image and the feature information of each channel of the sample image, respectively calculate the average value of the feature matrix corresponding to the target image and the background image, and use the average value as the first weight information of the target image and the background image.
[0025] In some embodiments of the present invention, based on the aforementioned scheme, the second data acquisition module includes: a second weight information acquisition unit, which is used to use the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, nonlinear activation, full connection and classification processing on the first weight information in sequence to obtain the converted second weight information.
[0026] In some embodiments of the present invention, based on the aforementioned scheme, the second data acquisition module includes: a second feature information acquisition unit, which uses the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, non-linear activation, full connection and classification processing on the first feature information in sequence to obtain the second feature information.
[0027] In some embodiments of the present invention, based on the aforementioned scheme, the classification result generation module includes: a second weight information processing unit, used to obtain the intermediate feature information corresponding to the sample image based on the second feature information and the second weight information; a classification result acquisition unit, used to obtain the classification result of the sample image based on the intermediate feature information.
[0028] In some embodiments of the present invention, based on the aforementioned scheme, the second weight information processing unit is: applying the second weight information corresponding to the target image and the background image to the second feature information corresponding to the target image and the background image, respectively, to obtain the intermediate feature information corresponding to the sample image.
[0029] In some embodiments of the present invention, based on the above scheme, the classification result acquisition unit maps the intermediate feature information into a probability vector corresponding to the classification result, and selects the category corresponding to the maximum value of the probability vector as the classification result of the sample image.
[0030] In some embodiments of the present invention, based on the aforementioned scheme, the image classification device also includes: an image preprocessing module, used to perform normalization processing and image expansion processing on the sample image in sequence; wherein the image expansion processing includes any one or any combination of the following: flipping, rotation, scaling and contrast enhancement.
[0031] In some embodiments of the present invention, based on the above solution, the sample image and the marked area in the sample image have the same image size.
[0032] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the image classification method as described in the above embodiments.
[0033] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the image classification model training method as described in the above embodiments.
[0034] In the technical solutions provided by some embodiments of the present invention, after obtaining the image to be processed, the target image and the background image in the image to be processed are first extracted according to the annotated area corresponding to the image to be processed, and then the feature information and weight information of the target image and the background image are respectively obtained, and the weight information is applied to different images, thereby obtaining the classification result of the image to be processed. On the one hand, the technical solution of the present invention can effectively utilize the annotated area of the image to be processed, and then classify the image to be processed according to the annotated area; on the other hand, different adaptive weights can be applied to the target image content in the image to be processed and the background image content outside the target image, respectively, and the relationship between different areas in the image to be processed can be accurately processed, thereby avoiding the loss of important features in the target image or mixing other interfering features in the target image, and further improving the accuracy of the classification result of the image to be processed.
[0035] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings herein are incorporated into and constitute a part of the specification, showing embodiments consistent with the present invention, and together with the specification, are used to explain the principles of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0037] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of an embodiment of the present invention can be applied;
[0038] Figure 2A schematic diagram of a process flow of an image classification method according to an embodiment of the present invention is shown;
[0039] Figure 3 A schematic diagram of a process for obtaining first feature information and first weight information according to an embodiment of the present invention is shown;
[0040] Figure 4 The following schematically shows a schematic diagram of the model framework structure of the ROI-SE block according to an embodiment of the present invention;
[0041] Figure 5 A schematic diagram of a process of calculating a classification result of an image to be processed according to an embodiment of the present invention is shown;
[0042] Figure 6 A schematic diagram of a process flow of an image classification model training method according to an embodiment of the present invention is shown;
[0043] Figure 7 A schematic diagram of a classification model structure based on a ResNet structure according to an embodiment of the present invention is shown;
[0044] Figure 8 A schematic diagram schematically shows an original medical image according to an embodiment of the present invention;
[0045] Fig. 9 Schematically shows an embodiment of the present invention Figure 8 A schematic diagram of a ROI image corresponding to the original medical image shown;
[0046] Fig.10 Schematically shows an embodiment of the present invention Figure 8 A schematic diagram of an image segmentation result image corresponding to the original medical image shown;
[0047] Fig.11 A block diagram schematically shows an image classification device according to an embodiment of the present invention;
[0048] Fig.12 A block diagram of an image classification model training device according to an embodiment of the present invention is schematically shown;
[0049] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0050] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present invention will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0051] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solution of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.
[0052] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0053] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0054] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of an embodiment of the present invention can be applied.
[0055] like Figure 1 As shown, the system architecture 100 may include a terminal device (such as Figure 1 The embodiment of the present invention is a schematic diagram of a mobile phone 101, a tablet computer 102, a portable computer 103, a desktop computer, etc., a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc.
[0056] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0057] In one embodiment of the present invention, a user can use terminal device 101 (or terminal device 102 or 103) to obtain an image to be processed and an annotated area in the image to be processed, and then send the image to be processed and the annotated area to server 105; after receiving the image to be processed and the annotated area image sent by terminal device 101, server 105 can extract the target image and background image in the image to be processed according to the annotated area corresponding to the image to be processed, and then respectively obtain the feature information and weight information of the target image and the background image, and apply the weight information to different images, thereby obtaining the classification result of the image to be processed. The technical solution of the embodiment of the present invention can, on the one hand, effectively utilize the annotated area of the image to be processed, and then classify the image to be processed according to the annotated area; on the other hand, different adaptive weights can be applied to the target image content in the image to be processed and the background image content outside the target image, respectively, and the relationship between different areas in the image to be processed can be accurately processed, thereby avoiding the loss of important features in the target image or mixing other interference features in the target image, and further improving the accuracy of the classification result of the image to be processed.
[0058] It should be noted that the image classification method provided in the embodiment of the present invention is generally executed by the server 105, and accordingly, the image classification device is generally set in the server 105. However, in other embodiments of the present invention, the terminal device may also have similar functions as the server, so as to execute the image classification scheme provided in the embodiment of the present invention.
[0059] In recent years, artificial intelligence technology has developed rapidly. Using artificial intelligence technology to recognize medical images, detect and identify lesion areas in medical images, and assist doctors in making clinical diagnoses has become one of the most challenging tasks in medical image analysis.
[0060] In the related technologies in this field, the image analysis method based on the SE-Net (Squeeze and Excitation Network) model can calculate the weighting of each channel through a series of pooling and activation functions, find the optimal weight through loss function and back propagation, give higher weights to some more meaningful feature channels, and reduce the weights of noise channels, so as to better integrate information to achieve the best classification results. In addition, the SE-Net model has achieved good results in the classification application of the natural image database ImageNet.
[0061] However, the relevant technology has corresponding defects, which are mainly reflected in the following two aspects: (1) Compared with natural images, most medical images are grayscale images, so there are problems such as less effective information, small brightness difference between different organs, blurred boundaries between different regions, and large differences in the size and shape of lesion areas / ROI (Region of Interest) between different patients. The structure of the SE-Net model cannot solve this problem because the average pooling operation in the SE-Net model will neutralize the information of the lesion area and the non-lesion area, or because the brightness of the lesion area is similar to that of another tissue in the image, resulting in similar weights after average pooling; (2) Medical images often have segmentation areas selected by doctors for lesion tissues, or some segmentation algorithms can segment our lesions / ROIs in advance, but the SE-Net model cannot use the above information, thereby losing information that can improve classification accuracy.
[0062] In view of the problems existing in the related art, the embodiment of the present invention first proposes an image classification method. The following takes medical images as an example of images to be processed to elaborate on the implementation details of the technical solution of the embodiment of the present invention:
[0063] Figure 2 A flowchart of an image classification method according to an embodiment of the present invention is schematically shown. The image classification method can be executed by a server or a terminal device. The server or the terminal device can be Figure 1 The server or terminal device shown in . Figure 2 As shown, the image classification method at least includes steps S210 to S240, which are described in detail as follows:
[0064] In step S210, the image to be processed and the marked area in the image to be processed are obtained, and the target image corresponding to the marked area and the background image corresponding to the area outside the marked area are extracted.
[0065] In one embodiment of the present invention, the image to be processed and the corresponding annotated area can be obtained by the terminal device 101 (or the terminal device 102 or 103), wherein the annotated area can also be expressed in the form of an image. The above-mentioned image to be processed can be a two-dimensional or three-dimensional medical image, such as Figure 8 As shown, Figure 8 The schematic diagram shows an original medical image in the MRI format of a brain region. The annotated region in the image to be processed may be a ROI (Region of Interest) in the image to be processed, such as an image of a lesion region in a medical image; Fig. 9 As shown, Fig. 9Schematically shows Figure 8 ROI image in the original medical image shown. After obtaining the image to be processed and the annotated area in the image to be processed, the image to be processed can be segmented according to the annotated area, so as to obtain the target area corresponding to the lesion area in the medical image and the background area outside the lesion area in the medical image. In addition, the image to be processed and the annotated area image can have the same image size.
[0066] Specifically, the above-mentioned image to be processed can be a two-dimensional plane image or a three-dimensional image; for example: CT (Computed Tomography), MRI (Magnetic Resonance Imaging), ultrasound, X-ray, electrocardiogram, electroencephalogram, optical photography, etc., images generated by medical instruments. The annotated area in the image to be processed can be the ROI (Region of Interest) in the image to be processed. For medical images, the ROI image can be an image of a lesion or a lesion area.
[0067] Specifically, the annotated area in the image to be processed can be obtained by manual selection, for example, a doctor may outline or select the lesion area in the medical image as the annotated area; or a small amount of segmentation annotation (One-shot or Few-shot algorithm) may be used to train the segmentation algorithm to segment the image to be processed, thereby obtaining the annotated area; or, the lesion area in the image to be processed may be segmented out using an unsupervised algorithm based on the gray value characteristics of the lesion area, thereby obtaining the annotated area. The embodiment of the present invention does not limit the specific method for obtaining the annotated area of the image to be processed. At this time, the annotated area (ROI image) may be a hyperparameter image.
[0068] In one embodiment of the present invention, after obtaining an image to be processed, such as an original medical image, the image to be processed may be subjected to normalization processing and image expansion processing in sequence; wherein the image expansion processing includes any one or a combination of any number of the following: flipping, rotating, scaling, and contrast enhancement. Generally speaking, since the lesion area in a medical image does not have a fixed shape, size, and direction, by performing data augmentation operations such as flipping, rotating, scaling, and contrast enhancement on the original image, the number of samples can be increased, and the directionality and information value at different scales can be increased.
[0069] By using the annotated area to segment the image to be processed, the target image and the background image are obtained, thereby effectively using the segmentation information to classify the image to be processed. Fig.10 As shown, Fig.10 Schematically shows Figure 8The image segmentation results for the lesion area and non-lesion area in the original medical image shown.
[0070] In step S220, first weight information of the target image and the background image is respectively obtained according to the first feature information of the target image and the background image.
[0071] In one embodiment of the present invention, Figure 3 A schematic diagram of the process of obtaining the first feature information and the first weight information is shown in FIG. Figure 3 As shown: in step S2201, the residual network layer is used to extract features of the target image and the background image to obtain first feature information corresponding to the target image and the background image; in step 2202, the global pooling layer is used to perform pooling processing on the first feature information corresponding to the target image and the background image respectively to obtain first weight information corresponding to the target image and the background image.
[0072] In one embodiment of the present invention, the basic module of the network model is improved on the basis of SE-block. Figure 4 The schematic diagram of the improved ROI-SE block model framework of the present method is shown. The above ROI-SE block model may include a residual network layer 401.
[0073] Specifically, the residual network layer 401 may include a plurality of residual modules, each of which includes a convolution layer, a normalization layer, a ReLU activation layer, a convolution layer, and a normalization layer arranged in sequence; each residual module may be used to perform convolution, normalization, activation, convolution, and normalization processing on the target image and the background image in sequence, thereby outputting the first feature information corresponding to the target image and the first feature information corresponding to the background image. Then, the global pooling layer is used to perform pooling processing on the first feature information of the target image and the first feature information of the background image, respectively, thereby obtaining the first weight information corresponding to the target image and the background image.
[0074] Specifically, the pooling layer of the ROI-SE block model can be a global pooling layer, which is used to pool each channel of the image to 1*1, that is, to calculate the average value of each channel. For the multiple residual modules contained in the above-mentioned residual network layer, a global pooling layer can be connected respectively, that is, the first feature information output by each residual module is input into a corresponding global pooling layer for pooling processing.
[0075] For the target image and the background image, the global pooling layer can be used to calculate the average values of the target image and the background image as the first weight information. Specifically, the average values of the feature matrices corresponding to each channel of the target image and the background image can be calculated according to the first feature information of the target image and the background image and the feature information of each channel of the image to be processed, and the average values are used as the first weight information of the target image and the background image. Specifically, the corresponding expressions may include:
[0076]
[0077]
[0078] Among them, I x is the xth channel of the image to be processed; mask is the target image; (1-mask) is the background image. In the above formula, * is the elementwise product of two matrices; sum is the sum of all elements of the matrix. k1 is the target image, and k2 is the background image.
[0079] For example, the mask image can be an image with a target area of 1 and a background area of 0 in the image to be processed. The size of the target image is H*W*C, then the target image has C channels (then x∈1,2,…,C), each channel size is H*W, and the mask (target image) is the same for all channels of each layer, and the size is also H*W. 1-mask calculates the matrix obtained by subtracting the value of each cell of the mask from the all-one matrix of the same size as the mask, that is, the matrix corresponding to the background image. In the global pooling layer, we use the mask to calculate the values k1 and k2 corresponding to the two first weight information, that is, the weight values corresponding to each channel of the target image, and the weight values corresponding to each channel of the background image; therefore, the C channels of the image to be processed will obtain 2C values, and their arrangement order can be [k 11 ,k 21 ,k 12 ,k 22 ,…,k 1C ,k 2C ].
[0080] In addition, the above-mentioned step of using the annotated area to segment the image to be processed to obtain the target image and the background image can also be implemented through the residual network layer, that is, the image to be processed and the annotated area are input into the residual network layer, the corresponding target image and background image are obtained through the residual network layer, and the first feature information corresponding to the target image and the background image is calculated.
[0081] In step S230, the first feature information is input into the first machine learning model to obtain the second feature information of the image to be processed; and the first weight information is input into the first machine learning model to obtain the converted second weight information.
[0082] In one embodiment of the present invention, Figure 4 As shown, a machine learning model can be connected after the pooling layer. The above-mentioned machine learning model may include a first fully connected layer 404, a ReLU activation layer 405, a second fully connected layer 406 and a Sigmoid classification layer 407 which are arranged in sequence. After obtaining the first weight information, the first weight information of the target image and the first weight information of the background image can be simultaneously input into the first fully connected layer 404, and after full connection, nonlinear activation, full connection and classification processing through the first fully connected layer 404, the ReLU activation layer 405, the second fully connected layer 406 and the Sigmoid classification layer 407, the second weight information of the target image and the second weight information of the background image are obtained. Corresponding to the 2C first weight values of the target image and the background image, the values of the 2C second weight information after the transformation are obtained: [k 11 ', k 21 ', k 12 ', k 22 ', ..., k 1C ', k 2C ']. Similarly, for the first feature information corresponding to the target image and the background image, the first machine learning model is used to perform full connection, nonlinear activation, full connection and classification processing in sequence to obtain the second feature information corresponding to the target image and the second feature information corresponding to the background image.
[0083] By using the ROI-SE block model to process the target image and the background image separately, for each channel of the target image and the background image, it is possible to accurately use the target image to calculate the adaptive attention weights for the image content inside the mask (target image) and the image content outside the mask (background image).
[0084] In step S240, a classification result of the image to be processed is obtained according to the second feature information and the second weight information.
[0085] In one embodiment of the present invention, Figure 5 The schematic diagram of the process of calculating the classification result of the image to be processed by this method is shown in FIG. Figure 5 As shown, in step S2401, the intermediate feature information corresponding to the image to be processed is obtained according to the second feature information and the second weight information; in step S2402, the classification result of the image to be processed is obtained according to the intermediate feature information.
[0086] In the weighting layer (Scale layer) 410, the second weight information corresponding to the target image and the background image can be applied to the second feature information corresponding to the target image and the background image, respectively, to obtain the intermediate feature information corresponding to the image to be processed. Specifically, the second weight information corresponding to the target image can be applied to each channel of the target image; and the second weight information corresponding to the background image can be applied to each channel of the background image. Specifically, for the values of the 2C second weight information after the above transformation, in the Scale layer, the weights are applied in different areas, and the corresponding weights are applied to different channels to obtain the intermediate feature information K after scaling. x , whose expressions can include:
[0087] K x = k′ 1x *mask+k′ 2x *(1-mask)
[0088] Among them, mask is the target image, (1-mask) is the background image, k 1x ', k 2x ' are the second weight information corresponding to the target image and the background image respectively; x∈1,2,….
[0089] For the image K corresponding to the obtained intermediate feature information x , a fully connected layer can be used to map the extracted features into a probability vector with a vector length equal to the number of categories, and then output it as the number of categories according to the argmax function.
[0090] In one embodiment of the present invention, in the above-mentioned image classification method, a one-level ROI-SE block model, or a continuous multi-level ROI-SE block model, or a discontinuous multi-level ROI-SE block model may be set. Figure 7 A schematic diagram of the classification model structure based on the ResNet structure of the present invention is shown. Figure 7 As shown in FIG, a continuous multi-level ROI-SE block model is set in the model. Figure 7As shown in the figure, its input parameters are the original image to be processed and the corresponding annotated area image. The image to be processed and the annotated area have the same image size. Both the image to be processed and the annotated area are three-dimensional images with image sizes of 100*100*100 and 1 channel. The model first uses a feature extraction unit to perform convolution, normalization and activation on the image to be processed in sequence to obtain the feature image corresponding to the image to be processed, with an image size of 50*50*50 and 64 channels; then the feature image is downsampled using the maximum pooling layer, and the image size becomes 25*25*25 and the number of channels is 64. At the same time, in order to keep the annotated area and the feature image with the same image size, the annotated area is downsampled twice in a row.
[0091] Then, the feature image and the downsampled annotated region are input into the first-level ROI-SE Block model, and the intermediate feature image output by the first-level ROI-SE Block model is used as the input parameter of the second-level ROI-SE Block model. At the same time, the annotated region is downsampled again and used as the input parameter of the second ROI-SE Block model. The intermediate feature image output by the second-level ROI-SE Block model is downsampled to obtain an intermediate feature image with an image size of 13*13*13 and 128 channels, which is used as the input parameter of the third-level ROI-SE Block model. At the same time, the annotated region image is downsampled again to obtain a sampling result with an image size of 13*13*13 and used as the input parameter of the third-level ROI-SE Block model. After being processed by a continuous eight-level ROI-SE Block model, the intermediate feature image output by the eighth-level ROI-SE Block model is average pooled and fully connected. In the fully connected layer, a total of 512 extracted features are mapped into a probability vector with a vector length equal to the number of categories, and then output as the number of categories according to the argmax function as the final classification result.
[0092] In one embodiment of the present invention, for Figure 7 The network structure shown may also include only two-level ROI-SE Block models, or four-level ROI-SE Block models, as well as other numbers of ROI-SE Block models.
[0093] In one embodiment of the present invention, for Figure 4 , Figure 7The ROI-SE Block model shown in the figure can also be nested on different classic networks, including but not limited to the ResNet (Residual Neural Network) model series, the Inception network model series, the VGG (Visual Geometry Group Network) model series, etc.
[0094] In one embodiment of the present invention, when the above-mentioned image classification method is executed on the server 105, the user can input the medical image to be classified and the segmentation information corresponding to the medical image on the terminal device 103 (or the terminal device 102 or the terminal device 101), and the terminal device 103 can generate an image processing request according to the medical image input by the user and the segmentation information corresponding to the medical image, and send the image processing request to the server 105. After receiving the image processing request, the server 105 can first perform normalization processing and image expansion processing on the medical image; then, the processed medical image and segmentation information are used as input parameters and input into the image classification model, and the image classification method described in the above embodiment is executed on the server 105, and finally a classification result is generated. Then, the server 105 returns the classification result to the terminal device 103 for the user's reference and use.
[0095] The image classification method in the embodiment of the present invention can be applied to the classification of medical images, natural images and other types of images. According to the image classification method in the embodiment of the present invention, when processing medical images, segmentation information can be effectively used to effectively utilize the positional relationship between the lesion area and the non-lesion area in the medical image; and different adaptive weights can be calculated according to the image content in the lesion area and the image content outside the lesion area, and then the weight values are applied to the lesion area image and the non-lesion area image respectively, which retains the connection between normal tissue and lesions, and realizes the application of different weights / attention to the lesion area and the non-lesion area, thereby realizing different processing inside and outside the ROI area, so that the network model can pay more attention to the information of the lesion area, thereby effectively improving the accuracy of the classification results.
[0096] In addition, for the ROI-SE block model provided in the image classification method in the embodiment of the present invention, in actual use, according to the accuracy requirements of the image classification results, or according to the type of image to be classified, a first-level ROI-SE block model, or a continuous multi-level ROI-SE block model can be selected to be set, or it can be nested in the structure of other network models, thereby maximizing the accuracy of the medical image classification results.
[0097] Figure 6 A flowchart of an image classification model training method according to an embodiment of the present invention is schematically shown. The image classification model training method can be executed by a server or a terminal device, and the server or the terminal device can be Figure 1 The server or terminal device shown in . Figure 6 As shown, the image classification model training method includes at least steps S610 to S650, which are described in detail as follows:
[0098] In step S610, a sample image and an annotated area in the sample image are obtained, and a target image corresponding to the annotated area and a background image corresponding to the area outside the annotated area are extracted; in step S620, first weight information of the target image and the background image are respectively obtained based on first feature information of the target image and the background image; in step S630, the first feature information is input into a first machine learning model to obtain second feature information of the sample image; and, the first weight information is input into the first machine learning model to obtain converted second weight information; in step S640, a classification result of the sample image is obtained based on the second feature information and the second weight information; in step S650, the classification result is compared with a true classification result corresponding to the sample image, and the parameters of the first machine learning model are adjusted based on the comparison result.
[0099] In one embodiment of the present invention, when training an image classification model, in order to improve the wide effectiveness of the model, different types of images can be selected as training samples. Specifically, in this solution, original images such as a CT plain scan brain hemorrhage cause judgment dataset, a BraTS18 competition MR dataset including 4 modalities, and a cervical color image staging dataset with three channels are selected as training samples.
[0100] For the above original image, it can be normalized to 0-1 first. Secondly, for the above training samples, since the lesion area in the image has no fixed shape, size and directionality, the above original image can also be flipped, rotated, scaled, contrast enhanced and other data augmentation operations to increase the number of training samples and increase the information value under different directions and sizes.
[0101] In one embodiment of the present invention, for a sample image, the sample image can be segmented according to its corresponding annotated area to obtain a corresponding target image including the lesion area and a background image outside the lesion area. Figure 4The model framework structure of the ROI-SE block shown can input the sample image and the corresponding annotated area into the residual network layer, obtain the target image and background image corresponding to the sample image through the residual network layer, and calculate the first feature information corresponding to the target image and the background image. Then, the first feature information corresponding to the sample image and the first feature information corresponding to the background image are input into a global pooling layer, and the first feature information corresponding to the target image and the background image are pooled by the global pooling layer, so as to obtain the first weight information corresponding to the target image and the first weight information corresponding to the background image. Specifically, the average value of the feature matrix corresponding to each channel of the target image and the background image can be calculated according to the first feature information of the target image and the background image and the feature information of each channel of the sample image, and the average value is used as the first weight information of the target image and the background image.
[0102] like Figure 4 As shown, a machine learning model can be connected after the pooling layer. After obtaining the first weight information of the target image and the background image, the first weight information of the target image and the first weight information of the background image can be simultaneously input into the first fully connected layer 404, and after full connection, nonlinear activation, full connection and classification processing through the first fully connected layer 404, the ReLU activation layer 405, the second fully connected layer 406 and the Sigmoid classification layer 407, the second weight information of the target image and the converted second weight information of the background image are obtained. Similarly, for the first feature information corresponding to the target image and the background image, the first machine learning model is used to perform full connection, nonlinear activation, full connection and classification processing in sequence, so as to obtain the second feature information corresponding to the target image and the second feature information corresponding to the background image.
[0103] like Figure 4 As shown, a weighting layer is connected after the machine learning model, and the second weight information corresponding to the target image and the background image can be applied to the second feature information corresponding to the target image and the background image respectively, so as to obtain the intermediate feature information corresponding to the image to be processed. Specifically, the second weight information corresponding to the target image can be applied to each channel of the target image; and the second weight information corresponding to the background image can be applied to each channel of the background image. For the image K corresponding to the obtained intermediate feature information x , a fully connected layer can be used to map the extracted features into a probability vector with a vector length equal to the number of categories, and then the argmax function is used to output the number of categories to obtain the classification result of the sample image.
[0104] The classification result of the sample image obtained can be compared with the real classification result corresponding to the sample image, and then the relevant parameters of the first machine learning model can be adjusted and optimized according to the comparison result.
[0105] In one embodiment of the present invention, a gradient descent algorithm based on Adam (adaptive moment estimation) can be used to update the parameters of the network. The initial learning rate can be set to 0.05, and betas in the Adam algorithm = (0.95, 0.9995). The probability value of the predicted category of the sample image is obtained through the image classification network model (the probability value is an N*1 vector, N is the number of categories), and the weighted cross entropy between the probability value and the true category label corresponding to the sample image is calculated as the loss function. By minimizing the loss function, the error gradient can be calculated and the gradient of the image classification network can be updated through back propagation. After the above network training is completed, the final predicted probability value is used to obtain the classification result.
[0106] In one embodiment of the present invention, Figure 7 The schematic diagram of the classification model structure of the present method based on the ResNet (Residual Neural Network) structure is shown. The training sample is cerebral hemorrhage data. When training the model, Figure 7 As shown in the figure, the input parameters are the original image (image) of the training sample and the corresponding annotated region (mask) image. The sample image and the annotated region have the same image size. Both the sample image and the annotated region are three-dimensional images with an image size of 100*100*100 and a channel number of 1. The model first uses a feature extraction unit to perform convolution, normalization and activation on the sample image in sequence to obtain a feature image with an image size of 50*50*50 and a channel number of 64; then the feature image is downsampled using the maximum pooling layer, and the image size becomes 25*25*25 and the channel number is 64. At the same time, in order to keep the image size and channel number of the annotated region and the feature image the same, the annotated region is downsampled twice in a row.
[0107] Then, the feature image and the annotated area are input into the first-level ROI-SE Block model, and the output parameters of the first-level ROI-SE Block model are used as the input parameters of the second-level ROI-SE Block model. At the same time, the annotated area is downsampled again and used as the input parameters of the second ROI-SE Block model. After being processed by the continuous multi-level ROI-SE Block model, the feature data output by the fourth-level ROI-SE Block model is average pooled and fully connected. In the fully connected layer, the 512 extracted features are mapped to a probability vector with a vector length equal to the number of categories, and then output as the number of categories according to the argmax function as the classification result. The classification result is then compared with the actual classification result of the input sample image, and the ROI-SE Block model and the corresponding loss function are optimized according to the classification result. Repeat the above process until the classification result output by the model for the sample image reaches the expected target.
[0108] The following describes an apparatus embodiment of the present invention, which can be used to execute the image classification method in the above-mentioned embodiment of the present invention, and the image classification model training method in the above-mentioned embodiment. For details not disclosed in the apparatus embodiment of the present invention, please refer to the above-mentioned embodiments of the image classification method and image classification model training method of the present invention.
[0109] Fig.11 The block diagram of an image classification device according to an embodiment of the present invention is schematically shown.
[0110] Reference Fig.11 As shown, an image classification device 800 according to an embodiment of the present invention includes: an image segmentation module 801 , a first data acquisition module 802 , a second data acquisition module 803 and a classification result generation module 804 .
[0111] Among them, the image segmentation module 801 is used to obtain the image to be processed and the annotated area in the image to be processed, and extract the target image corresponding to the annotated area and the background image corresponding to the area outside the annotated area; the first data acquisition module 802 is used to obtain the first weight information of the target image and the background image respectively according to the first feature information of the target image and the background image; the second data acquisition module 803 is used to input the first feature information into the first machine learning model to obtain the second feature information of the image to be processed; and input the first weight information into the first machine learning model to obtain the converted second weight information; the classification result generation module 804 is used to obtain the classification result of the image to be processed according to the second feature information and the second weight information.
[0112] In one embodiment of the present invention, the image segmentation module 801 is configured to segment the image to be processed according to the marked area to obtain the target area and the background area.
[0113] In one embodiment of the present invention, the first data acquisition module 802 also includes: a first feature information acquisition unit, used to use a residual network layer to perform feature extraction on the target image and the background image to obtain first feature information corresponding to the target image and the background image; a first weight information acquisition unit, used to use a global pooling layer to perform pooling processing on the first feature information corresponding to the target image and the background image, respectively, to obtain first weight information corresponding to the target image and the background image.
[0114] In one embodiment of the present invention, the first weight information acquisition unit is: according to the first feature information of the target image and the background image and the feature information of each channel of the image to be processed, respectively calculate the average value of the feature matrix corresponding to each channel of the target image and the background image, and use the average value as the first weight information of the target image and the background image.
[0115] In one embodiment of the present invention, the first weight information acquisition unit includes the following expression:
[0116]
[0117]
[0118] Among them, I x is the xth channel of the image to be processed; mask is the target image; (1-mask) is the background image.
[0119] In one embodiment of the present invention, the second data acquisition module 803 includes: a second weight information acquisition unit, which is used to use the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, non-linear activation, full connection and classification processing on the first weight information in sequence to obtain the converted second weight information.
[0120] In one embodiment of the present invention, the second data acquisition module 803 includes: a second feature information acquisition unit, which uses the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, non-linear activation, full connection and classification processing on the first feature information in sequence to obtain the second feature information.
[0121] In one embodiment of the present invention, the classification result generation module 804 includes: a second weight information processing unit, used to obtain the intermediate feature information corresponding to the image to be processed based on the second feature information and the second weight information; a classification result acquisition unit, used to obtain the classification result of the image to be processed based on the intermediate feature information.
[0122] In one embodiment of the present invention, the second weight information processing unit is: applying the second weight information corresponding to the target image and the background image to the second feature information corresponding to the target image and the background image respectively, so as to obtain the intermediate feature information corresponding to the image to be processed.
[0123] In one embodiment of the present invention, the classification result acquisition unit maps the intermediate feature information into a probability vector corresponding to the classification result, and selects the category corresponding to the maximum value of the probability vector as the classification result of the image to be processed.
[0124] In one embodiment of the present invention, the classification result acquisition unit includes the following expression:
[0125] K x = k′ 1x *mask+k′ 2x *(1-mask)
[0126] Among them, mask is the target image, (1-mask) is the background image, k 1x ', k 2x ' are the second weight information corresponding to the target image and the background image respectively.
[0127] In one embodiment of the present invention, the image classification device also includes: an image preprocessing module, which is used to perform normalization processing and image expansion processing on the image to be processed in sequence; wherein the image expansion processing includes any one or any combination of the following: flipping, rotation, scaling and contrast enhancement.
[0128] In one embodiment of the present invention, the image to be processed and the marked area in the image to be processed have the same image size.
[0129] Fig.12 A block diagram of an image classification model training device 900 according to an embodiment of the present invention is schematically shown.
[0130] Reference Fig.12 As shown, an image classification model training device 900 according to an embodiment of the present invention includes: a sample image acquisition module 901, a first data acquisition module 902, a second data acquisition module 903, a classification result generation module 904 and a parameter optimization module 905.
[0131] Among them, the sample image acquisition module 901 is used to acquire the sample image and the annotated area in the sample image, and extract the target image corresponding to the annotated area and the background image corresponding to the area outside the annotated area; the first data acquisition module 902 is used to acquire the first weight information of the target image and the background image respectively according to the first feature information of the target image and the background image; the second data acquisition module 903 is used to input the first feature information into the first machine learning model to acquire the second feature information of the sample image; and, input the first weight information into the first machine learning model to acquire the converted second weight information; the classification result generation module 904 is used to acquire the classification result of the sample image according to the second feature information and the second weight information; the parameter optimization module 905 is used to compare the classification result with the true classification result corresponding to the sample image, and adjust the parameters of the first machine learning model according to the comparison result.
[0132] In one embodiment of the present invention, the sample image acquisition module 901 is configured to segment the sample image according to the marked area to obtain the target area and the background area.
[0133] In one embodiment of the present invention, the first data acquisition module 902 also includes: a first feature information acquisition unit, which is used to use a residual network layer to perform feature extraction on the target image and the background image to obtain first feature information corresponding to the target image and the background image; a first weight information acquisition unit, which is used to use a global pooling layer to perform pooling processing on the first feature information corresponding to the target image and the background image, respectively, to obtain first weight information corresponding to the target image and the background image.
[0134] In one embodiment of the present invention, the first weight information acquisition unit is: based on the first feature information of the target image and the background image and the feature information of each channel of the sample image, respectively calculate the average value of the feature matrix corresponding to the target image and the background image, and use the average value as the first weight information of the target image and the background image.
[0135] In one embodiment of the present invention, the second data acquisition module 903 includes: a second weight information acquisition unit, which is used to use the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, non-linear activation, full connection and classification processing on the first weight information in sequence to obtain the converted second weight information.
[0136] In one embodiment of the present invention, the second data acquisition module 903 includes: a second feature information acquisition unit, which uses the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model to perform full connection, non-linear activation, full connection and classification processing on the first feature information in sequence to obtain the second feature information.
[0137] In one embodiment of the present invention, the classification result generation module 904 includes: a second weight information processing unit, used to obtain the intermediate feature information corresponding to the sample image based on the second feature information and the second weight information; a classification result acquisition unit, used to obtain the classification result of the sample image based on the intermediate feature information.
[0138] In one embodiment of the present invention, the second weight information processing unit applies the second weight information corresponding to the target image and the background image to the second feature information corresponding to the target image and the background image respectively to obtain the intermediate feature information corresponding to the sample image.
[0139] In one embodiment of the present invention, the classification result acquisition unit maps the intermediate feature information into a probability vector corresponding to the classification result, and selects the category corresponding to the maximum value of the probability vector as the classification result of the sample image.
[0140] In one embodiment of the present invention, the image classification device also includes: an image preprocessing module, which is used to perform normalization processing and image expansion processing on the sample image in sequence; wherein the image expansion processing includes any one or any combination of the following: flipping, rotation, scaling and contrast enhancement.
[0141] In one embodiment of the present invention, the sample image and the marked area in the sample image have the same image size.
[0142] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention is shown.
[0143] It should be noted that Fig.13 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0144] like Fig.13As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 to the random access memory (RAM) 703. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other through a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0145] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0146] In particular, according to an embodiment of the present invention, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1009, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, various functions defined in the system of the present application are executed.
[0147] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0148] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0149] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.
[0150] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0151] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0152] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0153] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art that are not disclosed in the present invention.
[0154] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. An image classification method, It is characterized in that include: Acquire an image to be processed and a marked area in the image to be processed, and extract a target image corresponding to the marked area and a background image corresponding to an area outside the marked area; Performing feature extraction on the target image and the background image using a residual network layer to obtain first feature information corresponding to the target image and the background image; Calculating the average values of the feature matrices corresponding to the target image and the background image according to the first feature information of the target image and the background image and the feature information of each channel of the image to be processed, and using the average values as the first weight information of the target image and the background image; Inputting the first feature information into a first machine learning model to obtain second feature information of the image to be processed; and inputting the first weight information into the first machine learning model to obtain converted second weight information; A classification result of the image to be processed is obtained according to the second feature information and the second weight information.
2. The image classification method according to claim 1, It is characterized in that Extracting a target image corresponding to the marked area and a background image corresponding to an area outside the marked area includes: The image to be processed is segmented according to the marked area to obtain a target image and a background image.
3. The image classification method according to claim 1, It is characterized in that Inputting the first weight information into the first machine learning model to obtain converted second weight information includes: Using the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model, the first weight information is sequentially subjected to full connection, nonlinear activation, full connection and classification processing to obtain the converted second weight information.
4. The image classification method according to claim 1 or 3, It is characterized in that Inputting the first feature information into a first machine learning model to obtain second feature information of the image to be processed includes: Using the first fully connected layer, activation layer, second fully connected layer and classification layer of the first machine learning model, the first feature information is sequentially fully connected, nonlinearly activated, fully connected and classified to obtain the second feature information.
5. The image classification method according to claim 1, It is characterized in that Acquiring a classification result of the image to be processed according to the second feature information and the second weight information includes: Acquire intermediate feature information corresponding to the image to be processed according to the second feature information and the second weight information; A classification result of the image to be processed is obtained according to the intermediate feature information.
6. The image classification method according to claim 5, It is characterized in that Acquiring intermediate feature information corresponding to the image to be processed according to the second feature information and the second weight information includes: The second weight information corresponding to the target image and the background image is applied to the second feature information corresponding to the target image and the background image respectively, so as to obtain the intermediate feature information corresponding to the image to be processed.
7. The image classification method according to claim 5, It is characterized in that Obtaining a classification result of the image to be processed according to the intermediate feature information includes: The intermediate feature information is mapped into a probability vector corresponding to a classification result, and the category corresponding to the maximum value of the probability vector is selected as the classification result of the image to be processed.
8. The image classification method according to claim 1, It is characterized in that After obtaining the image to be processed, the method further includes: Performing normalization processing and image expansion processing on the image to be processed in sequence; The image expansion processing includes any one or a combination of any two of the following: flipping, rotating, scaling, and contrast enhancement.
9. The image classification method according to claim 1 or 8, It is characterized in that The image to be processed and the marked area in the image to be processed have the same image size.
10. A method for training an image classification model. It is characterized in that include: Acquire a sample image and a marked area in the sample image, and extract a target image corresponding to the marked area and a background image corresponding to an area outside the marked area; Performing feature extraction on the target image and the background image using a residual network layer to obtain first feature information corresponding to the target image and the background image; Calculating the average values of the feature matrices corresponding to the target image and the background image according to the first feature information of the target image and the background image and the feature information of each channel of the sample image, and using the average values as the first weight information of the target image and the background image; Inputting the first feature information into a first machine learning model to obtain second feature information of the sample image; and, inputting the first weight information into the first machine learning model to obtain converted second weight information; Acquire a classification result of the sample image according to the second feature information and the second weight information; The classification result is compared with the true classification result corresponding to the sample image, and the parameters of the first machine learning model are adjusted according to the comparison result.
11. An image classification device, It is characterized in that include: An image segmentation module, used to obtain an image to be processed and a marked area in the image to be processed, and extract a target image corresponding to the marked area and a background image corresponding to an area outside the marked area; A first feature information acquisition unit, configured to perform feature extraction on the target image and the background image using a residual network layer to acquire first feature information corresponding to the target image and the background image; A first weight information acquisition unit, used to calculate the average values of the feature matrices corresponding to each channel of the target image and the background image according to the first feature information of the target image and the background image and the feature information of each channel of the image to be processed, and use the average values as the first weight information of the target image and the background image; A second data acquisition module, used for inputting the first feature information into a first machine learning model to acquire second feature information of the image to be processed; and inputting the first weight information into the first machine learning model to obtain converted second weight information; A classification result generating module is used to obtain the classification result of the image to be processed according to the second feature information and the second weight information.
12. An image classification model training device, It is characterized in that include: A sample image acquisition module, used to acquire a sample image and a marked area in the sample image, and extract a target image corresponding to the marked area and a background image corresponding to an area outside the marked area; A first feature information acquisition unit, configured to perform feature extraction on the target image and the background image using a residual network layer to acquire first feature information corresponding to the target image and the background image; A first weight information acquisition unit, configured to calculate the average values of the feature matrices corresponding to each channel of the target image and the background image according to the first feature information of the target image and the background image and the feature information of each channel of the sample image, and use the average values as the first weight information of the target image and the background image; A second data acquisition module, used for inputting the first feature information into a first machine learning model to acquire second feature information of the sample image; and, inputting the first weight information into the first machine learning model to obtain converted second weight information; A classification result generating module, used for obtaining a classification result of the sample image according to the second feature information and the second weight information; A parameter optimization module is used to compare the classification result with the true classification result corresponding to the sample image, and adjust the parameters of the first machine learning model according to the comparison result.
13. An electronic device, It is characterized in that include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the image classification method as described in any one of claims 1 to 9, or the image classification model training method as described in claim 10.
