Neural network training method and device for image gender classification

By introducing contour information into image gender classification and using a dual-path network model to extract and fuse features, the problems of high cost and low efficiency in the existing technology are solved, and more efficient gender classification model training and lower cost are achieved.

CN113298156BActive Publication Date: 2024-09-06GUANGZHOU YOUMI INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110589208.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-28
Publication Date
2024-09-06
Estimated Expiration
2041-05-28

AI Technical Summary

Technical Problem

Existing image gender classification technology is costly and time-consuming, and multi-task parallel training slows down the convergence speed of the model, making it difficult to apply to a single gender classification task.

Method used

By introducing the contour information of images into the gender classification network training, a dual-path network model is used to extract contour features and gender features at the same time, and the two are integrated for training, which reduces model complexity, improves convergence speed, and reduces manpower and material costs.

Benefits of technology

The accuracy of the image gender classification model is improved, the model complexity and training cost are reduced, and the training speed is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113298156B
    Figure CN113298156B
Patent Text Reader

Abstract

This invention discloses a neural network training method and apparatus for image gender classification. The method includes: inputting a training image set into a feature extraction network model for feature extraction to obtain image contour feature information; inputting the training image set into a first gender classification network model to obtain image gender feature information; fusing the image contour feature information and the image gender feature information to obtain image fusion feature information; inputting the image fusion feature information into a second gender classification network model for training until convergence to obtain a target neural network model; the target neural network model is used to classify the gender of the input image. It is evident that this invention can improve the gender classification accuracy of the subsequently trained network model. Furthermore, compared to existing gender classification network model training methods, the model complexity of this invention is significantly reduced, the convergence speed is faster, and the human and material costs are lower.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of neural network technology, and in particular to a neural network training method and device for image gender classification. Background Art

[0002] In the existing business model, images are often more attractive than text, and their display and promotion effects are more significant. Therefore, images begin to assume more functions of product or service promotion. In this case, how to correctly classify the gender of images is of great significance. Existing image gender classification algorithms use multi-label image datasets for network training. Such algorithms are expensive and not suitable for single gender classification tasks. Other algorithms also introduce other computer vision tasks such as image segmentation, human detection or target key point detection. Such algorithms also require a large amount of time and manpower costs. At the same time, parallel training of multiple tasks also slows down the convergence of the model.

[0003] It can be seen that the existing image gender classification technology has defects that need to be solved urgently. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method and device for determining neural network training for image gender classification, which can introduce the contour information of the image into the gender classification network training of the image, thereby improving the gender classification accuracy of the network model obtained by subsequent training. At the same time, compared with the existing gender classification network model training method, the model complexity in the present invention is greatly reduced, the convergence speed is faster, and the manpower and material costs are lower.

[0005] In order to solve the above technical problems, the first aspect of the present invention discloses a neural network training method for image gender classification, the method comprising:

[0006] Input the training image set into the feature extraction network model for feature extraction to obtain image contour feature information;

[0007] Inputting the training image set into a first gender classification network model to obtain image gender feature information;

[0008] Fusing the image contour feature information with the image gender feature information to obtain image fusion feature information;

[0009] The image fusion feature information is input into a second gender classification network model for training until convergence to obtain a target neural network model; the target neural network model is used to classify the gender of the input image.

[0010] As an optional implementation, in the first aspect of the present invention, the image contour feature information is multi-channel and multi-level image contour feature information; the feature extraction network model includes a plurality of feature extraction layers for respectively extracting contour features of different levels and a corresponding plurality of size unification layers for unifying the size; the step of inputting the training image set into the feature extraction network model for feature extraction to obtain the image contour feature information includes:

[0011] Inputting a training image set into a plurality of the feature extraction layers to output a plurality of image contour features of different sizes;

[0012] Inputting the image contour features output by each of the feature extraction layers into the corresponding size unification layer to obtain a plurality of image contour features of the same size;

[0013] The multiple image contour features of the same size are determined as image contour feature information.

[0014] As an optional implementation, the multiple feature extraction layers are a plurality of convolutional layers cascaded in sequence, wherein the output of each convolutional layer is connected to a size unification layer.

[0015] As an optional implementation, in the first aspect of the present invention, the step of inputting the image fusion feature information into a second gender classification network model for training until convergence to obtain a target neural network model comprises:

[0016] Inputting the image fusion feature information into a second gender classification network model for training;

[0017] Based on back propagation, the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated until the first loss function converges to obtain the target neural network model.

[0018] As an optional implementation, in the first aspect of the present invention, the first loss function is the softmax loss of the gender prediction information output by the second gender classification network model and the true gender label of the corresponding training image.

[0019] As an optional embodiment, in the first aspect of the present invention, the method further comprises:

[0020] The training image set is processed using a data enhancement algorithm to obtain a training image set including more training images.

[0021] As an optional embodiment, in the first aspect of the present invention, the method further comprises:

[0022] The contour training image set is input into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges to obtain the feature extraction network model; wherein the feature extraction network training model includes the feature extraction network model and a single-channel feature convolution layer connected to the output of the feature extraction network model.

[0023] A second aspect of the present invention discloses a neural network training device for image gender classification, the device comprising:

[0024] The contour extraction module is used to input the training image set into the feature extraction network model for feature extraction to obtain image contour feature information;

[0025] A gender extraction module, used for inputting the training image set into a first gender classification network model to obtain image gender feature information;

[0026] A fusion module, used for fusing the image contour feature information with the image gender feature information to obtain image fusion feature information;

[0027] A training module is used to input the image fusion feature information into a second gender classification network model for training until convergence to obtain a target neural network model; the target neural network model is used to classify the gender of the input image.

[0028] As an optional implementation, in the second aspect of the present invention, the image contour feature information is multi-channel and multi-level image contour feature information; the feature extraction network model includes a plurality of feature extraction layers for respectively extracting contour features of different levels and a corresponding plurality of size unification layers for unifying the size; the contour extraction module includes:

[0029] A feature extraction unit, used for inputting a training image set into a plurality of said feature extraction layers to output a plurality of image contour features of different sizes;

[0030] A size unification unit, used for inputting the image contour features output by each of the feature extraction layers into the corresponding size unification layer to obtain a plurality of image contour features of the same size;

[0031] The fusion unit is used to determine the multiple image contour features of the same size as image contour feature information.

[0032] As an optional implementation, the multiple feature extraction layers are a plurality of convolutional layers cascaded in sequence, wherein the output of each convolutional layer is connected to a size unification layer.

[0033] As an optional implementation, in the second aspect of the present invention, the training module inputs the image fusion feature information into the second gender classification network model for training until convergence, and a specific method of obtaining the target neural network model includes:

[0034] Inputting the image fusion feature information into a second gender classification network model for training;

[0035] Based on back propagation, the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated until the first loss function converges to obtain the target neural network model.

[0036] As an optional implementation, in the second aspect of the present invention, the first loss function is the softmax loss of the gender prediction information output by the second gender classification network model and the true gender label of the corresponding training image.

[0037] As an optional implementation, in the second aspect of the present invention, the device further includes:

[0038] The data enhancement module is used to process the training image set using a data enhancement algorithm to obtain a training image set including more training images.

[0039] As an optional implementation, in the second aspect of the present invention, the device further includes:

[0040] A feature extraction network training module is used to input the contour training image set into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges to obtain the feature extraction network model; wherein the feature extraction network training model includes the feature extraction network model and a single-channel feature convolution layer connected to the output of the feature extraction network model.

[0041] The third aspect of the present invention discloses another neural network training device for image gender classification, the device comprising:

[0042] A memory storing executable program code;

[0043] a processor coupled to the memory;

[0044] The processor calls the executable program code stored in the memory to execute part or all of the steps in the neural network training method for image gender classification disclosed in the first aspect of the embodiment of the present invention.

[0045] A fourth aspect of an embodiment of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute some or all of the steps in the neural network training method for image gender classification disclosed in the first aspect of the embodiment of the present invention.

[0046] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0047] In an embodiment of the present invention, a training image set is input into a feature extraction network model for feature extraction to obtain image contour feature information; the training image set is input into a first gender classification network model to obtain image gender feature information; the image contour feature information is fused with the image gender feature information to obtain image fusion feature information; the image fusion feature information is input into a second gender classification network model for training until convergence to obtain a target neural network model; the target neural network model is used to classify the gender of the input image. It can be seen that the present invention can simultaneously extract the contour feature information and gender feature information of the training image through a dual-path network model, and train the gender classification model by combining the features after the fusion of the two types of information, so that the image contour information can be introduced into the image gender classification network training, thereby improving the gender classification accuracy of the network model obtained by subsequent training. At the same time, compared with the existing gender classification network model training method, the model complexity in the present invention is greatly reduced, the convergence speed is faster, and the manpower and material costs are lower. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0049] Figure 1 It is a flowchart of a neural network training method for image gender classification disclosed in an embodiment of the present invention;

[0050] Figure 2 It is a flow chart of another neural network training method for image gender classification disclosed in an embodiment of the present invention;

[0051] Figure 3 It is a structural schematic diagram of a neural network training device for image gender classification disclosed in an embodiment of the present invention;

[0052] Figure 4 It is a structural schematic diagram of another neural network training device for image gender classification disclosed in an embodiment of the present invention;

[0053] Figure 5 It is a structural schematic diagram of another neural network training device for image gender classification disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or ends.

[0056] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0057] The present invention discloses a neural network training method and device for gender classification of images, which can simultaneously extract contour feature information and gender feature information of training images through a dual-path network model, and train the gender classification model by combining the features after the fusion of the two types of information, so that the contour information of the image can be introduced into the gender classification network training of the image, thereby improving the gender classification accuracy of the network model obtained by subsequent training. At the same time, compared with the existing gender classification network model training method, the model complexity in the present invention is greatly reduced, the convergence speed is faster, and the manpower and material costs are lower. The following are detailed descriptions.

[0058] Embodiment 1

[0059] See also Figure 1 , Figure 1: is a flowchart of a neural network training method for image gender classification disclosed in an embodiment of the present invention. Figure 1 The described method is applied to a training device for a neural network model, which may be a corresponding training terminal, training equipment or server, and the server may be a local server or a cloud server, which is not limited in the embodiments of the present invention. Figure 1 As shown, the neural network training method for image gender classification may include the following operations:

[0060] 101. Input the training image set into the feature extraction network model for feature extraction to obtain image contour feature information.

[0061] In an embodiment of the present invention, the training image set may include multiple manually annotated training images. The manual annotation referred to here is to achieve the purpose of gender classification by manually setting the gender labels of the training images. The gender labels here can be one or more of male and female, and are not limited here.

[0062] In an embodiment of the present invention, the image contour feature is used to characterize the outer edge contour information of the image, which can be a combination of one or more of the overall closed contour feature of the image, the edge contour feature of the image, and the texture feature of the image, and the present invention is not limited thereto.

[0063] 102. Input the training image set into the first gender classification network model to obtain image gender feature information.

[0064] In an embodiment of the present invention, a gender classification network model based on a first gender classification network model is used to extract high-level semantic features for representing gender information in a training image. Optionally, the first gender classification network model can be a combination of one or more convolutional neural classification networks such as EfficientNet, ShuffleNet, ResNet, MobileNet, etc. Optionally, the first gender classification network model can be a gender classification network model pre-trained using an image dataset, such as trained using an ImageNet dataset. In an optional embodiment, the first gender classification network model receives an RGB three-channel clothing image as input, and ultimately extracts high-dimensional gender classification features.

[0065] 103. Fuse the image contour feature information with the image gender feature information to obtain image fusion feature information.

[0066] In the embodiment of the present invention, the image contour feature information and the image gender feature information are fused by splicing in the dimension of each channel, and / or by performing feature fusion through a classification feature fusion layer composed of multiple convolutional layers to obtain image fusion feature information. Optionally, the classification feature fusion layer can be composed of multiple cascaded N×N convolutional layers, for example, two cascaded 3×3 convolutional layers.

[0067] 104. Input the image fusion feature information into the second gender classification network model for training until convergence to obtain the target neural network model.

[0068] In an embodiment of the present invention, the target neural network model is used to classify the gender of an input image. Optionally, the architecture of the target neural network model includes the above-mentioned feature extraction network model, a first gender classification network model, and a second gender classification network model, and its data processing flow is similar to the above-mentioned training steps. Those skilled in the art are familiar with the technical details of the training steps of the neural network model and the actual prediction steps, which are the same or similar, and will not be repeated here. Optionally, the second gender classification network model can be a fully connected layer for gender classification, or it can refer to the technical details of the first gender classification network model.

[0069] It can be seen that the method described in the embodiment of the present invention can simultaneously extract the contour feature information and gender feature information of the training image through the dual-path network model, and train the gender classification model by combining the features after the fusion of the two types of information, so that the contour information of the image can be introduced into the gender classification network training of the image, thereby improving the gender classification accuracy of the network model obtained by subsequent training. At the same time, compared with the existing gender classification network model training method, the model complexity in the present invention is greatly reduced, the convergence speed is faster, and the manpower and material costs are lower.

[0070] In an optional embodiment, the image contour feature information is multi-channel and multi-level image contour feature information, and accordingly, the feature extraction network model includes multiple feature extraction layers for respectively extracting contour features of different levels and corresponding multiple size unification layers for unifying the size.

[0071] It can be seen that by implementing this optional implementation, the feature extraction network model can be used to extract contour features of different levels of multiple channels of an image, and unify the sizes of multiple feature maps through a size unification layer to obtain multi-level image contour feature information, which can be used to more accurately characterize the contour information of the image. When this contour information is subsequently introduced into the training of the target neural network, the accuracy of the target neural network in determining the gender information of the image based on the contour of the image can be improved.

[0072] In another optional embodiment, in step 101, inputting the training image set into the feature extraction network model to extract features to obtain image contour feature information may include:

[0073] Inputting the training image set into multiple feature extraction layers to output multiple image contour features of different sizes;

[0074] Input the image contour features output by each feature extraction layer into the corresponding size unification layer to obtain multiple image contour features of the same size;

[0075] A plurality of image contour features of the same size are determined as image contour feature information.

[0076] In an embodiment of the present invention, the plurality of feature extraction layers are a plurality of convolutional layers cascaded in sequence, wherein the output of each convolutional layer is connected to a corresponding uniform-size layer. Optionally, the feature extraction layer is a convolutional layer including a residual module, wherein the residual module is used to enhance the feature extraction and back-propagation capabilities, and may be ResNet, DenseNet or SENet. Ultimately, each feature extraction layer outputs feature maps of different sizes, thereby obtaining feature maps of multiple sizes. Among them, the shallow feature map is used to capture the subtle texture features of the clothing image, and the deep feature map is used to capture the contour features. In an optional embodiment, the convolutional layer may be a cascaded 3×3 convolutional layer and a residual module.

[0077] Optionally, the size unification layer may be an interpolation module, and optionally, the interpolation module uses an interpolation algorithm to uniformly interpolate the sizes of the image contour features output by the feature extraction layer to the same size. Optionally, the interpolation algorithm may be one or more of bilinear interpolation, nearest neighbor interpolation, and deconvolution layer, which is not limited in the present invention.

[0078] It can be seen that implementing this optional implementation method can obtain multi-level image contour feature information, which can be used to more accurately characterize the contour information of the image. When this contour information is subsequently introduced into the training of the target neural network, the accuracy of the target neural network in determining the image gender information based on the image contour can be improved.

[0079] In another optional embodiment, in step 104, the image fusion feature information is input into the second gender classification network model for training until convergence to obtain a target neural network model, including:

[0080] Input the image fusion feature information into the second gender classification network model for training;

[0081] Based on back propagation, the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated until the first loss function converges to obtain the target neural network model.

[0082] In an embodiment of the present invention, preferably, the model parameters of the first gender classification network model and the second gender classification network model can be updated without updating the model parameters of the feature extraction network model. This is because the feature extraction network model in this model is trained in another way, and its function is only used for extracting image contour features. If it is trained, it will affect the representation ability of the subsequently extracted image contour features.

[0083] Optionally, the gender prediction information finally output by the second gender classification network model may be the predicted gender label and the corresponding confidence level corresponding to the training image. Optionally, the first loss function is the softmax loss between the gender prediction information output by the second gender classification network model and the true gender label of the corresponding training image, and the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated by calculating the back-propagation gradient information obtained by the loss, so that the first loss function converges.

[0084] It can be seen that by implementing this optional implementation method, based on back propagation, the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated until the first loss function converges to obtain a trained neural network model. The model parameters of the feature extraction network model do not need to be updated during training, thereby improving the convergence speed during training and reducing the workload on the one hand, and on the other hand, allowing the network model to pay more attention to the accuracy of gender classification rather than the accuracy of contour extraction, so as to achieve better gender classification prediction effects.

[0085] In yet another optional embodiment, the method further comprises the following steps:

[0086] The contour training image set is input into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges to obtain the feature extraction network model.

[0087] In an embodiment of the present invention, the feature extraction network training model includes a feature extraction network model and a single-channel feature convolution layer connected to the output of the feature extraction network model, wherein the single-channel feature convolution layer is used to process the multi-channel and multi-level image contour feature information output by the feature extraction network model into single-channel image contour feature information.

[0088] In the embodiment of the present invention, what is finally trained is a feature extraction network model, that is, a feature extraction network training model with the single-channel feature convolution layer removed. This is because what is ultimately needed in the solution of the present invention is the feature extraction network model to extract the multi-channel and multi-level contour features of the image. The single-channel feature convolution layer is only used to fuse the multi-channel and multi-level contour features during training to facilitate subsequent loss calculations, and can be discarded after the training is completed.

[0089] It can be seen that implementing this optional implementation method can input the contour training image set into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges, thereby obtaining a feature extraction network model for extracting multi-channel and multi-level contour feature information, so as to improve the efficiency and accuracy of the image recognition task when performing the image recognition task based on the contour information in the subsequent process.

[0090] In another optional embodiment, in the above step, inputting the contour training image set into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges to obtain the trained feature extraction network model, including:

[0091] Inputting the contour training image set into multiple feature extraction layers to output multiple image contour features of different sizes;

[0092] Input the image contour features output by each feature extraction layer into the corresponding size unification layer to obtain multiple image contour features of the same size;

[0093] Fusing multiple image contour features of the same size to obtain first image contour feature information;

[0094] Inputting the first image contour feature information into the single-channel feature convolution layer to obtain the single-channel image contour feature information;

[0095] Repeat the above steps to update the model parameters of the feature extraction network model based on back propagation until the first loss function converges to obtain the trained feature extraction network model.

[0096] In the embodiment of the present invention, optionally, the contour training image set includes a plurality of annotated contour training images, wherein the annotated contour training images are training images in which contours in the images are manually annotated. Optionally, the second loss function is a cross entropy loss between single-channel image contour feature information and the corresponding contour training image.

[0097] It can be seen that implementing this optional implementation method can train the feature extraction network training model until the second loss function of the feature extraction network training model converges, thereby obtaining a feature extraction network model for extracting multi-channel and multi-level contour feature information, so as to improve the efficiency and accuracy of the image recognition task when performing the image recognition task based on the contour information in the subsequent process.

[0098] Embodiment 2

[0099] See also Figure 2 , Figure 2 FIG. 1 is a flow chart of another neural network training method for image gender classification disclosed in an embodiment of the present invention. Figure 2 The described method is applied to a training device for a neural network model, which may be a corresponding training terminal, training equipment or server, and the server may be a local server or a cloud server, which is not limited in the embodiments of the present invention. Figure 2 As shown, the neural network training method for image gender classification may include the following operations:

[0100] 201. Use a data enhancement algorithm to process the training image set to obtain a training image set including more training images.

[0101] 202. Input the training image set into the feature extraction network model for feature extraction to obtain image contour feature information.

[0102] 203. Input the training image set into the first gender classification network model to obtain image gender feature information.

[0103] 204. Fuse the image contour feature information with the image gender feature information to obtain image fusion feature information.

[0104] 205. Input the image fusion feature information into the second gender classification network model for training until convergence to obtain the target neural network model.

[0105] The specific technical details and technical terminology of the above steps 202-205 can be referred to the description of steps 101-104 in the first implementation, and will not be repeated here.

[0106] In the embodiment of the present invention, the data enhancement algorithm may be an offline data enhancement algorithm or an online data enhancement algorithm, which may be a data enhancement method for transforming information such as the size, direction, color, and resolution of the training image. For example, it may be one or more of processing operations such as flipping, rotating, cropping, scaling, translating, affine transformation, adding noise, brightness enhancement, contrast enhancement, and sharpening.

[0107] It can be seen that the embodiment of the present invention can use the data enhancement algorithm to process the training image set to obtain a training image set including more training images, so that the volume of training image data is increased while reducing the workload, thereby further improving the degree of model training, which is conducive to improving the prediction accuracy of the trained model.

[0108] In another optional implementation, in step 201, the training image set is processed using a data enhancement algorithm to obtain a training image set including more training images, including:

[0109] The color information of one or more training images in the training image set is transformed to obtain a training image set including more training images.

[0110] Optionally, the method of transforming the color information may include randomly exchanging color channels and randomly changing the size of the eigenvalue of a specific channel, or a combination of the two, which is not limited by the present invention. Optionally, the degree of color information transformation here should be less than a preset threshold, for example, the number of images of the exchanged color channels should be less than the number threshold, or the difference in the size of the eigenvalue of a specific channel should be less than the difference threshold, so as to prevent affecting the color data distribution of the overall clothing image and causing a decrease in model accuracy.

[0111] It can be seen that this optional implementation can reduce the possibility that the gender classification model finally trained directly outputs gender categories based on color information, thereby improving the generalization of the model.

[0112] It should be noted that the neural network training method for image gender classification described in the above or following embodiments of the present invention can be specifically applied to the field of gender classification prediction of clothing images. This field mostly uses contour information to characterize gender. Correspondingly, the training images or contour training images in the present invention can be clothing product images. Of course, optionally, other product images or service images can also be applicable to the method described in the present invention. The present invention is not particularly limited and is only illustrative of the above-mentioned preferred situation.

[0113] Embodiment 3

[0114] See also Figure 3 , Figure 3 : is a schematic diagram of a neural network training device for image gender classification disclosed in an embodiment of the present invention. Figure 3 The described apparatus can be applied to a corresponding training terminal, training device or server, and the server can be a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 3 As shown, the device may include:

[0115] The contour extraction module 301 is used to input the training image set into the feature extraction network model to perform feature extraction to obtain image contour feature information.

[0116] In an embodiment of the present invention, the training image set may include multiple manually annotated training images. The manual annotation referred to here is to achieve the purpose of gender classification by manually setting the gender labels of the training images. The gender labels here can be one or more of male and female, and are not limited here.

[0117] In an embodiment of the present invention, the image contour feature is used to characterize the outer edge contour information of the image, which can be a combination of one or more of the overall closed contour feature of the image, the edge contour feature of the image, and the texture feature of the image, and the present invention is not limited thereto.

[0118] The gender extraction module 302 is used to input the training image set into the first gender classification network model to obtain image gender feature information.

[0119] In an embodiment of the present invention, a gender classification network model based on a first gender classification network model is used to extract high-level semantic features for representing gender information in a training image. Optionally, the first gender classification network model can be a combination of one or more convolutional neural classification networks such as EfficientNet, ShuffleNet, ResNet, MobileNet, etc. Optionally, the first gender classification network model can be a gender classification network model pre-trained using an image dataset, such as trained using an ImageNet dataset. In an optional embodiment, the first gender classification network model receives an RGB three-channel clothing image as input, and ultimately extracts high-dimensional gender classification features.

[0120] The fusion module 303 is used to fuse the image contour feature information with the image gender feature information to obtain image fusion feature information.

[0121] In the embodiment of the present invention, the image contour feature information and the image gender feature information are fused by splicing in the dimension of each channel, and / or by performing feature fusion through a classification feature fusion layer composed of multiple convolutional layers to obtain image fusion feature information. Optionally, the classification feature fusion layer can be composed of multiple cascaded N×N convolutional layers, for example, two cascaded 3×3 convolutional layers.

[0122] The training module 304 is used to input the image fusion feature information into the second gender classification network model for training until convergence to obtain a target neural network model.

[0123] In an embodiment of the present invention, the target neural network model is used to classify the gender of an input image. Optionally, the architecture of the target neural network model includes the above-mentioned feature extraction network model, a first gender classification network model, and a second gender classification network model, and its data processing flow is similar to the above-mentioned training steps. Those skilled in the art are familiar with the technical details of the training steps of the neural network model and the actual prediction steps, which are the same or similar, and will not be repeated here. Optionally, the second gender classification network model can be a fully connected layer for gender classification, or it can refer to the technical details of the first gender classification network model.

[0124] It can be seen that the device described in the embodiment of the present invention can simultaneously extract the contour feature information and gender feature information of the training image through a dual-path network model, and train the gender classification model by combining the features after the two types of information are fused, so that the contour information of the image can be introduced into the gender classification network training of the image, thereby improving the gender classification accuracy of the network model obtained by subsequent training. At the same time, compared with the existing gender classification network model training method, the model complexity in the present invention is greatly reduced, the convergence speed is faster, and the manpower and material costs are lower.

[0125] In an optional embodiment, the image contour feature information is multi-channel and multi-level image contour feature information, and accordingly, the feature extraction network model includes multiple feature extraction layers for respectively extracting contour features of different levels and corresponding multiple size unification layers for unifying the size.

[0126] It can be seen that by implementing this optional implementation, the feature extraction network model can be used to extract contour features of different levels of multiple channels of an image, and unify the sizes of multiple feature maps through a size unification layer to obtain multi-level image contour feature information, which can be used to more accurately characterize the contour information of the image. When this contour information is subsequently introduced into the training of the target neural network, the accuracy of the target neural network in determining the gender information of the image based on the contour of the image can be improved.

[0127] In an optional embodiment, if Figure 4 As shown, the contour extraction module 301 includes:

[0128] The feature extraction unit 3011 is used to input the training image set into multiple feature extraction layers to output multiple image contour features of different sizes;

[0129] A size unification unit 3012, used to input the image contour features output by each feature extraction layer into the corresponding size unification layer to obtain multiple image contour features of the same size;

[0130] The fusion unit 3013 is used to determine multiple image contour features of the same size as image contour feature information.

[0131] In an embodiment of the present invention, the plurality of feature extraction layers are a plurality of convolutional layers cascaded in sequence, wherein the output of each convolutional layer is connected to a corresponding uniform-size layer. Optionally, the feature extraction layer is a convolutional layer including a residual module, wherein the residual module is used to enhance the feature extraction and back-propagation capabilities, and may be ResNet, DenseNet or SENet. Ultimately, each feature extraction layer outputs feature maps of different sizes, thereby obtaining feature maps of multiple sizes. Among them, the shallow feature map is used to capture the subtle texture features of the clothing image, and the deep feature map is used to capture the contour features. In an optional embodiment, the convolutional layer may be a cascaded 3×3 convolutional layer and a residual module.

[0132] Optionally, the size unification layer may be an interpolation module, and optionally, the interpolation module uses an interpolation algorithm to uniformly interpolate the sizes of the image contour features output by the feature extraction layer to the same size. Optionally, the interpolation algorithm may be one or more of bilinear interpolation, nearest neighbor interpolation, and deconvolution layer, which is not limited in the present invention.

[0133] It can be seen that implementing this optional implementation method can obtain multi-level image contour feature information, which can be used to more accurately characterize the contour information of the image. When this contour information is subsequently introduced into the training of the target neural network, the accuracy of the target neural network in determining the image gender information based on the image contour can be improved.

[0134] As an optional implementation, the training module 304 inputs the image fusion feature information into the second gender classification network model for training until convergence, and obtains the target neural network model in a specific manner, including:

[0135] Input the image fusion feature information into the second gender classification network model for training;

[0136] Based on back propagation, the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated until the first loss function converges to obtain the target neural network model.

[0137] In an embodiment of the present invention, preferably, the model parameters of the first gender classification network model and the second gender classification network model can be updated without updating the model parameters of the feature extraction network model. This is because the feature extraction network model in this model is trained in another way, and its function is only used for extracting image contour features. If it is trained, it will affect the representation ability of the subsequently extracted image contour features.

[0138] Optionally, the gender prediction information finally output by the second gender classification network model may be the predicted gender label and the corresponding confidence level corresponding to the training image. Optionally, the first loss function is the softmax loss between the gender prediction information output by the second gender classification network model and the true gender label of the corresponding training image, and the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated by calculating the back-propagation gradient information obtained by the loss, so that the first loss function converges.

[0139] It can be seen that by implementing this optional implementation method, based on back propagation, the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated until the first loss function converges to obtain a trained neural network model. The model parameters of the feature extraction network model do not need to be updated during training, thereby improving the convergence speed during training and reducing the workload on the one hand, and on the other hand, allowing the network model to pay more attention to the accuracy of gender classification rather than the accuracy of contour extraction, so as to achieve better gender classification prediction effects.

[0140] As an optional implementation, the device further includes:

[0141] The feature extraction network training module is used to input the contour training image set into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges to obtain the feature extraction network model.

[0142] In an embodiment of the present invention, the feature extraction network training model includes a feature extraction network model and a single-channel feature convolution layer connected to the output of the feature extraction network model, wherein the single-channel feature convolution layer is used to process the multi-channel and multi-level image contour feature information output by the feature extraction network model into single-channel image contour feature information.

[0143] In the embodiment of the present invention, what is finally trained is a feature extraction network model, that is, a feature extraction network training model with the single-channel feature convolution layer removed. This is because what is ultimately needed in the solution of the present invention is the feature extraction network model to extract the multi-channel and multi-level contour features of the image. The single-channel feature convolution layer is only used to fuse the multi-channel and multi-level contour features during training to facilitate subsequent loss calculations, and can be discarded after the training is completed.

[0144] It can be seen that implementing this optional implementation method can input the contour training image set into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges, thereby obtaining a feature extraction network model for extracting multi-channel and multi-level contour feature information, so as to improve the efficiency and accuracy of the image recognition task when performing the image recognition task based on the contour information in the subsequent process.

[0145] In another optional embodiment, the feature extraction network training module inputs the contour training image set into the feature extraction network training model for training until the first loss function of the feature extraction network training model converges to obtain the trained feature extraction network model, including:

[0146] Inputting the contour training image set into multiple feature extraction layers to output multiple image contour features of different sizes;

[0147] Input the image contour features output by each feature extraction layer into the corresponding size unification layer to obtain multiple image contour features of the same size;

[0148] Fusing multiple image contour features of the same size to obtain first image contour feature information;

[0149] Inputting the first image contour feature information into the single-channel feature convolution layer to obtain the single-channel image contour feature information;

[0150] Repeat the above steps to update the model parameters of the feature extraction network model based on back propagation until the first loss function converges to obtain the trained feature extraction network model.

[0151] In the embodiment of the present invention, optionally, the contour training image set includes a plurality of annotated contour training images, wherein the annotated contour training images are training images in which contours in the images are manually annotated. Optionally, the second loss function is a cross entropy loss between single-channel image contour feature information and the corresponding contour training image.

[0152] It can be seen that implementing this optional implementation method can train the feature extraction network training model until the second loss function of the feature extraction network training model converges, thereby obtaining a feature extraction network model for extracting multi-channel and multi-level contour feature information, so as to improve the efficiency and accuracy of the image recognition task when performing the image recognition task based on the contour information in the subsequent process.

[0153] As an optional implementation, the device further includes:

[0154] The data enhancement module is used to process the training image set using a data enhancement algorithm to obtain a training image set including more training images.

[0155] In the embodiment of the present invention, the data enhancement algorithm may be an offline data enhancement algorithm or an online data enhancement algorithm, which may be a data enhancement method for transforming information such as the size, direction, color, and resolution of the training image. For example, it may be one or more of processing operations such as flipping, rotating, cropping, scaling, translating, affine transformation, adding noise, brightness enhancement, contrast enhancement, and sharpening.

[0156] It can be seen that this optional implementation can use a data enhancement algorithm to process the training image set to obtain a training image set including more training images, thereby increasing the volume of training image data while reducing the workload, thereby further improving the degree of model training, which is conducive to improving the prediction accuracy of the trained model.

[0157] As an optional implementation, the data enhancement module processes the training image set using the data enhancement algorithm to obtain a training image set including more training images, including:

[0158] The color information of one or more training images in the training image set is transformed to obtain a training image set including more training images.

[0159] Optionally, the method of transforming the color information may include randomly exchanging color channels and randomly changing the size of the eigenvalue of a specific channel, or a combination of the two, which is not limited by the present invention. Optionally, the degree of color information transformation here should be less than a preset threshold, for example, the number of images of the exchanged color channels should be less than the number threshold, or the difference in the size of the eigenvalue of a specific channel should be less than the difference threshold, so as to prevent affecting the color data distribution of the overall clothing image and causing a decrease in model accuracy.

[0160] It can be seen that this optional implementation can reduce the possibility that the gender classification model finally trained directly outputs gender categories based on color information, thereby improving the generalization of the model.

[0161] Embodiment 4

[0162] See also Figure 5 , Figure 5 FIG. 1 is a schematic diagram of the structure of another neural network training device for image gender classification disclosed in an embodiment of the present invention. Figure 5 As shown, the device may include:

[0163] A memory 401 storing executable program codes;

[0164] a processor 402 coupled to the memory 401;

[0165] The processor 402 calls the executable program code stored in the memory 401 to execute part or all of the steps in the neural network training method for image gender classification disclosed in the first or second embodiment of the present invention.

[0166] Embodiment 5

[0167] An embodiment of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute some or all of the steps in the neural network training method for image gender classification disclosed in embodiment 1 or embodiment 2 of the present invention.

[0168] The device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0169] Through the specific description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on such an understanding, the above technical solution can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0170] Finally, it should be noted that the neural network training method and device for image gender classification disclosed in the embodiment of the present invention discloses only the preferred embodiments of the present invention, which are only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A neural network training method for image gender classification, characterized in that: The method comprises: Using a data enhancement algorithm to process the training image set to obtain a training image set including more training images, and inputting the training image set into a feature extraction network model to extract features to obtain image contour feature information; Inputting the training image set into a first gender classification network model to obtain image gender feature information; Fusing the image contour feature information with the image gender feature information to obtain image fusion feature information; Inputting the image fusion feature information into a second gender classification network model for training until convergence, thereby obtaining a target neural network model; the target neural network model is used to classify the gender of the input image; And, the data enhancement algorithm is used to process the training image set to obtain a training image set including more training images, including: The color information of one or more training images in the training image set is transformed to obtain a training image set including more training images, wherein the color information is transformed in a manner including randomly exchanging color channels and randomly changing one or a combination of the two of the eigenvalue size of a specific channel.

2. The neural network training method for image gender classification according to claim 1, characterized in that: The image contour feature information is multi-channel and multi-level image contour feature information; the feature extraction network model includes a plurality of feature extraction layers for respectively extracting contour features of different levels and a corresponding plurality of size unification layers for unifying the size; the training image set is input into the feature extraction network model for feature extraction to obtain the image contour feature information, including: Inputting a training image set into a plurality of the feature extraction layers to output a plurality of image contour features of different sizes; Inputting the image contour features output by each of the feature extraction layers into the corresponding size unification layer to obtain a plurality of image contour features of the same size; The multiple image contour features of the same size are determined as image contour feature information.

3. The neural network training method for image gender classification according to claim 2, characterized in that: The plurality of feature extraction layers are a plurality of sequentially cascaded convolutional layers, wherein the output of each of the convolutional layers is connected to one of the size unification layers.

4. The neural network training method for image gender classification according to claim 1, characterized in that: The step of inputting the image fusion feature information into a second gender classification network model for training until convergence to obtain a target neural network model includes: Inputting the image fusion feature information into a second gender classification network model for training; Based on back propagation, the model parameters of the first gender classification network model and / or the second gender classification network model are continuously updated until the first loss function converges to obtain the target neural network model.

5. The neural network training method for image gender classification according to claim 4, characterized in that: The first loss function is the softmax loss of the gender prediction information output by the second gender classification network model and the true gender label of the corresponding training image.

6. The neural network training method for image gender classification according to claim 1, characterized in that: The method further comprises: The contour training image set is input into the feature extraction network training model for training until the second loss function of the feature extraction network training model converges to obtain the feature extraction network model; wherein the feature extraction network training model includes the feature extraction network model and a single-channel feature convolution layer connected to the output of the feature extraction network model.

7. A neural network training device for image gender classification, characterized in that: The device comprises: A data enhancement module, used for processing the training image set using a data enhancement algorithm to obtain a training image set including more training images; The contour extraction module is used to input the training image set into the feature extraction network model for feature extraction to obtain image contour feature information; A gender extraction module, used for inputting the training image set into a first gender classification network model to obtain image gender feature information; A fusion module, used for fusing the image contour feature information with the image gender feature information to obtain image fusion feature information; A training module, used for inputting the image fusion feature information into a second gender classification network model for training until convergence, thereby obtaining a target neural network model; the target neural network model is used for classifying the gender of the input image; Furthermore, the data enhancement module processes the training image set using the data enhancement algorithm to obtain a training image set including more training images, and the specific manner includes: The color information of one or more training images in the training image set is transformed to obtain a training image set including more training images, wherein the color information is transformed in a manner including randomly exchanging color channels and randomly changing one or a combination of the two of the eigenvalue size of a specific channel.

8. A neural network training device for image gender classification, characterized in that: The device comprises: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the neural network training method for image gender classification as described in any one of claims 1-6.

9. A computer storage medium, characterized in that The computer storage medium stores computer instructions, which, when called, are used to execute the neural network training method for image gender classification as described in any one of claims 1-6.