US20200143248A1 - Machine learning model training method and device, and expression image classification method and device - Google Patents

Machine learning model training method and device, and expression image classification method and device Download PDF

Info

Publication number
US20200143248A1
US20200143248A1 US16/735,236 US202016735236A US2020143248A1 US 20200143248 A1 US20200143248 A1 US 20200143248A1 US 202016735236 A US202016735236 A US 202016735236A US 2020143248 A1 US2020143248 A1 US 2020143248A1
Authority
US
United States
Prior art keywords
special
machine learning
learning model
image
purpose image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
US16/735,236
Other versions
US11537884B2 (en
Inventor
Longpo Liu
Wei Wan
Qian Chen
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Assigned to TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED reassignment TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: CHEN, QIAN, LIU, Longpo, WAN, WEI
Publication of US20200143248A1 publication Critical patent/US20200143248A1/en
Priority to US17/969,631 priority Critical patent/US20230037908A1/en
Application granted granted Critical
Publication of US11537884B2 publication Critical patent/US11537884B2/en
Active legal-status Critical Current
Adjusted expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • G06F18/2155Generating training patterns; Bootstrap methods, e.g. bagging or boosting characterised by the incorporation of unlabelled data, e.g. multiple instance learning [MIL], semi-supervised techniques using expectation-maximisation [EM] or naïve labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • G06K9/6259
    • G06K9/6277
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/096Transfer learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/35Categorising the entire scene, e.g. birthday party or wedding scene
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/174Facial expression recognition
    • G06V40/175Static expression
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N7/00Computing arrangements based on specific mathematical models
    • G06N7/01Probabilistic graphical models, e.g. probabilistic networks

Definitions

  • This application relates to the machine learning field, and in particular, to a machine learning model training method and apparatus, and an expression image classification method and apparatus.
  • a trained machine learning model may be used to classify images.
  • a conventional machine learning model training manner is usually training a machine learning model by using a large amount of training data, and making the model learn a classification rule, to improve the classification accuracy of the model.
  • this application provides a machine learning model training method and apparatus, and an expression image classification method and apparatus, to resolve the problem of the low training efficiency of the conventional machine learning model.
  • a machine learning model training method is applied to a computer device, the method including:
  • machine learning model through training according to a general-purpose image training set, wherein the machine learning model comprises one or more model parameters and that is obtained;
  • a machine learning model training apparatus includes a computing device comprising one or more processors, memory coupled to the one or more processors and a plurality of programs stored in the memory that, when executed by the one or more processors, cause the computing device to perform the aforementioned machine learning model training method.
  • a non-transitory computer readable storage medium stores at least one instruction, at least one program, and a code set or an instruction set, and the at least one instruction, the at least one program, and the code set or the instruction set are loaded and executed by a processor to implement the foregoing machine learning model training method.
  • a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model.
  • Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • FIG. 1 is a diagram of an application environment of a machine learning model training method in an embodiment.
  • FIG. 2 is a schematic flowchart of a machine learning model training method in an embodiment.
  • FIG. 3 is a schematic structural diagram of a VGG model in an embodiment.
  • FIG. 4 is a schematic flowchart of a machine learning model training method in another embodiment.
  • FIG. 5 is a schematic flowchart of a model retraining step in an embodiment.
  • FIG. 6 is a schematic flowchart of a step of classifying a to-be-classified special-purpose image in an embodiment.
  • FIG. 7 is a schematic flowchart of a machine learning model training method in an embodiment.
  • FIG. 8 is a structural block diagram of a machine learning model training apparatus in an embodiment.
  • FIG. 9 is a structural block diagram of a machine learning model training apparatus in another embodiment.
  • FIG. 10 is a schematic flowchart of an expression image classification method in an embodiment.
  • FIG. 11 is a structural block diagram of an expression image classification apparatus in an embodiment.
  • FIG. 1 is a diagram of an application environment of a machine learning model training method and/or an expression image classification method in an embodiment.
  • the machine learning model training method and/or expression image classification method is applied to a computer device.
  • the computer device may be a terminal or a server.
  • the terminal may be a desktop device or a mobile terminal, and the mobile terminal may be a touch screen mobile phone, a tablet computer, a wearable device, a personal reader, or the like.
  • the server may be an independent physical server, a physical server cluster, or a virtual server (also referred to as a cloud server).
  • the computer device includes a processor, a non-volatile storage medium, an internal memory, and a network interface that are connected to each other by using a system bus.
  • the processor includes a central processing unit and a graphics processing unit.
  • the non-volatile storage medium of the computer device stores an operating system, and may further store computer-readable instructions. When executed by the processor, the computer-readable instructions may cause the processor to implement the machine learning model training method and/or the expression image classification method.
  • the central processing unit is configured to provide calculation and control capabilities, and support running of the entire computer device, and the graphics processing unit is configured to execute graphics processing instructions.
  • the internal memory may also store computer-readable instructions. When executed by the processor, the computer-readable instructions may cause the processor to implement the machine learning model training method and/or the expression image classification method.
  • FIG. 1 is merely a block diagram of a partial structure related to a solution in this application, and does not constitute a limitation to the computer device to which the solution in this application is applied.
  • the computer device may include more components or fewer components than those shown in the figure, or some components may be combined, or a different component deployment may be used.
  • FIG. 2 is a schematic flowchart of a machine learning model training method in an embodiment. This embodiment is described by using an example in which the method is applied to the computer device in FIG. 1 .
  • the machine learning model training method may include the following steps:
  • Step S 202 Obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • the machine learning model is a machine learning algorithm model that has a classification capability after being trained.
  • the machine learning is ML for short.
  • the machine learning model may have a classification capability through sample learning.
  • An image training set is a set of images for training a machine learning model.
  • the model parameter is each parameter in a model structure of the machine learning model, and can reflect an output and input correspondence of the machine learning model.
  • the general-purpose image training set is an image training set for training a machine learning model having a general classification capability.
  • the machine learning model obtained through training according to the general-purpose image training set may be referred to as a general machine learning model.
  • the general machine learning model has a classification capability for a general image.
  • the computer device may obtain a model structure and a model parameter of a trained machine learning model according to a general-purpose image training set, and import the model parameter into the model structure, to obtain a machine learning model carrying the model parameter.
  • the model parameter carried by the machine learning model is used as an initial parameter for training the machine learning model in this embodiment to participate in the training.
  • the general-purpose image training set may be a general-purpose image training set formed by images in an Image Net (image identification data library), and the corresponding machine learning model may be a VGG (Visual Geometry Group) network model, a GoogleNet network model, a ResNet (energy efficiency assessment system) network model, or the like.
  • VGG Visual Geometry Group
  • GoogleNet GoogleNet
  • ResNet energy efficiency assessment system
  • Step S 204 Determine a sample of a special-purpose image and a corresponding classification label.
  • the special-purpose image is an image having a special purpose, and is special relative to images in the general-purpose image training set.
  • the machine learning model obtained through training according to the special-purpose image may be referred to as a special machine learning model.
  • the special-purpose image may be classified into different categories.
  • the categories that can be classified by the general machine learning model may be more than the categories that can be classified by the special machine learning model.
  • the sample of the special-purpose image is a special-purpose image for training the special machine learning model.
  • the classification label is data marking the category to which the sample of the special-purpose image belongs.
  • the special-purpose image may be an expression image, an application icon, an advertising image, a style art image, or the like.
  • the classification label corresponding to the sample of the special-purpose image may include a holiday category, a love category, a delicious category, a real-person category, and a guilty pleasure category.
  • the computer device may select a plurality of special-purpose images from a special-purpose image library as samples of the special-purpose images, classify the samples of the special-purpose images, and assign a classification label of each category of the samples of the special-purpose images.
  • the computer device may first determine a classification label and a corresponding label definition, to select some special-purpose images meeting the definition of the classification label from the special-purpose image library according to the definition corresponding to the classification label, as the sample of the special-purpose image corresponding to the classification label.
  • Step S 206 Input the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result.
  • the intermediate classification result is a classification result outputted by the machine learning model after the sample of the special-purpose image is inputted to the machine learning model in a training process.
  • the machine learning model may determine the classification label to which the sample of the special-purpose image belongs, to use the classification label as the intermediate classification result.
  • Step S 208 Adjust the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • the training stop condition is a condition for ending model training.
  • the training stop condition may be that a quantity of times of adjusting the model parameter of the machine learning model and continuing training reaches a preset quantity of iterations, or that a classification performance index of the machine learning model with the adjusted model parameter reaches a preset index.
  • the adjusting the model parameter of the machine learning model is adjusting model parameters of the machine learning model.
  • the computer device may compare the difference between the intermediate classification result and the classification label, to adjust the model parameter of the machine learning model at a learning rate less than a learning rate of training the machine learning model according to the general-purpose image training set, to reduce the difference. If after the model parameter is adjusted, the training stop condition is not met, go back to step S 206 to continue training, and end the training in a case that the training stop condition is met.
  • the learning rate is an important hyper-parameter in a machine learning model training process, and the learning rate may control a speed of adjusting a neural network weight based on a loss of gradient. Generally, a smaller learning rate indicates a slower speed of a decrease of a loss of gradient and more reliable training, but a longer consumed time.
  • the adjusting the model parameter of the machine learning model may be partially adjusting model parameters of the machine learning model. For example, some model parameters may remain unchanged, and the other model parameters are adjusted.
  • the difference between the intermediate classification result and the classification label may be measured by using a cost function.
  • the cost function is a function of a model parameter, and a function that can measure the difference between the intermediate classification result of the machine learning model and the classification label.
  • the computer device may end the training in a case that the value of the cost function is less than a preset value, to obtain a machine learning model for classifying the special-purpose image.
  • the computer device may select a function such as a cross entropy or a mean square error as the cost function.
  • a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model.
  • Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • step S 204 includes: obtaining a representative special-purpose image corresponding to the classification label; determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and selecting a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • the special-purpose image library is a set library of known special-purpose images, including all special-purpose images.
  • the representative special-purpose image is a special-purpose image that is in special-purpose images of categories corresponding to the classification labels and that can represent this category of special-purpose images. Meeting the difference condition means that the special-purpose images in the special-purpose image set formed by the representative special-purpose image and the similar special-purpose images have differences restrained by using a mathematical condition.
  • the computer device may select, from the special-purpose image library according to the meaning of the classification label, a special-purpose image that can represent the meaning of the classification label as the representative special-purpose image.
  • the representative special-purpose image corresponding to the classification label may be manually selected from the special-purpose image library.
  • the computer device may obtain similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library, to sort the special-purpose images in the special-purpose image library according to similarity values. Starting from a special-purpose image with a maximum similarity, a specified quantity of continuous similar special-purpose images is selected, and a special-purpose image meeting the difference condition is selected from the selected similar special-purpose images and the representative special-purpose image as the sample of the special-purpose image corresponding to the classification label.
  • the computer device may compare the differences between any two special-purpose images in a set formed by the representative special-purpose image and the similar special-purpose images, to determine the special-purpose image meeting the difference condition. For example, if differences between a special-purpose image in the set and all other special-purpose images are relatively large, the special-purpose image may be determined as the special-purpose image meeting the difference condition.
  • the two special-purpose images with a relatively large difference may be two special-purpose images whose difference exceeds a preset value, or may be two special-purpose images corresponding to a preset quantity of differences sorted front in a descending sequence of differences between any two special-purpose images.
  • the computer device when selecting the special-purpose image meeting the difference condition from the representative special-purpose image and the similar special-purpose images, the computer device may compare the similarities between any two special-purpose images in the set formed by the representative special-purpose image and the similar special-purpose images, and remove one of the two similar special-purpose images, to obtain the special-purpose image meeting the difference condition.
  • the two similar special-purpose images may be two special-purpose images whose similarity exceeds a preset value, or may be two special-purpose images corresponding to a preset quantity of similarities sorted front in a descending sequence of similarities between any two special-purpose images.
  • special-purpose images that are similar to the representative special-purpose image corresponding to the classification label, and that have differences are selected as the samples of the special-purpose images to form training data together with the corresponding classification label, and each sample may try to provide useful information for training of the machine learning model, thereby improving the training efficiency of the machine learning model, and further reducing an over-fitting risk in the model training process.
  • step S 204 further includes: obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • the intermediate layer of the machine learning model is a layer between an input layer and an output layer of the machine learning model.
  • the image feature of the special-purpose image is a feature representing that a corresponding special-purpose image is different from other images.
  • the similarity may use a cosine similarity or a Hamming distance for sensing a Hash value between images.
  • the machine learning model is a convolutional neural network model.
  • the convolutional neural network (CNN for short) is an artificial neural network.
  • the convolutional neural network includes a convolutional layer and a pooling layer.
  • a plurality of feature maps exists in the convolutional layer of the convolutional neural network, each feature map includes a plurality of neurons, and all neurons of the same feature map share a convolutional kernel.
  • the convolutional kernel is a weight of a corresponding neuron, and the convolutional kernel represents one feature.
  • the convolutional kernel is generally initialized in a form of a random decimal matrix, and a proper convolutional kernel is obtained through learning in a network training process.
  • the convolutional layer may decrease connections between layers in a neural network, and also reduce an over-fitting risk.
  • the pooling usually has two forms: mean pooling and max pooling.
  • the pooling may be seen as a special convolution process.
  • the convolution and the pooling greatly simplify the complexity of the neural network and decrease parameters of the neural network.
  • the convolutional neural network model is a machine learning model trained by using a convolutional neural network algorithm.
  • the convolutional neural network used in this embodiment may be directly built, or may be obtained by transforming a known convolutional neural network.
  • the machine learning model is a convolutional neural network model.
  • the computer device After inputting the representative special-purpose image to the convolutional neural network model, the computer device obtains data outputted by a convolutional layer or a full connection layer between an input layer and an output layer in the convolutional neural network model, as the image feature of the representative special-purpose image.
  • the machine learning model is a convolutional neural network model.
  • the computer device After inputting the special-purpose images in the special-purpose image library to the machine learning model, the computer device obtains data outputted by a convolutional layer or a full connection layer between an input layer and an output layer in the convolutional neural network model, as the image features of the inputted special-purpose images
  • the computer device may use an 8-layer VGG model as a machine learning model to be trained, where c1-c5 layers are convolutional layers, and fc6-fc8 layers are full connection layers.
  • the computer device inputs the representative special-purpose image from the c1 layer, and extracts the image feature outputted by the fc7 full connection layer in the VGG model.
  • the computer device may input the special-purpose images in the special-purpose image library from the c1 layer, and extracts the image features outputted by the fc7 full connection layer in the VGG model. Then, the computer device may calculate the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • the image feature outputted by the intermediate layer of the machine learning model can well reflect characteristics of the corresponding special-purpose image, so that a desirable sample of the special-purpose image can be selected, thereby further improving the training efficiency of the machine learning model, and ensuring the classification accuracy of the trained machine learning model.
  • the machine learning model training method includes the following steps:
  • Step S 402 Obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • step S 402 For the implementation process of step S 402 , reference may be made to the description in the foregoing step S 202 , and details are not described herein again.
  • Step S 404 Determine a sample of a special-purpose image and a corresponding classification label.
  • step S 404 For the implementation process of step S 404 , reference may be made to the description in the foregoing step S 204 , and details are not described herein again.
  • Step S 406 Configure a category classified by the machine learning model to match with a type of the classification label.
  • the computer device may configure a quantity of classified categories in the model parameter of the machine learning model into a quantity of types of the classification labels, and match the classified categories in the model parameter of the machine learning model with the classification labels, so that a quantity of outputs of the machine learning models corresponds to the quantity of types of the classification labels.
  • Step S 408 Input the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels.
  • the computer device may input the sample of the special-purpose image to the machine learning model, the machine learning model may obtain outputs in a corresponding quantity of the classification labels after processing the sample of the special-purpose image, and each output represents a corresponding probability that the sample of the special-purpose image belongs to a classification label.
  • the machine learning model may obtain N outputs after processing the sample of the special-purpose image, where an n th (n is a positive integer not greater than N) output may represent a corresponding probability that the sample of the special-purpose image belongs to an n th classification label.
  • Step S 410 Determine a maximum probability in the obtained probabilities.
  • the computer device may compare one by one the corresponding probabilities that the sample of the special-purpose image is classified to all classification labels, to determine the maximum probability in the foregoing probabilities.
  • the computer device may compare the N probabilities obtained in the foregoing step S 408 , and determine the maximum probability in the N probabilities.
  • Step S 412 Use a classification label corresponding to the maximum probability as an intermediate classification result of the sample of the special-purpose image.
  • the computer device may obtain the classification label corresponding to the maximum probability, to use the classification label as the intermediate classification result of the sample of the special-purpose image.
  • a classification label corresponding to the second probability may be used as the intermediate classification result of the sample of the special-purpose image.
  • Step S 414 Adjust the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • the computer device may represent the classification label corresponding to the sample of the special-purpose image as a distribution vector of the classification label relative to a classification label set, and also represent the classification label (namely, the intermediate classification result) corresponding to the maximum probability as a distribution vector of the classification label relative to the classification label set, to calculate a vector similarity between the distribution vectors, and measure the difference between the intermediate classification result and the classification label by using the vector similarity.
  • a quantity of elements in the distribution vector is equal to a quantity of types of the classification labels, and each element corresponds to one type of the classification labels.
  • the classification label is represented as a distribution vector
  • elements that are in the distribution vector and that correspond to the classification label is set to a first value
  • other elements in the distribution vector than the elements corresponding to the classification label are set to a second value.
  • the first value may be 1, and the second value may be 0.
  • the categories classified by the machine learning model are configured to match with the types of the classification labels, so that the machine learning model can obtain outputs corresponding to the types of the classification labels, to obtain the probabilities that the sample of the special-purpose image belongs to all classification labels.
  • An output corresponding to the maximum probability is selected as the intermediate classification result of the sample of the special-purpose image, and the difference between the intermediate classification result and the classification label corresponding to the sample of the special-purpose image is continuously reduced by adjusting the model parameter, so that the intermediate classification result is continuously close to the corresponding classification label, thereby improving the model classification accuracy.
  • the machine learning model is a convolutional neural network model.
  • Step S 208 includes: remaining model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjusting model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that the training stop condition is met.
  • the layers sorted front according to the layer sequence may be a specified quantity of front layers in the machine learning model, such as the front three layers.
  • the layers sorted behind according to the layer sequence may be layers behind the specified quantity of front layers in the machine learning model, such as the layers behind the front three layers.
  • the model parameters of the layers sorted front in the machine learning model trained by using the general-purpose image training set may remain unchanged in the training process.
  • the model parameters of the layers sorted behind according to the layer sequence in the machine learning model are adjusted in the model training process, and the training is ended in a case that the training stop condition is met.
  • model parameters of the front three convolutional layers in the VGG model may remain unchanged in the model training process.
  • values in convolutional kernels of the front three convolutional layers may remain unchanged, to adjust model parameters in rear layers at a learning rate smaller than a learning rate at which the machine learning model is trained according to the general-purpose image training set.
  • values in the convolutional kernels in the convolutional layer behind the front three layers and full connection layer matrix coefficients in the full connection layer may be adjusted according to the learning rate.
  • the machine learning model training method further includes a model retraining step.
  • the model retraining step may include:
  • Step S 502 Obtain an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images.
  • the classification failure means that the special-purpose image cannot be classified to a corresponding classification label in a case that an output of the to-be-classified special-purpose image inputted to the machine learning model does not meet a condition that the special-purpose image belongs to the corresponding classification label.
  • all unclassified special-purpose images may be combined, to construct the unclassified special-purpose image set.
  • Step S 504 Cluster the special-purpose image set, to obtain a special-purpose image subset.
  • Clustering is dividing the special-purpose image set into one or more special-purpose image subsets formed by similar special-purpose images based on similarities of the special-purpose images.
  • a clustering algorithm may be a partitioning method, a hierarchical method, a density-based method, a K-means algorithm, a spectral clustering algorithm, a graph theory clustering algorithm or another clustering analysis algorithm.
  • the computer device clusters the special-purpose image set, and if the clustering is successful, similar special-purpose images form a special-purpose image subset.
  • the special-purpose images in each special-purpose image subset are similar, and are different from other special-purpose image subsets.
  • the computer device clusters the special-purpose image set, and if no similar special-purpose images are extracted, the clustering fails, and the special-purpose images that are not clustered successfully may still remain in the unclassified special-purpose image set.
  • Step S 506 Determine a classification label corresponding to the special-purpose image subset.
  • the computer device may generate the classification label corresponding to the special-purpose image subset according to a common feature of the special-purpose images in the special-purpose image subset.
  • the classification label may well generalize the common feature of the special-purpose images in the special-purpose image subset.
  • Step S 508 Retrain the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • the computer device may combine the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label, to obtain a new sample of the special-purpose image and a corresponding classification label.
  • the computer device uses the new sample of the special-purpose image and the corresponding classification label to perform the foregoing step S 202 to step S 208 , to retrain the machine learning model.
  • the machine learning model trained by using the sample of the special-purpose image and the corresponding classification label is retrained by using updated training data, thereby further improving the classification accuracy of the machine learning model.
  • the machine learning model training method further includes a step of classifying a to-be-classified special-purpose image.
  • the step of classifying a to-be-classified special-purpose image may include:
  • Step S 602 Input a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels.
  • the computer device inputs the to-be-classified special-purpose image to the machine learning model, and the machine learning model may obtain outputs in a corresponding quantity of the classification labels after processing the to-be-classified special-purpose image.
  • the corresponding outputs represent the probabilities that the special-purpose image belongs to the corresponding classification labels.
  • Step S 604 Determine a maximum probability in the obtained probabilities.
  • the computer device may compare one by one the corresponding probabilities that the to-be-classified special-purpose image is classified to all classification labels, to determine the maximum probability in the foregoing probabilities.
  • Step S 606 Determine that the classification fails in a case that the maximum probability is less than a threshold, and add the inputted special-purpose image to the unclassified special-purpose image set.
  • the computer device may determine whether the classification is successful by comparing the maximum probability in the obtained probabilities with a classification threshold. In a case that the maximum probability is greater than the classification threshold, if the inputted special-purpose image is classified to the classification label corresponding to the maximum probability, the classification is successful. In a case that the maximum probability is less than the classification threshold, the classification fails, and the inputted special-purpose image is added to the unclassified special-purpose image set.
  • the maximum probability is less than the threshold, it is determined that the classification fails, so that the inputted special-purpose image is added to the unclassified special-purpose image set, to effectively separate special-purpose images that do not belong to known categories, which helps find a new classification label efficiently, thereby further improving the classification capability of the machine learning model.
  • step S 504 includes: inputting the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • the computer device may extract, after the special-purpose images in the special-purpose image set are inputted to the machine learning model obtained after the training is ended, image features outputted by the intermediate layer of the machine learning model.
  • Clustering is performed according to the image features, and whether special-purpose images in the same clustering center conform to the definition of the same classification label is determined. If yes, whether the sum of Euclidean distances from the image features of the special-purpose images in the same clustering center to the clustering center is less than a preset value is determined. If yes, the clustering is successful; otherwise, the clustering fails.
  • the special-purpose images that are in the same clustering center and that are clustered successfully construct the special-purpose image subset.
  • a quantity of clustering centers set when the computer device performs clustering according to the image features may be 2 to 5.
  • the computer device may further implement visualization of a clustering process and a clustering result.
  • the special-purpose image is an expression image
  • the classification label is an expression classification label.
  • the expression image is an image simulating a human expression, such as a cartoon character, a cartoon animal, or a real-person image, and may be used in a terminal to help people's daily communication and interaction.
  • the special-purpose image may be an expression image, for example, an expression image simulating a real-person expression and an expression image of a cartoon animal that are widely applied to an instant messaging application now.
  • the classification label may be an expression classification label corresponding to the expression image.
  • the machine learning model training method includes the following steps:
  • Step S 702 Obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • Step S 704 Obtain a representative special-purpose image corresponding to a classification label.
  • Step S 706 After the representative special-purpose image is inputted to the machine learning model, obtain an image feature outputted by an intermediate layer of the machine learning model.
  • Step S 708 After special-purpose images in a special-purpose image library are inputted to the machine learning model, obtain image features outputted by the intermediate layer of the machine learning model.
  • Step S 710 Calculate similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • Step S 712 Determine, according to the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image.
  • Step S 714 Select a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as a sample of the special-purpose image corresponding to the classification label.
  • Step S 716 Configure a category classified by the machine learning model to match with a type of the classification label.
  • Step S 718 Input the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels.
  • Step S 720 Determine a maximum probability in the obtained probabilities.
  • Step S 722 Use a classification label corresponding to the maximum probability as an intermediate classification result of the sample of the special-purpose image.
  • Step S 724 Remain model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjust model parameters of layers sorted behind according to the layer sequence in the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that the training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • Step S 726 Input a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels.
  • Step S 728 Determine a maximum probability in the obtained probabilities.
  • Step S 730 Determine that the classification fails in a case that the maximum probability is less than a threshold, and add the inputted special-purpose image to an unclassified special-purpose image set.
  • Step S 732 Obtain the unclassified special-purpose image set determined in a case that the machine learning model fails in classifying the to-be-classified special-purpose image.
  • Step S 734 After the special-purpose images in the special-purpose image set are inputted to the machine learning model obtained after the training is ended, obtain the image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model.
  • Step S 736 Perform clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain a special-purpose image subset.
  • Step S 738 Determine a classification label corresponding to the special-purpose image subset.
  • Step S 740 Retrain the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • step S 702 to step S 740 For the implementation processes of the foregoing step S 702 to step S 740 , reference may be made to the descriptions of the corresponding steps in the foregoing method embodiments, and details are not described herein again.
  • a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model.
  • Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • performing training based on the machine learning model that includes the model parameter and that is obtained through training according to the general-purpose image training set can greatly reduce an over-fitting risk generated when a small amount of training data is used to train the model.
  • a machine learning model training apparatus 800 including: an obtaining module 801 , a determining module 802 , a classification module 803 and a training module 804 .
  • the obtaining module 801 is configured to obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • the determining module 802 is configured to determine a sample of a special-purpose image and a corresponding classification label.
  • the classification module 803 is configured to input the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result.
  • the training module 804 is configured to adjust the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model.
  • Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • the determining module 802 is further configured to obtain a representative special-purpose image corresponding to the classification label; determine, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and select a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • special-purpose images that are similar to the representative special-purpose image corresponding to the classification label, and that have differences are selected as the samples of the special-purpose images to form training data together with the corresponding classification label, and each sample may try to provide useful information for training of the machine learning model, thereby improving the training efficiency of the machine learning model, and further reducing an over-fitting risk in the model training process.
  • the determining module 802 is further configured to obtain, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtain, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculate the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • the image feature outputted by the intermediate layer of the machine learning model can well reflect characteristics of the corresponding special-purpose image, so that a desirable sample of the special-purpose image can be selected, thereby further improving the training efficiency of the machine learning model, and ensuring the classification accuracy of the trained machine learning model.
  • the machine learning model training apparatus 800 further includes: a configuration module 805 .
  • the configuration module 805 is configured to configure a category classified by the machine learning model to match with a type of the classification label.
  • the classification module 803 is further configured to: input the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels; determine a maximum probability in the obtained probabilities; and use a classification label corresponding to the maximum probability as the intermediate classification result of the sample of the special-purpose image.
  • the categories classified by the machine learning model are configured to match with the types of the classification labels, so that the machine learning model can obtain outputs corresponding to the types of the classification labels, to obtain the probabilities that the sample of the special-purpose image belongs to all classification labels.
  • An output corresponding to the maximum probability is selected as the intermediate classification result of the sample of the special-purpose image, and the difference between the intermediate classification result and the classification label corresponding to the sample of the special-purpose image is continuously reduced by adjusting the model parameter, so that the intermediate classification result is continuously close to the corresponding classification label, thereby improving the model classification accuracy.
  • the machine learning model is a convolutional neural network model.
  • the training module 804 is configured to: remain model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjust model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continue training, and end the training in a case that the training stop condition is met.
  • the layers sorted front according to the layer sequence may be a specified quantity of front layers in the machine learning model, and the layers sorted behind according to the layer sequence may be layers behind the specified quantity of front layers in the machine learning model.
  • the training module 804 is further configured to obtain an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images; cluster the special-purpose image set, to obtain a special-purpose image subset; determine a classification label corresponding to the special-purpose image subset; and retrain the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • the machine learning model trained by using the sample of the special-purpose image and the corresponding classification label is retrained by using updated training data, thereby further improving the classification accuracy of the machine learning model.
  • the training module 804 is further configured to input a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels; determine a maximum probability in the obtained probabilities; and determine that the classification fails in a case that the maximum probability is less than a threshold, and add the inputted special-purpose image to the unclassified special-purpose image set.
  • the maximum probability is less than the threshold, it is determined that the classification fails, so that the inputted special-purpose image is added to the unclassified special-purpose image set, to effectively separate special-purpose images that do not belong to known categories, which helps find a new classification label efficiently, thereby further improving the classification capability of the machine learning model.
  • the training module 804 is further configured to input the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and perform clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • FIG. 10 is a schematic flowchart of an expression image classification method in an embodiment. This embodiment is described by using an example in which the method is applied to the computer device in FIG. 1 .
  • the expression image classification method may include the following steps:
  • Step S 1002 Input a to-be-classified expression image to a trained machine learning model, to obtain corresponding probabilities that the inputted expression image is classified to all classification labels, where the trained machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training method.
  • the computer device inputs the to-be-classified expression image to the trained machine learning model, and the trained machine learning model may obtain outputs in a corresponding quantity of classification labels after processing the to-be-classified expression image.
  • the corresponding outputs represent the probabilities that the expression image belongs to the corresponding classification labels.
  • the trained machine learning model is obtained through training by using the sample of the expression image as the sample of the special-purpose image and by using the machine learning model training method.
  • Step S 1004 Determine a maximum probability in the obtained probabilities.
  • the computer device may compare one by one the corresponding probabilities that the to-be-classified expression image is classified to all classification labels, to determine the maximum probability in the foregoing probabilities.
  • Step S 1006 Classify the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • the computer device classifies the inputted expression image to the classification label corresponding to the maximum probability.
  • an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • a user portrait can be built according to classification labels to which expression images sent by the user in the past belongs, so as to perform operations such as personalized recommendation or advertising for the user.
  • the user portrait may be a labeled user model abstracted according to information such as a social attribute, a living habit, and a consuming behavior of the user.
  • an expression image classification apparatus 1100 including: a machine learning model 1101 and a classification module 1102 .
  • the machine learning model 1101 is configured to input a to-be-classified expression image, and output corresponding probabilities that the to-be-classified expression image is classified to all classification labels, where the machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training apparatus.
  • the classification module 1102 is configured to determine a maximum probability in the obtained probabilities; and classify the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • the machine learning model training apparatus provided in this application may be implemented as a form of a computer program.
  • the computer program may run on the computer device shown in FIG. 1 , and the non-volatile storage medium of the computer device may store program modules forming the machine learning model training apparatus, such as the obtaining module 801 shown in FIG. 8 .
  • the program modules include computer readable instructions, and the computer readable instructions are used to cause the computer device to perform the steps in the application processing method of the embodiments of this application described in this specification. For example, through the machine learning model training apparatus 800 shown in FIG.
  • the computer device may obtain, by using the obtaining module 801 , a machine learning model that includes a model parameter and that is obtained training according to a general-purpose image training set, input, by using the classification module 803 , a sample of a special-purpose image determined by the determining module 802 , to obtain an intermediate classification result, and then adjust the model parameter of the machine learning model according to a model training result by using the training module 804 , to improve the classification accuracy of the machine learning model.
  • a computer device including a memory and a processor.
  • the memory stores computer readable instructions, and when executed by the processor, the computer readable instructions cause the processor to perform the following steps: obtaining a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set; determining a sample of a special-purpose image and a corresponding classification label; inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result; and adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • the computer readable instructions may cause the processor to perform the following steps when performing the determining a sample of a special-purpose image and a corresponding classification label: obtaining a representative special-purpose image corresponding to the classification label; determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and selecting a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • the computer readable instructions cause the processor to further perform the following steps after performing the step of obtaining a representative special-purpose image corresponding to the classification label: obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • the computer readable instructions cause the processor to further perform the following steps before performing the step of inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result: configuring a category classified by the machine learning model to match with a type of the classification label; and when performing the inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result, the processor may perform the following steps: inputting the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and using a classification label corresponding to the maximum probability as the intermediate classification result of the sample of the special-purpose image.
  • the computer readable instructions may cause the processor to perform the following steps when performing the adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met: remaining model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjusting model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that the training stop condition is met.
  • the computer readable instructions cause the processor to perform the following steps: obtaining an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images; clustering the special-purpose image set, to obtain a special-purpose image subset; determining a classification label corresponding to the special-purpose image subset; and retraining the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • the computer readable instructions cause the processor to perform the following steps: inputting a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and determining that the classification fails in a case that the maximum probability is less than a threshold, and adding the inputted special-purpose image to the unclassified special-purpose image set.
  • the computer readable instructions may cause the processor to perform the following steps when clustering the special-purpose image set, to obtain a special-purpose image subset: inputting the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • the foregoing computer device obtains a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set, and uses a sample of a special-purpose image and a corresponding classification label to train the machine learning model.
  • Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • a computer device including a memory and a processor.
  • the memory stores computer readable instructions, and when executed by the processor, the computer readable instructions cause the processor to perform the following steps: inputting a to-be-classified expression image to a trained machine learning model, to obtain corresponding probabilities that the inputted expression image is classified to all classification labels, where the trained machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training method; determining a maximum probability in the obtained probabilities; and classifying the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • the foregoing computer device inputs an expression image to a trained machine learning model, determines a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels, and classifies the expression image to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • a computer readable storage medium stores computer readable instructions. When executed by a processor, the computer readable instructions implement the following steps: obtaining a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set; determining a sample of a special-purpose image and a corresponding classification label; inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result; and adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • the computer readable instructions may cause the processor to perform the following steps when performing the determining a sample of a special-purpose image and a corresponding classification label: obtaining a representative special-purpose image corresponding to the classification label; determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and selecting a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • the computer readable instructions cause the processor to further perform the following steps after performing the step of obtaining a representative special-purpose image corresponding to the classification label: obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • the computer readable instructions cause the processor to further perform the following steps before performing the step of inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result: configuring a category classified by the machine learning model to match with a type of the classification label; and when performing the inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result, the processor may perform the following steps: inputting the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and using a classification label corresponding to the maximum probability as the intermediate classification result of the sample of the special-purpose image.
  • the computer readable instructions may cause the processor to perform the following steps when performing the adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met: remaining model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjusting model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that the training stop condition is met.
  • the computer readable instructions cause the processor to perform the following steps: obtaining an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images; clustering the special-purpose image set, to obtain a special-purpose image subset; determining a classification label corresponding to the special-purpose image subset; and retraining the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • the computer readable instructions cause the processor to perform the following steps: inputting a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and determining that the classification fails in a case that the maximum probability is less than a threshold, and adding the inputted special-purpose image to the unclassified special-purpose image set.
  • the computer readable instructions may cause the processor to perform the following steps when clustering the special-purpose image set, to obtain a special-purpose image subset: inputting the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model.
  • Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • a computer readable storage medium stores computer readable instructions, and when executed by a processor, the computer readable instructions implement the following steps: inputting a to-be-classified expression image to a trained machine learning model, to obtain corresponding probabilities that the inputted expression image is classified to all classification labels, where the trained machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training method; determining a maximum probability in the obtained probabilities; and classifying the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • the computer device includes a processor and a memory.
  • the memory stores at least one instruction, at least one program, and a code set or instruction set, and the at least one instruction, the at least one program, and the code set or instruction set are loaded and executed by the processor to implement the machine learning model training method provided in the foregoing method embodiment or the expression image classification method provided in the foregoing method embodiment.
  • This application further provides a computer readable storage medium.
  • the storage medium stores at least one instruction, at least one program, and a code set or instruction set, and the at least one instruction, the at least one program, and the code set or instruction set are loaded and executed by a processor to implement the machine learning model training method provided in the foregoing method embodiment or the expression image classification method provided in the foregoing method embodiment.
  • the program may be stored in a non-volatile computer-readable storage medium.
  • the storage medium may be a magnetic disc, an optical disc, a read-only memory (ROM), or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Medical Informatics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Human Computer Interaction (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Probability & Statistics with Applications (AREA)
  • Image Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This application relates to a machine learning model training method and apparatus, and an expression image classification method and apparatus. The machine learning model training method includes: obtaining a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set; determining a sample of a special-purpose image and a corresponding classification label; inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result; and adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met. The solutions provided in this application improve the training efficiency of the machine learning model.

Description

    CROSS-REFERENCE TO RELATED APPLICATIONS
  • This application is a continuation application of PCT/CN2018/090676, entitled “MACHINE LEARNING MODEL TRAINING METHOD AND APPARATUS, AND FACIAL EXPRESSION IMAGE CLASSIFICATION METHOD AND APPARATUS” filed on Jun. 11, 2018, which claims priority to Chinese Patent Application No. 201710566325.X, entitled “MACHINE LEARNING MODEL TRAINING METHOD AND APPARATUS, FACE IMAGE CLASSIFICATION METHOD AND APPARATUS” filed with the China National Intellectual Property Administration on Jul. 12, 2017, all of which are incorporated by reference in their entirety.
  • FIELD OF THE TECHNOLOGY
  • This application relates to the machine learning field, and in particular, to a machine learning model training method and apparatus, and an expression image classification method and apparatus.
  • BACKGROUND OF THE DISCLOSURE
  • Currently, with the development of terminal storage technologies and network technologies, interaction based on images becomes increasingly easy, and more users select to use images to perform interaction, causing an increasing quantity of images used for interaction. Classifying images appropriately plays a very important role in user personalized recommendation and user portrait building. Currently, a trained machine learning model may be used to classify images. A conventional machine learning model training manner is usually training a machine learning model by using a large amount of training data, and making the model learn a classification rule, to improve the classification accuracy of the model.
  • However, based on the conventional model training manner, because a large quantity of training data needs to be used, a lot of time is consumed for obtaining training data and using the training data to train the model, causing relatively low training efficiency of the machine learning model.
  • SUMMARY
  • Based on this, this application provides a machine learning model training method and apparatus, and an expression image classification method and apparatus, to resolve the problem of the low training efficiency of the conventional machine learning model.
  • A machine learning model training method is applied to a computer device, the method including:
  • obtaining a machine learning model through training according to a general-purpose image training set, wherein the machine learning model comprises one or more model parameters and that is obtained;
  • determining a sample set of special-purpose images and a corresponding classification label;
  • inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result for the corresponding classification label;
  • adjusting the model parameters of the machine learning model according to a difference between the intermediate classification result and the classification label; and
  • repeating the inputting and adjusting steps until that a training stop condition is met, to obtain the machine learning model with the adjusted model parameters.
  • A machine learning model training apparatus includes a computing device comprising one or more processors, memory coupled to the one or more processors and a plurality of programs stored in the memory that, when executed by the one or more processors, cause the computing device to perform the aforementioned machine learning model training method.
  • A non-transitory computer readable storage medium stores at least one instruction, at least one program, and a code set or an instruction set, and the at least one instruction, the at least one program, and the code set or the instruction set are loaded and executed by a processor to implement the foregoing machine learning model training method.
  • In the foregoing machine learning model training method and apparatus, a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model. Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • In the foregoing expression image classification method and apparatus, an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • BRIEF DESCRIPTION OF THE DRAWINGS
  • FIG. 1 is a diagram of an application environment of a machine learning model training method in an embodiment.
  • FIG. 2 is a schematic flowchart of a machine learning model training method in an embodiment.
  • FIG. 3 is a schematic structural diagram of a VGG model in an embodiment.
  • FIG. 4 is a schematic flowchart of a machine learning model training method in another embodiment.
  • FIG. 5 is a schematic flowchart of a model retraining step in an embodiment.
  • FIG. 6 is a schematic flowchart of a step of classifying a to-be-classified special-purpose image in an embodiment.
  • FIG. 7 is a schematic flowchart of a machine learning model training method in an embodiment.
  • FIG. 8 is a structural block diagram of a machine learning model training apparatus in an embodiment.
  • FIG. 9 is a structural block diagram of a machine learning model training apparatus in another embodiment.
  • FIG. 10 is a schematic flowchart of an expression image classification method in an embodiment.
  • FIG. 11 is a structural block diagram of an expression image classification apparatus in an embodiment.
  • DESCRIPTION OF EMBODIMENTS
  • To make the technical solutions and advantages of this application clearer and more comprehensible, the following further describes this application in detail with reference to the accompanying drawings and embodiments. The specific embodiments described herein are merely used to describe this application, instead of limiting this application.
  • FIG. 1 is a diagram of an application environment of a machine learning model training method and/or an expression image classification method in an embodiment. As shown in FIG. 1, the machine learning model training method and/or expression image classification method is applied to a computer device. The computer device may be a terminal or a server. The terminal may be a desktop device or a mobile terminal, and the mobile terminal may be a touch screen mobile phone, a tablet computer, a wearable device, a personal reader, or the like. The server may be an independent physical server, a physical server cluster, or a virtual server (also referred to as a cloud server). The computer device includes a processor, a non-volatile storage medium, an internal memory, and a network interface that are connected to each other by using a system bus. The processor includes a central processing unit and a graphics processing unit. The non-volatile storage medium of the computer device stores an operating system, and may further store computer-readable instructions. When executed by the processor, the computer-readable instructions may cause the processor to implement the machine learning model training method and/or the expression image classification method. The central processing unit is configured to provide calculation and control capabilities, and support running of the entire computer device, and the graphics processing unit is configured to execute graphics processing instructions. The internal memory may also store computer-readable instructions. When executed by the processor, the computer-readable instructions may cause the processor to implement the machine learning model training method and/or the expression image classification method. A person skilled in the art may understand that, the structure shown in FIG. 1 is merely a block diagram of a partial structure related to a solution in this application, and does not constitute a limitation to the computer device to which the solution in this application is applied. Specifically, the computer device may include more components or fewer components than those shown in the figure, or some components may be combined, or a different component deployment may be used.
  • FIG. 2 is a schematic flowchart of a machine learning model training method in an embodiment. This embodiment is described by using an example in which the method is applied to the computer device in FIG. 1. Referring to FIG. 2, the machine learning model training method may include the following steps:
  • Step S202. Obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • The machine learning model is a machine learning algorithm model that has a classification capability after being trained. The machine learning is ML for short. The machine learning model may have a classification capability through sample learning. An image training set is a set of images for training a machine learning model. The model parameter is each parameter in a model structure of the machine learning model, and can reflect an output and input correspondence of the machine learning model.
  • The general-purpose image training set is an image training set for training a machine learning model having a general classification capability. The machine learning model obtained through training according to the general-purpose image training set may be referred to as a general machine learning model. The general machine learning model has a classification capability for a general image.
  • In an embodiment, the computer device may obtain a model structure and a model parameter of a trained machine learning model according to a general-purpose image training set, and import the model parameter into the model structure, to obtain a machine learning model carrying the model parameter. The model parameter carried by the machine learning model is used as an initial parameter for training the machine learning model in this embodiment to participate in the training.
  • In an embodiment, the general-purpose image training set may be a general-purpose image training set formed by images in an Image Net (image identification data library), and the corresponding machine learning model may be a VGG (Visual Geometry Group) network model, a GoogleNet network model, a ResNet (energy efficiency assessment system) network model, or the like.
  • Step S204. Determine a sample of a special-purpose image and a corresponding classification label.
  • The special-purpose image is an image having a special purpose, and is special relative to images in the general-purpose image training set. The machine learning model obtained through training according to the special-purpose image may be referred to as a special machine learning model. The special-purpose image may be classified into different categories. The categories that can be classified by the general machine learning model may be more than the categories that can be classified by the special machine learning model. The sample of the special-purpose image is a special-purpose image for training the special machine learning model. The classification label is data marking the category to which the sample of the special-purpose image belongs. In an embodiment, the special-purpose image may be an expression image, an application icon, an advertising image, a style art image, or the like. When the special-purpose image is an expression image, the classification label corresponding to the sample of the special-purpose image may include a holiday category, a love category, a lovely category, a real-person category, and a guilty pleasure category.
  • In an embodiment, the computer device may select a plurality of special-purpose images from a special-purpose image library as samples of the special-purpose images, classify the samples of the special-purpose images, and assign a classification label of each category of the samples of the special-purpose images.
  • In another embodiment, the computer device may first determine a classification label and a corresponding label definition, to select some special-purpose images meeting the definition of the classification label from the special-purpose image library according to the definition corresponding to the classification label, as the sample of the special-purpose image corresponding to the classification label.
  • Step S206. Input the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result.
  • The intermediate classification result is a classification result outputted by the machine learning model after the sample of the special-purpose image is inputted to the machine learning model in a training process.
  • In an embodiment, after the computer device inputs the sample of the special-purpose image to the machine learning model, the machine learning model may determine the classification label to which the sample of the special-purpose image belongs, to use the classification label as the intermediate classification result.
  • Step S208. Adjust the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • The training stop condition is a condition for ending model training. The training stop condition may be that a quantity of times of adjusting the model parameter of the machine learning model and continuing training reaches a preset quantity of iterations, or that a classification performance index of the machine learning model with the adjusted model parameter reaches a preset index. The adjusting the model parameter of the machine learning model is adjusting model parameters of the machine learning model.
  • Optionally, the computer device may compare the difference between the intermediate classification result and the classification label, to adjust the model parameter of the machine learning model at a learning rate less than a learning rate of training the machine learning model according to the general-purpose image training set, to reduce the difference. If after the model parameter is adjusted, the training stop condition is not met, go back to step S206 to continue training, and end the training in a case that the training stop condition is met. The learning rate is an important hyper-parameter in a machine learning model training process, and the learning rate may control a speed of adjusting a neural network weight based on a loss of gradient. Generally, a smaller learning rate indicates a slower speed of a decrease of a loss of gradient and more reliable training, but a longer consumed time.
  • In an embodiment, the adjusting the model parameter of the machine learning model may be partially adjusting model parameters of the machine learning model. For example, some model parameters may remain unchanged, and the other model parameters are adjusted.
  • In an embodiment, the difference between the intermediate classification result and the classification label may be measured by using a cost function. The cost function is a function of a model parameter, and a function that can measure the difference between the intermediate classification result of the machine learning model and the classification label. The computer device may end the training in a case that the value of the cost function is less than a preset value, to obtain a machine learning model for classifying the special-purpose image. The computer device may select a function such as a cross entropy or a mean square error as the cost function.
  • In the foregoing machine learning model training method, a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model. Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • In an embodiment, step S204 includes: obtaining a representative special-purpose image corresponding to the classification label; determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and selecting a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • The special-purpose image library is a set library of known special-purpose images, including all special-purpose images. The representative special-purpose image is a special-purpose image that is in special-purpose images of categories corresponding to the classification labels and that can represent this category of special-purpose images. Meeting the difference condition means that the special-purpose images in the special-purpose image set formed by the representative special-purpose image and the similar special-purpose images have differences restrained by using a mathematical condition.
  • In an embodiment, the computer device may select, from the special-purpose image library according to the meaning of the classification label, a special-purpose image that can represent the meaning of the classification label as the representative special-purpose image. In an embodiment, the representative special-purpose image corresponding to the classification label may be manually selected from the special-purpose image library.
  • In an embodiment, the computer device may obtain similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library, to sort the special-purpose images in the special-purpose image library according to similarity values. Starting from a special-purpose image with a maximum similarity, a specified quantity of continuous similar special-purpose images is selected, and a special-purpose image meeting the difference condition is selected from the selected similar special-purpose images and the representative special-purpose image as the sample of the special-purpose image corresponding to the classification label.
  • In an embodiment, when selecting the special-purpose image meeting the difference condition from the representative special-purpose image and the similar special-purpose images, the computer device may compare the differences between any two special-purpose images in a set formed by the representative special-purpose image and the similar special-purpose images, to determine the special-purpose image meeting the difference condition. For example, if differences between a special-purpose image in the set and all other special-purpose images are relatively large, the special-purpose image may be determined as the special-purpose image meeting the difference condition.
  • The two special-purpose images with a relatively large difference may be two special-purpose images whose difference exceeds a preset value, or may be two special-purpose images corresponding to a preset quantity of differences sorted front in a descending sequence of differences between any two special-purpose images.
  • In an embodiment, when selecting the special-purpose image meeting the difference condition from the representative special-purpose image and the similar special-purpose images, the computer device may compare the similarities between any two special-purpose images in the set formed by the representative special-purpose image and the similar special-purpose images, and remove one of the two similar special-purpose images, to obtain the special-purpose image meeting the difference condition.
  • The two similar special-purpose images may be two special-purpose images whose similarity exceeds a preset value, or may be two special-purpose images corresponding to a preset quantity of similarities sorted front in a descending sequence of similarities between any two special-purpose images.
  • In the foregoing embodiment, special-purpose images that are similar to the representative special-purpose image corresponding to the classification label, and that have differences are selected as the samples of the special-purpose images to form training data together with the corresponding classification label, and each sample may try to provide useful information for training of the machine learning model, thereby improving the training efficiency of the machine learning model, and further reducing an over-fitting risk in the model training process.
  • In an embodiment, step S204 further includes: obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • The intermediate layer of the machine learning model is a layer between an input layer and an output layer of the machine learning model. The image feature of the special-purpose image is a feature representing that a corresponding special-purpose image is different from other images. The similarity may use a cosine similarity or a Hamming distance for sensing a Hash value between images.
  • In an embodiment, the machine learning model is a convolutional neural network model. The convolutional neural network (CNN for short) is an artificial neural network. The convolutional neural network includes a convolutional layer and a pooling layer.
  • A plurality of feature maps exists in the convolutional layer of the convolutional neural network, each feature map includes a plurality of neurons, and all neurons of the same feature map share a convolutional kernel. The convolutional kernel is a weight of a corresponding neuron, and the convolutional kernel represents one feature. The convolutional kernel is generally initialized in a form of a random decimal matrix, and a proper convolutional kernel is obtained through learning in a network training process. The convolutional layer may decrease connections between layers in a neural network, and also reduce an over-fitting risk.
  • The pooling usually has two forms: mean pooling and max pooling. The pooling may be seen as a special convolution process. The convolution and the pooling greatly simplify the complexity of the neural network and decrease parameters of the neural network.
  • The convolutional neural network model is a machine learning model trained by using a convolutional neural network algorithm. The convolutional neural network used in this embodiment may be directly built, or may be obtained by transforming a known convolutional neural network.
  • In an embodiment, the machine learning model is a convolutional neural network model. After inputting the representative special-purpose image to the convolutional neural network model, the computer device obtains data outputted by a convolutional layer or a full connection layer between an input layer and an output layer in the convolutional neural network model, as the image feature of the representative special-purpose image.
  • In an embodiment, the machine learning model is a convolutional neural network model. After inputting the special-purpose images in the special-purpose image library to the machine learning model, the computer device obtains data outputted by a convolutional layer or a full connection layer between an input layer and an output layer in the convolutional neural network model, as the image features of the inputted special-purpose images
  • For example, as shown in FIG. 3, the computer device may use an 8-layer VGG model as a machine learning model to be trained, where c1-c5 layers are convolutional layers, and fc6-fc8 layers are full connection layers. The computer device inputs the representative special-purpose image from the c1 layer, and extracts the image feature outputted by the fc7 full connection layer in the VGG model. Likewise, the computer device may input the special-purpose images in the special-purpose image library from the c1 layer, and extracts the image features outputted by the fc7 full connection layer in the VGG model. Then, the computer device may calculate the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • In the foregoing embodiment, the image feature outputted by the intermediate layer of the machine learning model can well reflect characteristics of the corresponding special-purpose image, so that a desirable sample of the special-purpose image can be selected, thereby further improving the training efficiency of the machine learning model, and ensuring the classification accuracy of the trained machine learning model.
  • As shown in FIG. 4, in an optional embodiment, the machine learning model training method includes the following steps:
  • Step S402. Obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • For the implementation process of step S402, reference may be made to the description in the foregoing step S202, and details are not described herein again.
  • Step S404. Determine a sample of a special-purpose image and a corresponding classification label.
  • For the implementation process of step S404, reference may be made to the description in the foregoing step S204, and details are not described herein again.
  • Step S406. Configure a category classified by the machine learning model to match with a type of the classification label.
  • Optionally, the computer device may configure a quantity of classified categories in the model parameter of the machine learning model into a quantity of types of the classification labels, and match the classified categories in the model parameter of the machine learning model with the classification labels, so that a quantity of outputs of the machine learning models corresponds to the quantity of types of the classification labels.
  • Step S408. Input the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels.
  • Optionally, the computer device may input the sample of the special-purpose image to the machine learning model, the machine learning model may obtain outputs in a corresponding quantity of the classification labels after processing the sample of the special-purpose image, and each output represents a corresponding probability that the sample of the special-purpose image belongs to a classification label.
  • For example, assuming that the quantity of types of the classification labels is N (N is an integer greater than 1), the machine learning model may obtain N outputs after processing the sample of the special-purpose image, where an nth (n is a positive integer not greater than N) output may represent a corresponding probability that the sample of the special-purpose image belongs to an nth classification label.
  • Step S410. Determine a maximum probability in the obtained probabilities.
  • In an embodiment, the computer device may compare one by one the corresponding probabilities that the sample of the special-purpose image is classified to all classification labels, to determine the maximum probability in the foregoing probabilities.
  • For example, the computer device may compare the N probabilities obtained in the foregoing step S408, and determine the maximum probability in the N probabilities.
  • Step S412. Use a classification label corresponding to the maximum probability as an intermediate classification result of the sample of the special-purpose image.
  • Optionally, after determining the maximum probability, the computer device may obtain the classification label corresponding to the maximum probability, to use the classification label as the intermediate classification result of the sample of the special-purpose image.
  • For example, assuming that the computer device determines that the maximum probability in the N probabilities is the second probability, a classification label corresponding to the second probability may be used as the intermediate classification result of the sample of the special-purpose image.
  • Step S414. Adjust the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • In an embodiment, the computer device may represent the classification label corresponding to the sample of the special-purpose image as a distribution vector of the classification label relative to a classification label set, and also represent the classification label (namely, the intermediate classification result) corresponding to the maximum probability as a distribution vector of the classification label relative to the classification label set, to calculate a vector similarity between the distribution vectors, and measure the difference between the intermediate classification result and the classification label by using the vector similarity.
  • A quantity of elements in the distribution vector is equal to a quantity of types of the classification labels, and each element corresponds to one type of the classification labels. When the classification label is represented as a distribution vector, elements that are in the distribution vector and that correspond to the classification label is set to a first value, and other elements in the distribution vector than the elements corresponding to the classification label are set to a second value. For example, the first value may be 1, and the second value may be 0.
  • In the foregoing embodiment, the categories classified by the machine learning model are configured to match with the types of the classification labels, so that the machine learning model can obtain outputs corresponding to the types of the classification labels, to obtain the probabilities that the sample of the special-purpose image belongs to all classification labels. An output corresponding to the maximum probability is selected as the intermediate classification result of the sample of the special-purpose image, and the difference between the intermediate classification result and the classification label corresponding to the sample of the special-purpose image is continuously reduced by adjusting the model parameter, so that the intermediate classification result is continuously close to the corresponding classification label, thereby improving the model classification accuracy.
  • In an embodiment, the machine learning model is a convolutional neural network model. Step S208 includes: remaining model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjusting model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that the training stop condition is met. The layers sorted front according to the layer sequence may be a specified quantity of front layers in the machine learning model, such as the front three layers. The layers sorted behind according to the layer sequence may be layers behind the specified quantity of front layers in the machine learning model, such as the layers behind the front three layers.
  • Optionally, in the machine learning model training process, because low-level features in the sample of the special-purpose image are extracted in the machine learning model according to the layers sorted front according to the layer sequence, and the differences between the low-level features of the general images in the general-purpose image training set and the special-purpose images in the special-purpose image library are small, so that the model parameters of the layers sorted front in the machine learning model trained by using the general-purpose image training set may remain unchanged in the training process. Meanwhile, the model parameters of the layers sorted behind according to the layer sequence in the machine learning model are adjusted in the model training process, and the training is ended in a case that the training stop condition is met.
  • For example, for the model training method whose machine learning model is a VGG model, model parameters of the front three convolutional layers in the VGG model may remain unchanged in the model training process. For example, values in convolutional kernels of the front three convolutional layers may remain unchanged, to adjust model parameters in rear layers at a learning rate smaller than a learning rate at which the machine learning model is trained according to the general-purpose image training set. For example, values in the convolutional kernels in the convolutional layer behind the front three layers and full connection layer matrix coefficients in the full connection layer may be adjusted according to the learning rate.
  • In the foregoing embodiment, in the machine learning model training process, remaining the model parameters of the layers sorted front according to the layer sequence in the machine learning model to be unchanged, and adjusting the model parameters of the layers sorted behind according to the layer sequence in the machine learning model can improve the model training efficiency.
  • In an embodiment, after step S208, the machine learning model training method further includes a model retraining step. As shown in FIG. 5, the model retraining step may include:
  • Step S502. Obtain an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images.
  • The classification failure means that the special-purpose image cannot be classified to a corresponding classification label in a case that an output of the to-be-classified special-purpose image inputted to the machine learning model does not meet a condition that the special-purpose image belongs to the corresponding classification label.
  • Optionally, in a case that the machine learning model fails in classifying the to-be-classified special-purpose image, all unclassified special-purpose images may be combined, to construct the unclassified special-purpose image set.
  • Step S504. Cluster the special-purpose image set, to obtain a special-purpose image subset.
  • Clustering is dividing the special-purpose image set into one or more special-purpose image subsets formed by similar special-purpose images based on similarities of the special-purpose images. A clustering algorithm may be a partitioning method, a hierarchical method, a density-based method, a K-means algorithm, a spectral clustering algorithm, a graph theory clustering algorithm or another clustering analysis algorithm.
  • In an embodiment, the computer device clusters the special-purpose image set, and if the clustering is successful, similar special-purpose images form a special-purpose image subset. The special-purpose images in each special-purpose image subset are similar, and are different from other special-purpose image subsets.
  • In another embodiment, the computer device clusters the special-purpose image set, and if no similar special-purpose images are extracted, the clustering fails, and the special-purpose images that are not clustered successfully may still remain in the unclassified special-purpose image set.
  • Step S506. Determine a classification label corresponding to the special-purpose image subset.
  • Optionally, the computer device may generate the classification label corresponding to the special-purpose image subset according to a common feature of the special-purpose images in the special-purpose image subset. The classification label may well generalize the common feature of the special-purpose images in the special-purpose image subset.
  • Step S508. Retrain the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • In an embodiment, the computer device may combine the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label, to obtain a new sample of the special-purpose image and a corresponding classification label. The computer device uses the new sample of the special-purpose image and the corresponding classification label to perform the foregoing step S202 to step S208, to retrain the machine learning model.
  • In the foregoing embodiment, the machine learning model trained by using the sample of the special-purpose image and the corresponding classification label is retrained by using updated training data, thereby further improving the classification accuracy of the machine learning model.
  • In an embodiment, after step S208, the machine learning model training method further includes a step of classifying a to-be-classified special-purpose image. As shown in FIG. 6, the step of classifying a to-be-classified special-purpose image may include:
  • Step S602. Input a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels.
  • Optionally, the computer device inputs the to-be-classified special-purpose image to the machine learning model, and the machine learning model may obtain outputs in a corresponding quantity of the classification labels after processing the to-be-classified special-purpose image. The corresponding outputs represent the probabilities that the special-purpose image belongs to the corresponding classification labels.
  • Step S604. Determine a maximum probability in the obtained probabilities.
  • In an embodiment, the computer device may compare one by one the corresponding probabilities that the to-be-classified special-purpose image is classified to all classification labels, to determine the maximum probability in the foregoing probabilities.
  • Step S606. Determine that the classification fails in a case that the maximum probability is less than a threshold, and add the inputted special-purpose image to the unclassified special-purpose image set.
  • In an embodiment, the computer device may determine whether the classification is successful by comparing the maximum probability in the obtained probabilities with a classification threshold. In a case that the maximum probability is greater than the classification threshold, if the inputted special-purpose image is classified to the classification label corresponding to the maximum probability, the classification is successful. In a case that the maximum probability is less than the classification threshold, the classification fails, and the inputted special-purpose image is added to the unclassified special-purpose image set.
  • In the foregoing embodiment, in a case that the maximum probability is less than the threshold, it is determined that the classification fails, so that the inputted special-purpose image is added to the unclassified special-purpose image set, to effectively separate special-purpose images that do not belong to known categories, which helps find a new classification label efficiently, thereby further improving the classification capability of the machine learning model.
  • In an embodiment, step S504 includes: inputting the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • Optionally, the computer device may extract, after the special-purpose images in the special-purpose image set are inputted to the machine learning model obtained after the training is ended, image features outputted by the intermediate layer of the machine learning model. Clustering is performed according to the image features, and whether special-purpose images in the same clustering center conform to the definition of the same classification label is determined. If yes, whether the sum of Euclidean distances from the image features of the special-purpose images in the same clustering center to the clustering center is less than a preset value is determined. If yes, the clustering is successful; otherwise, the clustering fails. The special-purpose images that are in the same clustering center and that are clustered successfully construct the special-purpose image subset.
  • In an embodiment, a quantity of clustering centers set when the computer device performs clustering according to the image features may be 2 to 5. Optionally, the computer device may further implement visualization of a clustering process and a clustering result.
  • In the foregoing embodiment, after the training is ended, by using the obtained image features outputted by the intermediate layer of the machine learning model, characteristics of the corresponding special-purpose image can be well obtained, and during clustering, special-purpose images in the same category can be efficiently and accurately clustered to the same special-purpose image subset.
  • In an embodiment, the special-purpose image is an expression image, and the classification label is an expression classification label. The expression image is an image simulating a human expression, such as a cartoon character, a cartoon animal, or a real-person image, and may be used in a terminal to help people's daily communication and interaction. Optionally, the special-purpose image may be an expression image, for example, an expression image simulating a real-person expression and an expression image of a cartoon animal that are widely applied to an instant messaging application now. Correspondingly, the classification label may be an expression classification label corresponding to the expression image.
  • As shown in FIG. 7, in an optional embodiment, the machine learning model training method includes the following steps:
  • Step S702. Obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • Step S704. Obtain a representative special-purpose image corresponding to a classification label.
  • Step S706. After the representative special-purpose image is inputted to the machine learning model, obtain an image feature outputted by an intermediate layer of the machine learning model.
  • Step S708. After special-purpose images in a special-purpose image library are inputted to the machine learning model, obtain image features outputted by the intermediate layer of the machine learning model.
  • Step S710. Calculate similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • Step S712. Determine, according to the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image.
  • Step S714. Select a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as a sample of the special-purpose image corresponding to the classification label.
  • Step S716. Configure a category classified by the machine learning model to match with a type of the classification label.
  • Step S718. Input the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels.
  • Step S720. Determine a maximum probability in the obtained probabilities.
  • Step S722. Use a classification label corresponding to the maximum probability as an intermediate classification result of the sample of the special-purpose image.
  • Step S724. Remain model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjust model parameters of layers sorted behind according to the layer sequence in the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that the training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • Step S726. Input a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels.
  • Step S728. Determine a maximum probability in the obtained probabilities.
  • Step S730. Determine that the classification fails in a case that the maximum probability is less than a threshold, and add the inputted special-purpose image to an unclassified special-purpose image set.
  • Step S732. Obtain the unclassified special-purpose image set determined in a case that the machine learning model fails in classifying the to-be-classified special-purpose image.
  • Step S734. After the special-purpose images in the special-purpose image set are inputted to the machine learning model obtained after the training is ended, obtain the image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model.
  • Step S736. Perform clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain a special-purpose image subset.
  • Step S738. Determine a classification label corresponding to the special-purpose image subset.
  • Step S740. Retrain the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • For the implementation processes of the foregoing step S702 to step S740, reference may be made to the descriptions of the corresponding steps in the foregoing method embodiments, and details are not described herein again.
  • In the foregoing machine learning model training method, a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model. Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency. Moreover, performing training based on the machine learning model that includes the model parameter and that is obtained through training according to the general-purpose image training set can greatly reduce an over-fitting risk generated when a small amount of training data is used to train the model.
  • As shown in FIG. 8, in an embodiment, a machine learning model training apparatus 800 is provided, including: an obtaining module 801, a determining module 802, a classification module 803 and a training module 804.
  • The obtaining module 801 is configured to obtain a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set.
  • The determining module 802 is configured to determine a sample of a special-purpose image and a corresponding classification label.
  • The classification module 803 is configured to input the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result.
  • The training module 804 is configured to adjust the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continue training, and end the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • In the foregoing machine learning model training apparatus 800, a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model. Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • In an embodiment, the determining module 802 is further configured to obtain a representative special-purpose image corresponding to the classification label; determine, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and select a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • In the foregoing embodiment, special-purpose images that are similar to the representative special-purpose image corresponding to the classification label, and that have differences are selected as the samples of the special-purpose images to form training data together with the corresponding classification label, and each sample may try to provide useful information for training of the machine learning model, thereby improving the training efficiency of the machine learning model, and further reducing an over-fitting risk in the model training process.
  • In an embodiment, the determining module 802 is further configured to obtain, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtain, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculate the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • In the foregoing embodiment, the image feature outputted by the intermediate layer of the machine learning model can well reflect characteristics of the corresponding special-purpose image, so that a desirable sample of the special-purpose image can be selected, thereby further improving the training efficiency of the machine learning model, and ensuring the classification accuracy of the trained machine learning model.
  • As shown in FIG. 9, in an embodiment, the machine learning model training apparatus 800 further includes: a configuration module 805.
  • The configuration module 805 is configured to configure a category classified by the machine learning model to match with a type of the classification label.
  • The classification module 803 is further configured to: input the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels; determine a maximum probability in the obtained probabilities; and use a classification label corresponding to the maximum probability as the intermediate classification result of the sample of the special-purpose image.
  • In the foregoing embodiment, the categories classified by the machine learning model are configured to match with the types of the classification labels, so that the machine learning model can obtain outputs corresponding to the types of the classification labels, to obtain the probabilities that the sample of the special-purpose image belongs to all classification labels. An output corresponding to the maximum probability is selected as the intermediate classification result of the sample of the special-purpose image, and the difference between the intermediate classification result and the classification label corresponding to the sample of the special-purpose image is continuously reduced by adjusting the model parameter, so that the intermediate classification result is continuously close to the corresponding classification label, thereby improving the model classification accuracy.
  • In an embodiment, the machine learning model is a convolutional neural network model. The training module 804 is configured to: remain model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjust model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continue training, and end the training in a case that the training stop condition is met. The layers sorted front according to the layer sequence may be a specified quantity of front layers in the machine learning model, and the layers sorted behind according to the layer sequence may be layers behind the specified quantity of front layers in the machine learning model.
  • In the foregoing embodiment, in the machine learning model training process, remaining the model parameters of the layers sorted front according to the layer sequence in the machine learning model to be unchanged, and adjusting the model parameters of the layers sorted behind according to the layer sequence in the machine learning model can improve the model training efficiency.
  • In an embodiment, the training module 804 is further configured to obtain an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images; cluster the special-purpose image set, to obtain a special-purpose image subset; determine a classification label corresponding to the special-purpose image subset; and retrain the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • In the foregoing embodiment, the machine learning model trained by using the sample of the special-purpose image and the corresponding classification label is retrained by using updated training data, thereby further improving the classification accuracy of the machine learning model.
  • In an embodiment, the training module 804 is further configured to input a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels; determine a maximum probability in the obtained probabilities; and determine that the classification fails in a case that the maximum probability is less than a threshold, and add the inputted special-purpose image to the unclassified special-purpose image set.
  • In the foregoing embodiment, in a case that the maximum probability is less than the threshold, it is determined that the classification fails, so that the inputted special-purpose image is added to the unclassified special-purpose image set, to effectively separate special-purpose images that do not belong to known categories, which helps find a new classification label efficiently, thereby further improving the classification capability of the machine learning model.
  • In an embodiment, the training module 804 is further configured to input the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and perform clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • In the foregoing embodiment, after the training is ended, by using the obtained image features outputted by the intermediate layer of the machine learning model, characteristics of the corresponding special-purpose image can be well obtained, and during clustering, special-purpose images in the same category can be efficiently and accurately clustered to the same special-purpose image subset.
  • It may be clearly understood by a person skilled in the art that for convenience and brevity of description, for a working process of the foregoing apparatus and module, reference may be made to a corresponding process in the foregoing method embodiments, and details are not described herein again.
  • FIG. 10 is a schematic flowchart of an expression image classification method in an embodiment. This embodiment is described by using an example in which the method is applied to the computer device in FIG. 1. Referring to FIG. 10, the expression image classification method may include the following steps:
  • Step S1002. Input a to-be-classified expression image to a trained machine learning model, to obtain corresponding probabilities that the inputted expression image is classified to all classification labels, where the trained machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training method.
  • Optionally, the computer device inputs the to-be-classified expression image to the trained machine learning model, and the trained machine learning model may obtain outputs in a corresponding quantity of classification labels after processing the to-be-classified expression image. The corresponding outputs represent the probabilities that the expression image belongs to the corresponding classification labels. The trained machine learning model is obtained through training by using the sample of the expression image as the sample of the special-purpose image and by using the machine learning model training method.
  • Step S1004. Determine a maximum probability in the obtained probabilities.
  • In an embodiment, the computer device may compare one by one the corresponding probabilities that the to-be-classified expression image is classified to all classification labels, to determine the maximum probability in the foregoing probabilities.
  • Step S1006. Classify the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • In an embodiment, the computer device classifies the inputted expression image to the classification label corresponding to the maximum probability.
  • In the foregoing expression image classification method, an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • In addition, after the expression image classification method provided in this application is used to classify expression images in an instant messaging application, a user portrait can be built according to classification labels to which expression images sent by the user in the past belongs, so as to perform operations such as personalized recommendation or advertising for the user. The user portrait may be a labeled user model abstracted according to information such as a social attribute, a living habit, and a consuming behavior of the user.
  • As shown in FIG. 11, in an embodiment, an expression image classification apparatus 1100 is provided, including: a machine learning model 1101 and a classification module 1102.
  • The machine learning model 1101 is configured to input a to-be-classified expression image, and output corresponding probabilities that the to-be-classified expression image is classified to all classification labels, where the machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training apparatus.
  • The classification module 1102 is configured to determine a maximum probability in the obtained probabilities; and classify the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • In the foregoing expression image classification apparatus, an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • In an embodiment, the machine learning model training apparatus provided in this application may be implemented as a form of a computer program. The computer program may run on the computer device shown in FIG. 1, and the non-volatile storage medium of the computer device may store program modules forming the machine learning model training apparatus, such as the obtaining module 801 shown in FIG. 8. The program modules include computer readable instructions, and the computer readable instructions are used to cause the computer device to perform the steps in the application processing method of the embodiments of this application described in this specification. For example, through the machine learning model training apparatus 800 shown in FIG. 8, the computer device may obtain, by using the obtaining module 801, a machine learning model that includes a model parameter and that is obtained training according to a general-purpose image training set, input, by using the classification module 803, a sample of a special-purpose image determined by the determining module 802, to obtain an intermediate classification result, and then adjust the model parameter of the machine learning model according to a model training result by using the training module 804, to improve the classification accuracy of the machine learning model.
  • In an embodiment, a computer device is provided, including a memory and a processor. The memory stores computer readable instructions, and when executed by the processor, the computer readable instructions cause the processor to perform the following steps: obtaining a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set; determining a sample of a special-purpose image and a corresponding classification label; inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result; and adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • In an embodiment, the computer readable instructions may cause the processor to perform the following steps when performing the determining a sample of a special-purpose image and a corresponding classification label: obtaining a representative special-purpose image corresponding to the classification label; determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and selecting a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • In an embodiment, the computer readable instructions cause the processor to further perform the following steps after performing the step of obtaining a representative special-purpose image corresponding to the classification label: obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • In an embodiment, the computer readable instructions cause the processor to further perform the following steps before performing the step of inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result: configuring a category classified by the machine learning model to match with a type of the classification label; and when performing the inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result, the processor may perform the following steps: inputting the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and using a classification label corresponding to the maximum probability as the intermediate classification result of the sample of the special-purpose image.
  • In an embodiment, the computer readable instructions may cause the processor to perform the following steps when performing the adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met: remaining model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjusting model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that the training stop condition is met.
  • In an embodiment, the computer readable instructions cause the processor to perform the following steps: obtaining an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images; clustering the special-purpose image set, to obtain a special-purpose image subset; determining a classification label corresponding to the special-purpose image subset; and retraining the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • In an embodiment, the computer readable instructions cause the processor to perform the following steps: inputting a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and determining that the classification fails in a case that the maximum probability is less than a threshold, and adding the inputted special-purpose image to the unclassified special-purpose image set.
  • In an embodiment, the computer readable instructions may cause the processor to perform the following steps when clustering the special-purpose image set, to obtain a special-purpose image subset: inputting the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • The foregoing computer device obtains a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set, and uses a sample of a special-purpose image and a corresponding classification label to train the machine learning model. Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • In an embodiment, a computer device is provided, including a memory and a processor. The memory stores computer readable instructions, and when executed by the processor, the computer readable instructions cause the processor to perform the following steps: inputting a to-be-classified expression image to a trained machine learning model, to obtain corresponding probabilities that the inputted expression image is classified to all classification labels, where the trained machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training method; determining a maximum probability in the obtained probabilities; and classifying the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • The foregoing computer device inputs an expression image to a trained machine learning model, determines a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels, and classifies the expression image to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • A computer readable storage medium stores computer readable instructions. When executed by a processor, the computer readable instructions implement the following steps: obtaining a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set; determining a sample of a special-purpose image and a corresponding classification label; inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result; and adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met, to obtain the machine learning model with the adjusted model parameter.
  • In an embodiment, the computer readable instructions may cause the processor to perform the following steps when performing the determining a sample of a special-purpose image and a corresponding classification label: obtaining a representative special-purpose image corresponding to the classification label; determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, special-purpose images that are in the special-purpose image library and similar to the representative special-purpose image; and selecting a special-purpose image meeting a difference condition from the representative special-purpose image and the similar special-purpose images as the sample of the special-purpose image corresponding to the classification label.
  • In an embodiment, the computer readable instructions cause the processor to further perform the following steps after performing the step of obtaining a representative special-purpose image corresponding to the classification label: obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model; obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by the intermediate layer of the machine learning model; and calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
  • In an embodiment, the computer readable instructions cause the processor to further perform the following steps before performing the step of inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result: configuring a category classified by the machine learning model to match with a type of the classification label; and when performing the inputting the sample of the special-purpose image to the machine learning model, to obtain an intermediate classification result, the processor may perform the following steps: inputting the sample of the special-purpose image to the machine learning model, to obtain corresponding probabilities that the sample of the special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and using a classification label corresponding to the maximum probability as the intermediate classification result of the sample of the special-purpose image.
  • In an embodiment, the computer readable instructions may cause the processor to perform the following steps when performing the adjusting the model parameter of the machine learning model according to a difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that a training stop condition is met: remaining model parameters of layers sorted front according to a layer sequence in the machine learning model to be unchanged, adjusting model parameters of layers sorted behind according to the layer sequence in the machine learning model according to the difference between the intermediate classification result and the classification label, continuing training, and ending the training in a case that the training stop condition is met.
  • In an embodiment, the computer readable instructions cause the processor to perform the following steps: obtaining an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying to-be-classified special-purpose images; clustering the special-purpose image set, to obtain a special-purpose image subset; determining a classification label corresponding to the special-purpose image subset; and retraining the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
  • In an embodiment, the computer readable instructions cause the processor to perform the following steps: inputting a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels; determining a maximum probability in the obtained probabilities; and determining that the classification fails in a case that the maximum probability is less than a threshold, and adding the inputted special-purpose image to the unclassified special-purpose image set.
  • In an embodiment, the computer readable instructions may cause the processor to perform the following steps when clustering the special-purpose image set, to obtain a special-purpose image subset: inputting the special-purpose images in the special-purpose image set to the machine learning model obtained after the training is ended, to obtain image features of the corresponding special-purpose images outputted by the intermediate layer of the machine learning model; and performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
  • In the foregoing computer readable storage medium, a machine learning model that includes a model parameter and that is obtained through training according to a general-purpose image training set is obtained, and a sample of a special-purpose image and a corresponding classification label are used to train the machine learning model. Knowledge trained according to the general-purpose image training set is migrated to a process of training according to the sample of the special-purpose image, and by adjusting the model parameter, a machine learning model with relatively high classification accuracy for the special-purpose image can be quickly trained, thereby improving the training efficiency.
  • A computer readable storage medium stores computer readable instructions, and when executed by a processor, the computer readable instructions implement the following steps: inputting a to-be-classified expression image to a trained machine learning model, to obtain corresponding probabilities that the inputted expression image is classified to all classification labels, where the trained machine learning model is obtained through training by using a sample of the expression image as a sample of a special-purpose image and by using the machine learning model training method; determining a maximum probability in the obtained probabilities; and classifying the to-be-classified expression image to a classification label corresponding to the maximum probability.
  • In the foregoing computer readable storage medium, an expression image is inputted to a trained machine learning model, a maximum probability in corresponding probabilities that the inputted expression image is classified to all classification labels is determined, and the expression image is classified to a classification label corresponding to the maximum probability, so that the machine learning model classifies the expression image, and selects the classification label corresponding to the maximum probability as a classification result, thereby improving the classification efficiency and accuracy of the expression image classification.
  • This application further provides a computer device. The computer device includes a processor and a memory. The memory stores at least one instruction, at least one program, and a code set or instruction set, and the at least one instruction, the at least one program, and the code set or instruction set are loaded and executed by the processor to implement the machine learning model training method provided in the foregoing method embodiment or the expression image classification method provided in the foregoing method embodiment.
  • This application further provides a computer readable storage medium. The storage medium stores at least one instruction, at least one program, and a code set or instruction set, and the at least one instruction, the at least one program, and the code set or instruction set are loaded and executed by a processor to implement the machine learning model training method provided in the foregoing method embodiment or the expression image classification method provided in the foregoing method embodiment.
  • A person of ordinary skill in the art may understand that all or some of the processes of the methods in the foregoing embodiments may be implemented by a computer program instructing relevant hardware. The program may be stored in a non-volatile computer-readable storage medium. When the program is run, the processes of the foregoing methods in the embodiments are performed. The storage medium may be a magnetic disc, an optical disc, a read-only memory (ROM), or the like.
  • Technical features in the foregoing embodiments may be combined randomly. For the brevity of description, not all possible combinations of various technical features in the foregoing embodiments are described. However, as long as combinations of these technical features do not contradict each other, it needs to be considered that the combinations all fall within the scope of this specification.
  • The foregoing embodiments merely describe several implementations of this application, which are described specifically and in detail, and therefore cannot be construed as a limitation to the patent scope of the present disclosure. Various changes and improvements may further be made by a person of ordinary skill in the art without departing from the idea of this application, and these changes and improvements all fall within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the appended claims.

Claims (20)

What is claimed is:
1. A machine learning model training method, applied to a computing device having one or more processors and memory storing a plurality of programs to be executed by the one or more processors and the method comprising:
obtaining a machine learning model through training according to a general-purpose image training set, wherein the machine learning model comprises one or more model parameters and that is obtained;
determining a sample set of special-purpose images and a corresponding classification label;
inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result for the corresponding classification label;
adjusting the model parameters of the machine learning model according to a difference between the intermediate classification result and the classification label; and
repeating the inputting and adjusting steps until that a training stop condition is met, to obtain the machine learning model with the adjusted model parameters.
2. The method according to claim 1, wherein the determining a sample set of special-purpose images and a corresponding classification label comprises:
obtaining a representative special-purpose image corresponding to the classification label;
determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, a set of special-purpose images that are similar to the representative special-purpose image; and
selecting one or more special-purpose images meeting a predefined difference condition from the representative special-purpose image and the set of similar special-purpose images as the samples of the special-purpose images corresponding to the classification label.
3. The method according to claim 2, further comprising:
obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model;
obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by an intermediate layer of the machine learning model; and
calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
4. The method according to claim 1, further comprising:
before inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result:
configuring a category classified by the machine learning model to match with a type of the classification label; and
wherein the inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result further comprises:
inputting the sample set of special-purpose images to the machine learning model, to obtain corresponding probabilities that the sample set of special-purpose images is classified to all classification labels;
determining a maximum probability in the obtained probabilities; and
using a classification label corresponding to the maximum probability as the intermediate classification result of the sample set of special-purpose images.
5. The method according to claim 1, wherein the machine learning model is a convolutional neural network model; and
the adjusting the model parameters of the machine learning model according to a difference between the intermediate classification result and the classification label further comprises:
while keeping model parameters of a specified quantity of front layers in the machine learning model to be unchanged, adjusting model parameters of layers behind the specified quantity of front layers in the machine learning model according to the difference between the intermediate classification result and the classification label until the training stop condition is met.
6. The method according to claim 1, further comprising:
obtaining an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying the unclassified special-purpose images;
clustering the special-purpose image set, to obtain a special-purpose image subset;
determining a classification label corresponding to the special-purpose image subset; and
retraining the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
7. The method according to claim 6, further comprising:
inputting a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels;
determining a maximum probability in the obtained probabilities; and
determining that the classification fails in a case that the maximum probability is less than a threshold, and adding the inputted special-purpose image to the unclassified special-purpose image set.
8. The method according to claim 6, wherein the clustering the special-purpose image set, to obtain a special-purpose image subset comprises:
obtaining, after the special-purpose images in the special-purpose image set are inputted to the machine learning model obtained after the training is ended, image features of corresponding special-purpose images outputted by an intermediate layer of the machine learning model; and
performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
9. The method according to claim 1, wherein the special-purpose image is an expression image; and the classification label is an expression classification label.
10. The method according to claim 1, wherein the training stop condition comprises:
a quantity of times of adjusting the model parameter and continuing the training reaches a preset quantity of iterations, or a classification performance index of the machine learning model with the adjusted model parameter reaches a preset index.
11. A computing device comprising one or more processors, memory coupled to the one or more processors and a plurality of programs stored in the memory that, when executed by the one or more processors, cause the computing device to perform a plurality of operations comprising:
obtaining a machine learning model through training according to a general-purpose image training set, wherein the machine learning model comprises one or more model parameters and that is obtained;
determining a sample set of special-purpose images and a corresponding classification label;
inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result for the corresponding classification label;
adjusting the model parameters of the machine learning model according to a difference between the intermediate classification result and the classification label; and
repeating the inputting and adjusting steps until that a training stop condition is met, to obtain the machine learning model with the adjusted model parameters.
12. The computing device according to claim 11, wherein the determining a sample set of special-purpose images and a corresponding classification label comprises:
obtaining a representative special-purpose image corresponding to the classification label;
determining, according to similarities between the representative special-purpose image and special-purpose images in a special-purpose image library, a set of special-purpose images that are similar to the representative special-purpose image; and
selecting one or more special-purpose images meeting a predefined difference condition from the representative special-purpose image and the set of similar special-purpose images as the samples of the special-purpose images corresponding to the classification label.
13. The computing device according to claim 12, wherein the plurality of operations further comprise:
obtaining, after the representative special-purpose image is inputted to the machine learning model, an image feature outputted by an intermediate layer of the machine learning model;
obtaining, after the special-purpose images in the special-purpose image library are inputted to the machine learning model, image features outputted by an intermediate layer of the machine learning model; and
calculating the similarities between the representative special-purpose image and the special-purpose images in the special-purpose image library according to the image feature of the representative special-purpose image and the image features of the special-purpose images in the special-purpose image library.
14. The computing device according to claim 11, wherein the plurality of operations further comprise:
before inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result:
configuring a category classified by the machine learning model to match with a type of the classification label; and
wherein the inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result further comprises:
inputting the sample set of special-purpose images to the machine learning model, to obtain corresponding probabilities that the sample set of special-purpose images is classified to all classification labels;
determining a maximum probability in the obtained probabilities; and
using a classification label corresponding to the maximum probability as the intermediate classification result of the sample set of special-purpose images.
15. The computing device according to claim 11, wherein the machine learning model is a convolutional neural network model; and
the adjusting the model parameters of the machine learning model according to a difference between the intermediate classification result and the classification label further comprises:
while keeping model parameters of a specified quantity of front layers in the machine learning model to be unchanged, adjusting model parameters of layers behind the specified quantity of front layers in the machine learning model according to the difference between the intermediate classification result and the classification label until the training stop condition is met.
16. The computing device according to claim 11, wherein the plurality of operations further comprise:
obtaining an unclassified special-purpose image set determined in a case that the machine learning model fails in classifying the unclassified special-purpose images;
clustering the special-purpose image set, to obtain a special-purpose image subset;
determining a classification label corresponding to the special-purpose image subset; and
retraining the machine learning model according to the special-purpose image subset and the corresponding classification label, and the sample of the special-purpose image and the corresponding classification label.
17. The computing device according to claim 16, wherein the plurality of operations further comprise:
inputting a to-be-classified special-purpose image to the machine learning model, to obtain corresponding probabilities that the inputted special-purpose image is classified to all classification labels;
determining a maximum probability in the obtained probabilities; and
determining that the classification fails in a case that the maximum probability is less than a threshold, and adding the inputted special-purpose image to the unclassified special-purpose image set.
18. The computing device according to claim 16, wherein the clustering the special-purpose image set, to obtain a special-purpose image subset comprises:
obtaining, after the special-purpose images in the special-purpose image set are inputted to the machine learning model obtained after the training is ended, image features of corresponding special-purpose images outputted by an intermediate layer of the machine learning model; and
performing clustering according to the image features of the special-purpose images in the special-purpose image set, to obtain the special-purpose image subset.
19. The computing device according to claim 11, wherein the training stop condition comprises:
a quantity of times of adjusting the model parameter and continuing the training reaches a preset quantity of iterations, or a classification performance index of the machine learning model with the adjusted model parameter reaches a preset index.
20. A non-transitory computer readable storage medium storing a plurality of machine readable instructions in connection with a computing device having one or more processors, wherein the plurality of machine readable instructions, when executed by the one or more processors, cause the computing device to perform a plurality of operations including:
obtaining a machine learning model through training according to a general-purpose image training set, wherein the machine learning model comprises one or more model parameters and that is obtained;
determining a sample set of special-purpose images and a corresponding classification label;
inputting the sample set of special-purpose images to the machine learning model, to obtain an intermediate classification result for the corresponding classification label;
adjusting the model parameters of the machine learning model according to a difference between the intermediate classification result and the classification label; and
repeating the inputting and adjusting steps until that a training stop condition is met, to obtain the machine learning model with the adjusted model parameters.
US16/735,236 2017-07-12 2020-01-06 Machine learning model training method and device, and expression image classification method and device Active 2039-09-25 US11537884B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/969,631 US20230037908A1 (en) 2017-07-12 2022-10-19 Machine learning model training method and device, and expression image classification method and device

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN201710566325.XA CN108304936B (en) 2017-07-12 2017-07-12 Machine learning model training method and device, and expression image classification method and device
CN201710566325.X 2017-07-12
PCT/CN2018/090676 WO2019011093A1 (en) 2017-07-12 2018-06-11 Machine learning model training method and apparatus, and facial expression image classification method and apparatus

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/090676 Continuation WO2019011093A1 (en) 2017-07-12 2018-06-11 Machine learning model training method and apparatus, and facial expression image classification method and apparatus

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/969,631 Continuation US20230037908A1 (en) 2017-07-12 2022-10-19 Machine learning model training method and device, and expression image classification method and device

Publications (2)

Publication Number Publication Date
US20200143248A1 true US20200143248A1 (en) 2020-05-07
US11537884B2 US11537884B2 (en) 2022-12-27

Family

ID=62872633

Family Applications (2)

Application Number Title Priority Date Filing Date
US16/735,236 Active 2039-09-25 US11537884B2 (en) 2017-07-12 2020-01-06 Machine learning model training method and device, and expression image classification method and device
US17/969,631 Pending US20230037908A1 (en) 2017-07-12 2022-10-19 Machine learning model training method and device, and expression image classification method and device

Family Applications After (1)

Application Number Title Priority Date Filing Date
US17/969,631 Pending US20230037908A1 (en) 2017-07-12 2022-10-19 Machine learning model training method and device, and expression image classification method and device

Country Status (3)

Country Link
US (2) US11537884B2 (en)
CN (1) CN108304936B (en)
WO (1) WO2019011093A1 (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914908A (en) * 2020-07-14 2020-11-10 浙江大华技术股份有限公司 Image recognition model training method, image recognition method and related equipment
CN112101542A (en) * 2020-07-24 2020-12-18 北京沃东天骏信息技术有限公司 Training method and device of machine learning model, and face recognition method and device
CN112132239A (en) * 2020-11-24 2020-12-25 北京远鉴信息技术有限公司 Training method, device, equipment and storage medium
US20210052135A1 (en) * 2018-10-30 2021-02-25 Tencent Technology (Shenzhen) Company Limited Endoscopic image processing method and system, and computer device
CN112861994A (en) * 2021-03-12 2021-05-28 中国科学院自动化研究所 Intelligent gastric ring cell cancer image classification system based on Unet migration learning
CN112988733A (en) * 2021-04-16 2021-06-18 北京妙医佳健康科技集团有限公司 Method and device for improving and enhancing data quality
WO2021120752A1 (en) * 2020-07-28 2021-06-24 平安科技(深圳)有限公司 Region-based self-adaptive model training method and device, image detection method and device, and apparatus and medium
CN113033689A (en) * 2021-04-07 2021-06-25 新疆爱华盈通信息技术有限公司 Image classification method and device, electronic equipment and storage medium
US20210201090A1 (en) * 2019-12-30 2021-07-01 Alibaba Group Holding Limited Method and apparatus for image processing and image classification
CN113298791A (en) * 2021-05-31 2021-08-24 中电福富信息科技有限公司 Image detection method of mixed cartoon based on deep learning
CN113469249A (en) * 2021-06-30 2021-10-01 阿波罗智联(北京)科技有限公司 Image classification model training method, classification method, road side equipment and cloud control platform
CN113516251A (en) * 2021-08-05 2021-10-19 上海高德威智能交通系统有限公司 Machine learning system and model training method
TWI746095B (en) * 2020-05-28 2021-11-11 旺宏電子股份有限公司 Classification model training using diverse training source and inference engine using same
CN113723536A (en) * 2021-09-02 2021-11-30 国网智能科技股份有限公司 Power inspection target identification method and system
CN113792807A (en) * 2021-09-16 2021-12-14 平安科技(深圳)有限公司 Skin disease classification model training method, system, medium and electronic device
US11216693B2 (en) * 2018-08-09 2022-01-04 Olympus Soft Imaging Solutions Gmbh Method for providing at least one evaluation method for samples
WO2024059257A1 (en) * 2022-09-16 2024-03-21 Nec Laboratories America, Inc. Hybrid-conditional anomaly detection

Families Citing this family (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109359793B (en) * 2018-08-03 2020-11-17 创新先进技术有限公司 Prediction model training method and device for new scene
CN109242034B (en) * 2018-09-21 2020-09-15 阿里巴巴集团控股有限公司 Decision tree generation method and device
CN109840588B (en) * 2019-01-04 2023-09-08 平安科技(深圳)有限公司 Neural network model training method, device, computer equipment and storage medium
CN111786802B (en) * 2019-04-03 2023-07-04 北京嘀嘀无限科技发展有限公司 Event detection method and device
CN111652260B (en) * 2019-04-30 2023-06-20 上海铼锶信息技术有限公司 Face clustering sample number selection method and system
CN110232403B (en) * 2019-05-15 2024-02-27 腾讯科技(深圳)有限公司 Label prediction method and device, electronic equipment and medium
CN110288089B (en) * 2019-06-28 2021-07-09 北京百度网讯科技有限公司 Method and apparatus for transmitting information
CN110334763B (en) * 2019-07-04 2021-07-23 北京字节跳动网络技术有限公司 Model data file generation method, model data file generation device, model data file identification device, model data file generation apparatus, model data file identification apparatus, and model data file identification medium
CN110473226B (en) * 2019-07-18 2022-03-01 上海联影智能医疗科技有限公司 Training method of image processing network, computer device and readable storage medium
CN112581250B (en) * 2019-09-30 2023-12-29 深圳无域科技技术有限公司 Model generation method, device, computer equipment and storage medium
CN110945522B (en) * 2019-10-25 2023-09-12 中新智擎科技有限公司 Learning state judging method and device and intelligent robot
CN110866564B (en) * 2019-11-22 2023-04-25 上海携程国际旅行社有限公司 Season classification method, system, electronic device and medium for multiple semi-supervised images
CN111178446B (en) 2019-12-31 2023-08-04 歌尔股份有限公司 Optimization method and device of target classification model based on neural network
CN111209946B (en) * 2019-12-31 2024-04-30 上海联影智能医疗科技有限公司 Three-dimensional image processing method, image processing model training method and medium
CN111667559B (en) * 2020-05-27 2022-08-02 西北工业大学 Polymorphic human face emotion generation method based on deep migration network
CN111652320B (en) * 2020-06-10 2022-08-09 创新奇智(上海)科技有限公司 Sample classification method and device, electronic equipment and storage medium
CN111723856B (en) * 2020-06-11 2023-06-09 广东浪潮大数据研究有限公司 Image data processing method, device, equipment and readable storage medium
CN111709485B (en) * 2020-06-19 2023-10-31 腾讯科技(深圳)有限公司 Medical image processing method, device and computer equipment
CN111970335B (en) * 2020-07-30 2021-09-07 腾讯科技(深圳)有限公司 Information recommendation method and device and storage medium
CN111814913A (en) * 2020-08-20 2020-10-23 深圳市欢太科技有限公司 Training method and device for image classification model, electronic equipment and storage medium
CN112418276A (en) * 2020-11-03 2021-02-26 北京五八信息技术有限公司 Processing method and device of classifier
CN112650870A (en) * 2020-12-30 2021-04-13 北京天广汇通科技有限公司 Method for training picture ordering model, and method and device for picture ordering
CN112949693B (en) * 2021-02-02 2024-04-26 北京嘀嘀无限科技发展有限公司 Training method of image classification model, image classification method, device and equipment
CN112949740B (en) * 2021-03-17 2022-11-25 重庆邮电大学 Small sample image classification method based on multilevel measurement
CN113052246B (en) * 2021-03-30 2023-08-04 北京百度网讯科技有限公司 Method and related apparatus for training classification model and image classification
CN114139729B (en) * 2022-01-29 2022-05-10 北京易真学思教育科技有限公司 Machine learning model training method and device, and text recognition method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170124428A1 (en) * 2015-11-04 2017-05-04 Samsung Electronics Co., Ltd. Authentication method and apparatus, and method and apparatus for training a recognizer

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5075924B2 (en) * 2010-01-13 2012-11-21 株式会社日立製作所 Classifier learning image generation program, method, and system
CN104111931A (en) * 2013-04-17 2014-10-22 中国科学院声学研究所 Protocol automatic identification method and construction method of classifier used in protocol automatic identification
CN103489009B (en) * 2013-09-17 2016-08-17 北方信息控制集团有限公司 Mode identification method based on adaptive correction neutral net
US9361666B2 (en) * 2013-10-07 2016-06-07 Adobe Systems Incorporated Learning user preferences for photo adjustments
CN106156807B (en) * 2015-04-02 2020-06-02 华中科技大学 Training method and device of convolutional neural network model
CN104850890B (en) * 2015-04-14 2017-09-26 西安电子科技大学 Instance-based learning and the convolutional neural networks parameter regulation means of Sadowsky distributions
CN106127232B (en) * 2016-06-16 2020-01-14 北京市商汤科技开发有限公司 Convolutional neural network training method and system, object classification method and classifier
CN106228185B (en) * 2016-07-20 2019-10-15 武汉盈力科技有限公司 A kind of general image classifying and identifying system neural network based and method
CN106295566B (en) * 2016-08-10 2019-07-09 北京小米移动软件有限公司 Facial expression recognizing method and device
US9947102B2 (en) * 2016-08-26 2018-04-17 Elekta, Inc. Image segmentation using neural network method
CN106897746B (en) * 2017-02-28 2020-03-03 北京京东尚科信息技术有限公司 Data classification model training method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170124428A1 (en) * 2015-11-04 2017-05-04 Samsung Electronics Co., Ltd. Authentication method and apparatus, and method and apparatus for training a recognizer

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11216693B2 (en) * 2018-08-09 2022-01-04 Olympus Soft Imaging Solutions Gmbh Method for providing at least one evaluation method for samples
US20210052135A1 (en) * 2018-10-30 2021-02-25 Tencent Technology (Shenzhen) Company Limited Endoscopic image processing method and system, and computer device
US11849914B2 (en) * 2018-10-30 2023-12-26 Tencent Technology (Shenzhen) Company Limited Endoscopic image processing method and system, and computer device
US20210201090A1 (en) * 2019-12-30 2021-07-01 Alibaba Group Holding Limited Method and apparatus for image processing and image classification
TWI746095B (en) * 2020-05-28 2021-11-11 旺宏電子股份有限公司 Classification model training using diverse training source and inference engine using same
US11775822B2 (en) 2020-05-28 2023-10-03 Macronix International Co., Ltd. Classification model training using diverse training source and inference engine using same
CN111914908A (en) * 2020-07-14 2020-11-10 浙江大华技术股份有限公司 Image recognition model training method, image recognition method and related equipment
CN112101542A (en) * 2020-07-24 2020-12-18 北京沃东天骏信息技术有限公司 Training method and device of machine learning model, and face recognition method and device
WO2021120752A1 (en) * 2020-07-28 2021-06-24 平安科技(深圳)有限公司 Region-based self-adaptive model training method and device, image detection method and device, and apparatus and medium
CN112132239A (en) * 2020-11-24 2020-12-25 北京远鉴信息技术有限公司 Training method, device, equipment and storage medium
CN112861994A (en) * 2021-03-12 2021-05-28 中国科学院自动化研究所 Intelligent gastric ring cell cancer image classification system based on Unet migration learning
CN113033689A (en) * 2021-04-07 2021-06-25 新疆爱华盈通信息技术有限公司 Image classification method and device, electronic equipment and storage medium
CN112988733B (en) * 2021-04-16 2021-08-27 北京妙医佳健康科技集团有限公司 Method and device for improving and enhancing data quality
CN112988733A (en) * 2021-04-16 2021-06-18 北京妙医佳健康科技集团有限公司 Method and device for improving and enhancing data quality
CN113298791A (en) * 2021-05-31 2021-08-24 中电福富信息科技有限公司 Image detection method of mixed cartoon based on deep learning
CN113469249A (en) * 2021-06-30 2021-10-01 阿波罗智联(北京)科技有限公司 Image classification model training method, classification method, road side equipment and cloud control platform
CN113516251A (en) * 2021-08-05 2021-10-19 上海高德威智能交通系统有限公司 Machine learning system and model training method
CN113723536A (en) * 2021-09-02 2021-11-30 国网智能科技股份有限公司 Power inspection target identification method and system
CN113792807A (en) * 2021-09-16 2021-12-14 平安科技(深圳)有限公司 Skin disease classification model training method, system, medium and electronic device
WO2024059257A1 (en) * 2022-09-16 2024-03-21 Nec Laboratories America, Inc. Hybrid-conditional anomaly detection

Also Published As

Publication number Publication date
US11537884B2 (en) 2022-12-27
CN108304936B (en) 2021-11-16
WO2019011093A1 (en) 2019-01-17
CN108304936A (en) 2018-07-20
US20230037908A1 (en) 2023-02-09

Similar Documents

Publication Publication Date Title
US11537884B2 (en) Machine learning model training method and device, and expression image classification method and device
US11741361B2 (en) Machine learning-based network model building method and apparatus
US20190258925A1 (en) Performing attribute-aware based tasks via an attention-controlled neural network
US11587234B2 (en) Generating class-agnostic object masks in digital images
WO2022057658A1 (en) Method and apparatus for training recommendation model, and computer device and storage medium
US11501161B2 (en) Method to explain factors influencing AI predictions with deep neural networks
WO2017161233A1 (en) Deep multi-task representation learning
CN109063719B (en) Image classification method combining structure similarity and class information
WO2017176356A2 (en) Partitioned machine learning architecture
WO2019232772A1 (en) Systems and methods for content identification
CN111667022A (en) User data processing method and device, computer equipment and storage medium
CN111898703B (en) Multi-label video classification method, model training method, device and medium
WO2022042043A1 (en) Machine learning model training method and apparatus, and electronic device
WO2022228425A1 (en) Model training method and apparatus
CN109086653A (en) Handwriting model training method, hand-written character recognizing method, device, equipment and medium
Jiang et al. Variational deep embedding: A generative approach to clustering
CN110705489B (en) Training method and device for target recognition network, computer equipment and storage medium
Yang et al. An ensemble classification algorithm for convolutional neural network based on AdaBoost
CN112395979A (en) Image-based health state identification method, device, equipment and storage medium
CN108492301A (en) A kind of Scene Segmentation, terminal and storage medium
US11610393B2 (en) Knowledge distillation for neural networks using multiple augmentation strategies
CN113590863A (en) Image clustering method and device and computer readable storage medium
CN114298122A (en) Data classification method, device, equipment, storage medium and computer program product
CN112668482A (en) Face recognition training method and device, computer equipment and storage medium
CN112749737A (en) Image classification method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
FEPP Fee payment procedure

Free format text: ENTITY STATUS SET TO UNDISCOUNTED (ORIGINAL EVENT CODE: BIG.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

AS Assignment

Owner name: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED, CHINA

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:LIU, LONGPO;WAN, WEI;CHEN, QIAN;REEL/FRAME:051800/0082

Effective date: 20200106

STPP Information on status: patent application and granting procedure in general

Free format text: DOCKETED NEW CASE - READY FOR EXAMINATION

STPP Information on status: patent application and granting procedure in general

Free format text: NON FINAL ACTION MAILED

STPP Information on status: patent application and granting procedure in general

Free format text: RESPONSE TO NON-FINAL OFFICE ACTION ENTERED AND FORWARDED TO EXAMINER

STPP Information on status: patent application and granting procedure in general

Free format text: NOTICE OF ALLOWANCE MAILED -- APPLICATION RECEIVED IN OFFICE OF PUBLICATIONS

STPP Information on status: patent application and granting procedure in general

Free format text: PUBLICATIONS -- ISSUE FEE PAYMENT VERIFIED

STCF Information on status: patent grant

Free format text: PATENTED CASE