Image classification method, device, computer equipment and storage medium

By adopting the structure of multiple parallel fully connected layers and associated loss functions in deep convolutional neural networks, training and refining feature extraction layer by layer, the problem of model non-convergence and inaccurate classification in multi-attribute picture classification is solved, and the more High accuracy and efficiency.

CN111159450BActive Publication Date: 2024-11-01刘丽
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911391376.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-30
Publication Date
2024-11-01
Estimated Expiration
2039-12-30

AI Technical Summary

Technical Problem

Existing deep convolutional neural networks are difficult to accurately identify each type of attribute in multi-attribute picture classification, resulting in insufficient convergence of the model and inaccurate classification results.

Method used

A multi-parallel fully connected layer structure based on the initial classification neural network is adopted. By training the parallel fully connected layer layer by layer, the loss function is associated, and the parameter characteristics of different attribute categories are learned in the feature extraction layer, and the classification results are gradually refined.

Benefits of technology

The accuracy of multi-attribute picture classification and the convergence speed of the model are improved, ensuring accurate identification of picture attributes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111159450B_ABST
    Figure CN111159450B_ABST
Patent Text Reader

Abstract

The present application relates to a method, apparatus, computer equipment and storage medium for image classification. The classification neural network used is trained based on an initial neural network, and the multiple parallel fully connected layers of the initial neural network can output different numbers of attribute categories. In this way, when the initial neural network is trained, the feature extraction layer of the initial neural network will learn the parameter features in the image when the fully connected layer is trained. When the different fully connected layers in the initial neural network are trained, the feature extraction layer of the initial neural network can be further promoted to learn the parameter features in the image, which is equivalent to setting multiple parallel fully connected layers on the initial neural network for multi-attribute classification problems, so that the neural network can learn the parameter features in the image more accurately. In this way, when the trained classification neural network is used to classify the attributes of the image, the classification result obtained is also more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image classification method, apparatus, computer equipment and storage medium. Background Art

[0002] As deep convolutional neural networks are increasingly used in image classification, multi-classification of images with a single attribute is increasingly unable to meet actual needs.

[0003] At present, there are many examples of multi-attribute classification, such as a movie can be classified as an action movie and a science fiction movie, a photo can be classified as a landscape photo and a plant photo, etc. Usually, in complex multi-attribute classification, due to the different boundaries between each attribute, there is a certain correlation between attributes. Therefore, when training deep convolutional neural networks, the boundaries of each attribute are not precise enough, so that the trained model is not converged enough and cannot accurately identify each attribute of the image. Summary of the invention

[0004] Based on this, it is necessary to provide a picture classification method, device, computer equipment and storage medium to address the above technical problems.

[0005] In a first aspect, an embodiment of the present application provides a method for classifying an image, the method comprising:

[0006] Get multiple multi-attribute pictures;

[0007] Input each image into a preset classification neural network to obtain multiple attribute classification results;

[0008] Among them, the classification neural network is trained based on the initial classification neural network. The initial neural network includes multiple parallel fully connected layers. The multiple parallel fully connected layers share an input layer and a feature extraction layer. The number of attribute categories output by each fully connected layer is different.

[0009] In one embodiment, the training process of the classification neural network includes:

[0010] Get multiple sample multi-attribute images;

[0011] After inputting the multi-attribute images of each sample into the input layer and the feature extraction layer, each fully connected layer is trained separately in order from small to large according to the number of attribute categories output by the fully connected layer, and the next fully connected layer is trained after the previous fully connected layer converges, until all the fully connected layers converge, and all other fully connected layers except the fully connected layer with the largest number of output attribute categories are commented out to obtain the classification neural network.

[0012] In one embodiment, if the fully connected layer of the initial neural network includes a first fully connected layer, a second fully connected layer, and a third fully connected layer; the number of attribute categories output by the first fully connected layer is less than the number of attribute categories output by the second fully connected layer and less than the number of attribute categories output by the third fully connected layer;

[0013] The training process of the above classification neural network includes:

[0014] After inputting the multi-attribute images of each sample into the input layer and the feature extraction layer, the first fully connected layer is trained. After the first fully connected layer converges, the second fully connected layer is trained. After the second fully connected layer converges, the third fully connected layer is trained. After the third fully connected layer converges, the first fully connected layer and the second fully connected layer are commented out to obtain a classification neural network.

[0015] In one embodiment, the initial classification neural network further includes a plurality of classification function layers, and the classification function layers are respectively connected to the back of the corresponding fully connected layers;

[0016] The classification function layer is used to transform the output of each fully connected layer into a value in a preset interval during the training process, and determine the classification result corresponding to each fully connected layer based on the comparison result of the value in the preset interval and the preset threshold, and then predict the accuracy of each classification result based on the standard classification result.

[0017] In one embodiment, the loss functions of the above-mentioned fully connected layers are associated with each other;

[0018] The association relationship at least includes: starting from the second fully connected layer, in the order of the number of attribute classifications of the fully connected layer from small to large, the comprehensive loss function of each fully connected layer is the weighted sum of the layer loss function of the current fully connected layer and the layer loss functions of all fully connected layers before the current fully connected layer.

[0019] In one embodiment, if the fully connected layer of the initial neural network includes a first fully connected layer, a second fully connected layer, and a third fully connected layer; the layer loss function of the first fully connected layer is a first loss function, the layer loss function of the second fully connected layer is a second loss function, and the layer loss function of the third fully connected layer is a third loss function;

[0020] Then the association relationship includes: the comprehensive loss function of the second fully connected layer is the weighted sum of the first loss function and the second loss function;

[0021] The comprehensive loss function of the third fully connected layer is the weighted sum of the first loss function, the second loss function, and the third loss function.

[0022] In one embodiment, the conditions for convergence of the above-mentioned fully connected layers include:

[0023] The accuracy of the classification function layer prediction of each fully connected layer reaches the preset accuracy range, and the value of the loss function of each fully connected layer reaches the preset range.

[0024] In a second aspect, an embodiment of the present application provides a picture classification device, the device comprising:

[0025] The acquisition module is used to obtain multiple multi-attribute images;

[0026] The classification module is used to input each image into a preset classification neural network to obtain multiple attribute classification results;

[0027] Among them, the classification neural network is trained based on the initial classification neural network. The initial neural network includes multiple parallel fully connected layers. The multiple parallel fully connected layers share an input layer and a feature extraction layer. The number of attribute categories output by each fully connected layer is different.

[0028] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any one of the methods provided in the embodiment of the first aspect are implemented.

[0029] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any one of the methods provided in the embodiment of the first aspect above are implemented.

[0030] The embodiments of the present application provide a method, apparatus, computer device and storage medium for image classification. The classification neural network used is trained based on an initial neural network, and the multiple parallel fully connected layers of the initial neural network can output different numbers of attribute categories. In this way, when training the initial neural network, the feature extraction layer of the initial neural network will learn the parameter features in the image when training the fully connected layer. When training different fully connected layers in the initial neural network, the feature extraction layer of the initial neural network can further promote learning the parameter features in the image. This is equivalent to setting multiple parallel fully connected layers on the initial neural network for multi-attribute classification problems, so that the neural network can learn the parameter features in the image more accurately. In this way, when using the trained classification neural network to classify the attributes of the image, the classification result obtained is also more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 An application environment diagram of a picture classification method provided by an embodiment;

[0032] Figure 2 A schematic diagram of a flow chart of a method for classifying pictures provided by an embodiment;

[0033] Figure 3A schematic diagram of an initial neural network structure provided for an embodiment;

[0034] Figure 4 A schematic diagram of a flow chart of a method for classifying pictures provided by an embodiment;

[0035] Figure 5 A structural block diagram of a picture classification device provided by an embodiment;

[0036] Figure 6 A structural block diagram of a picture classification device provided by an embodiment. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0038] The image classification method provided in this application can be applied to Figure 1 In the application environment shown, in the application environment, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data for image classification. The network interface of the computer device is used to communicate with other external devices through a network connection. When the computer program is executed by the processor, a method for image classification is implemented.

[0039] The embodiments of the present application provide a method, apparatus, computer device and storage medium for image classification. The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems will be described in detail below through embodiments and in combination with the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. It should be noted that the image classification method provided by the present application, Figure 2-Figure 4 The execution subject is a computer device, wherein the execution subject may also be a picture classification device, wherein the device may be implemented as part or all of the computer device through software, hardware, or a combination of software and hardware.

[0040] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.

[0041] In one embodiment, Figure 2 A method for classifying an image is provided. This embodiment relates to a specific process in which a computer device uses a preset classification neural network to classify a multi-attribute image. Figure 2 As shown, the method includes:

[0042] S101, obtaining multiple multi-attribute images.

[0043] Among them, a multi-attribute picture means that a picture has multiple attributes. For example, the attributes of the same picture belong to both landscape and plant, and the attributes of the photo can also belong to flowers. Based on multi-attribute pictures, in practical applications, it is necessary to classify the picture into multiple attributes, that is, to identify multiple attributes of the picture. It should be noted that this application is not only applicable to the classification of multiple attributes of pictures, but also to videos. For example, the attributes of a video can be both action and science fiction from different angles.

[0044] S102, input each image into a preset classification neural network to obtain multiple attribute classification results.

[0045] Among them, the classification neural network is trained based on the initial classification neural network. The initial neural network includes multiple parallel fully connected layers. The multiple parallel fully connected layers share an input layer and a feature extraction layer. The number of attribute categories output by each fully connected layer is different.

[0046] Based on the above multiple multi-attribute images, a preset classification neural network is used to classify the multiple multi-attribute images. The classification neural network is trained based on the initial neural network. The structure of the initial neural network can be referred to Figure 3 As shown, it includes multiple parallel fully connected layers, and the multiple parallel fully connected layers share an input layer and a feature extraction layer, and the number of attribute categories corresponding to the output of each of the multiple fully connected layers is different.

[0047] Specifically, see Figure 3 The initial neural network includes three parallel fully connected layers, which are named 3-class fully connected layer, 10-class fully connected layer, and 100-class fully connected layer according to the number of attribute categories of their corresponding outputs. That is, the number of attribute categories output by the 3-class fully connected layer is 3, for example, the attributes of a bunch of pictures are divided into scenery, people, and vehicles; among them, the number of attribute categories output by the 10-class fully connected layer is 10, for example, the attributes of the bunch of pictures are subdivided into 10 categories such as mountains, water, plants, single people, and multiple people; among them, the number of attribute categories output by the 100-class fully connected layer is 100, which means that the attributes of the bunch of pictures are further divided into 100 categories, which are not listed one by one here.

[0048] That is to say, in the classification method provided in this embodiment, the classification neural network used is trained based on the initial neural network, and the multiple parallel fully connected layers of the initial neural network can output different numbers of attribute categories, so that when training the initial neural network, the feature extraction layer of the initial neural network will learn the parameter features in the picture when training the fully connected layer. When training different fully connected layers in the initial neural network, it can further promote the feature extraction layer of the initial neural network to learn the parameter features in the picture, which is equivalent to, for multi-attribute classification problems, by setting multiple parallel fully connected layers on the initial neural network, the neural network can learn the parameter features in the picture more accurately, so when using the trained classification neural network to classify the attributes of the picture, the classification result obtained is also more accurate.

[0049] Based on the above embodiment, an embodiment is provided for the specific training process of the initial neural network, such as Figure 4 As shown, in one embodiment, the training process of the above classification neural network includes:

[0050] S201, obtaining multiple sample multi-attribute images.

[0051] This embodiment is a process of training a neural network, so it is necessary to first obtain training sample data. The training sample data in this embodiment can be a large number of multi-attribute pictures as sample data. There is no limitation on the sample pictures obtained, and there is no limitation on the type of pictures. In order to ensure that the trained classification neural network classifies the pictures more accurately, when obtaining training data, try to select a large number of different types of sample data to ensure the richness of the sample data, so that the neural network can learn more detailed features of the pictures.

[0052] S202, after inputting each sample multi-attribute image into the input layer and the feature extraction layer, train each fully connected layer separately in order from small to large according to the number of attribute categories output by the fully connected layer, and train the next fully connected layer after the previous fully connected layer converges, until all the fully connected layers converge, comment out all the fully connected layers except the fully connected layer with the largest number of output attribute categories, and obtain a classification neural network.

[0053] Based on the training sample data obtained above, the specific training process is as follows: after inputting each sample multi-attribute image into the input layer and the feature extraction layer, first train one of the multiple parallel fully connected layers, and when a fully connected layer converges, train the next fully connected layer. During training, train one by one in the order of the number of attribute categories output by the fully connected layer from small to large. After the previous fully connected layer converges, train the next fully connected layer until all the fully connected layers converge. Comment out all the fully connected layers except the fully connected layer with the largest number of output attribute categories. The classification neural network is trained and obtained. Figure 2Neural network for classification in .

[0054] It should be further explained here that if you need to train a classification neural network that can distinguish 100 categories of attributes, then when setting multiple fully connected layers of the initial neural network, the fully connected layer with the largest number of output attribute categories should be set to the 100-category fully connected layer. Except for the 100-category fully connected layer, the number of attribute categories output by other fully connected layers must be less than 100, and the 100-category attributes belong to the previous small category attributes. In other words, when this scheme trains the initial neural network, it uses an asymptotic training method from large categories to small categories, converting a complex small category multi-attribute classification problem into a simple large category multi-attribute classification problem, training a classification model, and then fine-tuning the multi-attribute classification model step by step on the basis of this model to obtain the final small category model.

[0055] Taking the case where the fully connected layers of the initial neural network include a first fully connected layer, a second fully connected layer, and a third fully connected layer; and the number of attribute categories output by the first fully connected layer < the number of attribute categories output by the second fully connected layer < the number of attribute categories output by the third fully connected layer as an example, an embodiment of a training process is provided. In one embodiment, the training process of the above classification neural network includes:

[0056] After inputting the multi-attribute images of each sample into the input layer and the feature extraction layer, the first fully connected layer is trained. After the first fully connected layer converges, the second fully connected layer is trained. After the second fully connected layer converges, the third fully connected layer is trained. After the third fully connected layer converges, the first fully connected layer and the second fully connected layer are commented out to obtain a classification neural network.

[0057] More specifically, referring to the above Figure 2 , Figure 2 It can be considered that a 100-category picture classification problem needs to be solved. We can classify these pictures into 10 categories based on the new boundaries, and then classify these 10 categories into 3 categories based on certain boundaries. Corresponding to this embodiment, the first fully connected layer is a 3-classification fully connected layer, the second fully connected layer is a 10-classification fully connected layer, and the third fully connected layer is a 100-classification fully connected layer.

[0058] During training, after inputting each sample multi-attribute image into the input layer and feature extraction layer, the 3-classification fully connected layer is trained. After the 3-classification fully connected layer converges, the 10-classification fully connected layer is trained. After the 10-classification fully connected layer converges, the 100-classification fully connected layer is trained. After the 100-classification fully connected layer converges, the 3-classification fully connected layer and the 10-classification fully connected layer are commented out, and a classification neural network that can classify a bunch of images into 100 attributes is obtained.

[0059] In this embodiment, the fully connected layers of different categories are connected in parallel. When training the 3-category fully connected layer, the picture is input from the input layer, passes through the feature extraction layer, and reaches the 3-category fully connected layer. At this time, the parameter feature extraction layer of the initial neural network learns the parameter features of dividing the picture into three attributes. When training the 10-category fully connected layer, the picture is still input from the input layer, passes through the feature extraction layer, but reaches the 10-category fully connected layer. At this time, the feature extraction layer is based on the trained 3-category fully connected layer, and further fine-learns the parameter features of dividing the picture into ten attributes. Similarly, when it comes to the 100-category fully connected layer, the feature extraction layer is based on the trained 10-category fully connected layer, and further fine-learns the parameter features of dividing the picture into 100 attributes. In this way, the feature extraction layer learns the picture classification features step by step, so that the feature extraction layer can recognize and classify the picture features more accurately.

[0060] In this embodiment, when training the initial neural network, an asymptotic training method with a small to large number of attribute categories is adopted, so that the feature extraction layer of the neural network learns the image parameter features in a manner from easy to difficult, and learns more accurate parameter features step by step, which not only enables the classification neural network to converge quickly, but also improves the accuracy of classification neural network recognition.

[0061] In addition, when training the initial neural network, a sigmoid activation function may be connected after the fully connected layer of the neural network, and sigmoid activation is performed for each value output by each fully connected layer. When the activated value is greater than the threshold, the input is considered to have the attribute, otherwise it does not have the attribute. Specifically, in one embodiment, the above-mentioned initial classification neural network also includes multiple classification function layers, which are respectively connected after the corresponding fully connected layers; the classification function layer is used to transform the output of each fully connected layer into a value in a preset interval during the training process, and determine the classification results corresponding to each fully connected layer based on the comparison result of the value in the preset interval and the preset threshold, and then predict the accuracy of each classification result based on the standard classification result.

[0062] In this embodiment, the classification function layer is established based on the sigmoid activation function. A classification function layer is connected after each fully connected layer. The sigmoid activation function in the classification function layer transforms the output results of each fully connected layer into an interval, for example, into the interval [0,1], and obtains a new output value after the transformation. For example, the output value obtained after the classification result output by the 3-classification fully connected layer is transformed is [0.2, 0.6, 0.9].

[0063] After the output of the fully connected layer is transformed into a value in a preset interval, the classification result corresponding to each fully connected layer is determined according to the comparison result between the value in the preset interval and the preset threshold. For example, a preset threshold can be set as 0.5, and the value of the preset interval [0.2, 0.6, 0.9] is compared with 0.5. The comparison result is that 0.2 is less than 0.5, and 0.6 and 0.9 are both greater than 0.5. Optionally, based on the comparison result, the classification result corresponding to each fully connected layer is converted. For example, the classification result greater than the preset threshold is taken as 0, and the classification result less than the preset threshold is taken as 1, then the converted classification result can be [0, 1, 1]. Further, the accuracy of the classification result is determined based on the standard classification result, wherein the standard classification result represents a preset true value, and the specific accuracy can be obtained according to the ratio of the standard classification result to the classification result, which is not limited in this embodiment. The accuracy of each classification result can be predicted by this method, so that the performance of the neural network can be evaluated more quickly and accurately during the training process.

[0064] When training a neural network, the adjustment direction of the neural network training needs to be guided by a loss function. In this embodiment, a certain rule is also set for the loss function of each connection layer. Specifically, in one embodiment, the loss functions of the above-mentioned fully connected layers are associated with each other; the associated relationship at least includes: in the order of the number of attribute classifications of the fully connected layers from small to large, starting from the second fully connected layer, the comprehensive loss function of each fully connected layer is the weighted sum of the layer loss function of the current fully connected layer and the layer loss functions of all fully connected layers before the current fully connected layer.

[0065] In this embodiment, when each fully connected layer is trained separately in sequence, an association relationship is established for the loss function of each fully connected layer, wherein the association relationship is exemplified as follows: in the order of the number of attribute classifications of the fully connected layers from small to large, starting from the second fully connected layer, the comprehensive loss function of each fully connected layer is established based on the hierarchical loss functions of all fully connected layers before the previous fully connected layer.

[0066] Taking the fully connected layers of the initial neural network including the first fully connected layer, the second fully connected layer and the third fully connected layer; the layer loss function of the first fully connected layer is the first loss function, the layer loss function of the second fully connected layer is the second loss function, and the third fully connected layer is the layer third loss function as an example, the connection relationship includes: the comprehensive loss function of the second fully connected layer is the weighted sum of the first loss function and the second loss function; the comprehensive loss function of the third fully connected layer is the weighted sum of the first loss function, the second loss function, and the third loss function.

[0067] Specifically, assume that the initial neural network corresponding to the 3-class fully connected layer is R1, the initial neural network corresponding to the 10-class fully connected layer is R2, and the initial neural network corresponding to the 100-class fully connected layer is R3; the layer loss function corresponding to the 3-class fully connected layer is L1, the layer loss function corresponding to the 10-class fully connected layer is L2, and the layer loss function corresponding to the 3-class fully connected layer is L3.

[0068] Then the comprehensive loss function corresponding to R1 is La=L1; the comprehensive loss function corresponding to R2 is Lb=a*L1+b*L2, where a and b are the weights of loss functions L1 and L2; the comprehensive loss function corresponding to R3 is Lc=c*L3+e*L2+fL1, where c, e, f are the weights of loss functions L3, L2, and L1. Optionally, Lc=c*L3+e*Lb, where c and e are the weights of loss functions L3 and Lb.

[0069] In this embodiment, an association relationship is set for the loss functions of each fully connected layer, and the loss function of the next fully connected layer is established based on the loss function of the previous fully connected layer. In this way, when observing the value of the loss function of the next fully connected layer, the loss function of the previous fully connected layer can be referred to, so that the evaluation of the loss function is more comprehensive, so that the value of the loss function of each fully connected layer can more accurately guide the training direction of the neural network.

[0070] In order to make the neural network converge more accurately, an embodiment is provided for the convergence conditions of the neural network. In one embodiment, the conditions for the convergence of the above-mentioned fully connected layers include: the accuracy of the classification function layer prediction of each fully connected layer reaches a preset accuracy range, and the value of the loss function of each fully connected layer reaches a preset range. In this embodiment, when judging the convergence of the neural network, the accuracy of the classification function layer prediction of each fully connected layer and the value of the loss function of each fully connected layer are both considered, ensuring the effect of the convergence of the neural network.

[0071] It should be understood that although Figure 2-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0072] In one embodiment, Figure 5As shown, a picture classification device is provided, the device comprises: an acquisition module 10, a classification module 11, wherein:

[0073] An acquisition module 10 is used to acquire multiple multi-attribute images;

[0074] The classification module 11 is used to input each image into a preset classification neural network to obtain multiple attribute classification results; wherein the classification neural network is trained based on the initial classification neural network, the initial neural network includes multiple parallel fully connected layers, and the multiple parallel fully connected layers share an input layer and a feature extraction layer, and each fully connected layer outputs a different number of attribute categories.

[0075] In one embodiment, Figure 6 As shown, a picture classification device is provided, and the device also includes:

[0076] The sample acquisition module 12 is used to acquire multiple sample multi-attribute images;

[0077] The training module 13 is used to input each sample multi-attribute image into the input layer and the feature extraction layer, and then train each fully connected layer in order from small to large according to the number of attribute categories output by the fully connected layer, and train the next fully connected layer after the previous fully connected layer converges, until all the fully connected layers converge, and comment out all the fully connected layers except the fully connected layer with the largest number of output attribute categories to obtain a classification neural network.

[0078] In one embodiment, if the fully connected layer of the initial neural network includes a first fully connected layer, a second fully connected layer, and a third fully connected layer; the number of attribute categories output by the first fully connected layer < the number of attribute categories output by the second fully connected layer < the number of attribute categories output by the third fully connected layer;

[0079] The above-mentioned training module 13 is used to input each sample multi-attribute image into the input layer and the feature extraction layer, train the first fully connected layer, train the second fully connected layer after the first fully connected layer converges, train the third fully connected layer after the second fully connected layer converges, and after the third fully connected layer converges, comment out the first fully connected layer and the second fully connected layer to obtain a classification neural network.

[0080] In one embodiment, the above-mentioned initial classification neural network also includes multiple classification function layers, which are respectively connected to the corresponding fully connected layers; the classification function layer is used to transform the output of each fully connected layer into a value of a preset interval during the training process, and determine the classification result corresponding to each fully connected layer based on the comparison result of the value of the preset interval and the preset threshold, and then predict the accuracy of each classification result based on the standard classification result.

[0081] In one embodiment, the loss functions of the above-mentioned fully connected layers are associated with each other; the associated relationship at least includes: in the order of the number of attribute classifications of the fully connected layers from small to large, starting from the second fully connected layer, the comprehensive loss function of each fully connected layer is the weighted sum of the layer loss function of the current fully connected layer and the layer loss functions of all fully connected layers before the current fully connected layer.

[0082] In one embodiment, if the fully connected layer of the initial neural network includes a first fully connected layer, a second fully connected layer, and a third fully connected layer; the layer loss function of the first fully connected layer is a first loss function, the layer loss function of the second fully connected layer is a second loss function, and the third fully connected layer is a layer third loss function;

[0083] The association relationship includes: the comprehensive loss function of the second fully connected layer is the weighted sum of the first loss function and the second loss function; the comprehensive loss function of the third fully connected layer is the weighted sum of the first loss function, the second loss function, and the third loss function.

[0084] In one embodiment, the conditions for convergence of the above-mentioned fully connected layers include: the accuracy of the prediction of the classification function layer of each fully connected layer reaches a preset accuracy range, and the value of the loss function of each fully connected layer reaches a preset range.

[0085] The implementation principles and technical effects of all the image classification devices provided in the above embodiments are similar to those of the above method embodiments, and will not be repeated here.

[0086] For the specific definition of the image classification device, please refer to the definition of the image classification method above, which will not be repeated here. Each module in the above-mentioned image classification device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0087] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as described above. Figure 1As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for classifying pictures is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0088] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0089] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0090] Get multiple multi-attribute pictures;

[0091] Input each image into a preset classification neural network to obtain multiple attribute classification results;

[0092] Among them, the classification neural network is trained based on the initial classification neural network. The initial neural network includes multiple parallel fully connected layers. The multiple parallel fully connected layers share an input layer and a feature extraction layer. The number of attribute categories output by each fully connected layer is different.

[0093] The above embodiment provides a computer device, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0094] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0095] Get multiple multi-attribute pictures;

[0096] Input each image into a preset classification neural network to obtain multiple attribute classification results;

[0097] Among them, the classification neural network is trained based on the initial classification neural network. The initial neural network includes multiple parallel fully connected layers. The multiple parallel fully connected layers share an input layer and a feature extraction layer. The number of attribute categories output by each fully connected layer is different.

[0098] The above embodiment provides a computer-readable storage medium, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0099] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0100] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0101] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for image classification, characterized in that: The method comprises: Get multiple multi-attribute pictures; Inputting each of the images into a preset classification neural network to obtain multiple attribute classification results; The classification neural network is trained based on an initial classification neural network, and the initial classification neural network includes a plurality of parallel fully connected layers, the plurality of parallel fully connected layers share an input layer and a feature extraction layer, and each fully connected layer outputs a different number of attribute categories; The training process of the classification neural network includes: Get multiple sample multi-attribute images; After inputting each of the sample multi-attribute images into the input layer and the feature extraction layer, each fully connected layer is trained separately in sequence according to the order of the number of attribute categories output by the fully connected layer from small to large, and the next fully connected layer is trained after the previous fully connected layer converges, until all the fully connected layers converge, and all other fully connected layers except the fully connected layer with the largest number of output attribute categories are commented out to obtain the classification neural network; The initial classification neural network also includes a plurality of classification function layers, and the classification function layers are respectively connected behind the corresponding fully connected layers; The classification function layer is used to transform the output of each of the fully connected layers into a value in a preset interval during the training process, and determine the classification result corresponding to each of the fully connected layers according to the comparison result of the value in the preset interval and the preset threshold, and then predict the accuracy of each of the classification results based on the standard classification result; There is a correlation between the loss functions of the fully connected layers, and the correlation includes at least: in the order of the number of attribute classifications of the fully connected layers from small to large, starting from the second fully connected layer, the comprehensive loss function of each fully connected layer is the weighted sum of the layer loss function of the current fully connected layer and the layer loss functions of all fully connected layers before the current fully connected layer.

2. The method according to claim 1, characterized in that If the fully connected layer of the initial classification neural network includes a first fully connected layer, a second fully connected layer and a third fully connected layer; the number of attribute categories output by the first fully connected layer is less than the number of attribute categories output by the second fully connected layer and less than the number of attribute categories output by the third fully connected layer; Then the training process of the classification neural network includes: After inputting each of the sample multi-attribute images into the input layer and the feature extraction layer, the first fully connected layer is trained, and after the first fully connected layer converges, the second fully connected layer is trained, and after the second fully connected layer converges, the third fully connected layer is trained, and after the third fully connected layer converges, the first fully connected layer and the second fully connected layer are commented out to obtain the classification neural network.

3. The method according to claim 1, characterized in that If the fully connected layer of the initial classification neural network includes a first fully connected layer, a second fully connected layer and a third fully connected layer; the layer loss function of the first fully connected layer is a first loss function, the layer loss function of the second fully connected layer is a second loss function, and the third fully connected layer is a layer third loss function; Then the association relationship includes: the comprehensive loss function of the second fully connected layer is the weighted sum of the first loss function and the second loss function; The comprehensive loss function of the third fully connected layer is a weighted sum of the first loss function, the second loss function, and the third loss function.

4. The method according to claim 1, characterized in that: The conditions for convergence of each of the fully connected layers include: The accuracy of the classification function layer prediction of each of the fully connected layers reaches a preset accuracy range, and the value of the loss function of each of the fully connected layers reaches a preset range.

5. A picture classification device, characterized in that: The device comprises: The acquisition module is used to obtain multiple multi-attribute images; A classification module, used to input each of the images into a preset classification neural network to obtain multiple attribute classification results; The classification neural network is trained based on an initial classification neural network, and the initial classification neural network includes a plurality of parallel fully connected layers, the plurality of parallel fully connected layers share an input layer and a feature extraction layer, and each fully connected layer outputs a different number of attribute categories; The device comprises: The sample acquisition module is used to obtain multiple sample multi-attribute images; The training module is used to input each sample multi-attribute image into the input layer and the feature extraction layer, and then train each fully connected layer in order from small to large according to the number of attribute categories output by the fully connected layer, and train the next fully connected layer after the previous fully connected layer converges, until all fully connected layers converge, and comment out all fully connected layers except the fully connected layer with the largest number of output attribute categories, to obtain a classification neural network; The initial classification neural network also includes a plurality of classification function layers, and the classification function layers are respectively connected behind the corresponding fully connected layers; The classification function layer is used to transform the output of each of the fully connected layers into a value in a preset interval during the training process, and determine the classification result corresponding to each of the fully connected layers according to the comparison result of the value in the preset interval and the preset threshold, and then predict the accuracy of each of the classification results based on the standard classification result; There is a correlation between the loss functions of the fully connected layers, and the correlation includes at least: in the order of the number of attribute classifications of the fully connected layers from small to large, starting from the second fully connected layer, the comprehensive loss function of each fully connected layer is the weighted sum of the layer loss function of the current fully connected layer and the layer loss functions of all fully connected layers before the current fully connected layer.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.