CN112241752A - Model training method, data processing method, classification method, device and equipment - Google Patents

Model training method, data processing method, classification method, device and equipment Download PDF

Info

Publication number
CN112241752A
CN112241752A CN201910650980.2A CN201910650980A CN112241752A CN 112241752 A CN112241752 A CN 112241752A CN 201910650980 A CN201910650980 A CN 201910650980A CN 112241752 A CN112241752 A CN 112241752A
Authority
CN
China
Prior art keywords
classifier
data
probability
category
training sample
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.)
Pending
Application number
CN201910650980.2A
Other languages
Chinese (zh)
Inventor
张亚斌
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201910650980.2A priority Critical patent/CN112241752A/en
Publication of CN112241752A publication Critical patent/CN112241752A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/285Selection of pattern recognition techniques, e.g. of classifiers in a multi-classifier system
    • 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

Landscapes

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

Abstract

The embodiment of the invention provides a model training method, a data processing method, a classification method, a device and equipment, wherein the classification method comprises the following steps: acquiring data in a target domain; performing feature extraction on data in a target domain through a feature extractor, wherein the extracted features have consistent data distribution in a source domain and the target domain; and inputting the extracted features into a classifier so as to determine the category corresponding to the data in the target domain through the classifier. The features extracted by the feature extractor have consistent data distribution on the source domain and the target domain after training, so that when the extracted features are input into the classifier, the classifier can accurately determine the category corresponding to the data of the target domain.

Description

Model training method, data processing method, classification method, device and equipment
Technical Field
The invention relates to the technical field of internet, in particular to a model training method, a data processing method, a classification method, a device and equipment.
Background
In machine learning problems, it is often assumed that the data distributions of source domain data (also known colloquially as a training set) and target domain data (also colloquially as a test set) are consistent, a model is trained on the source domain data, and a test is performed on the target domain data. However, in practice, the test scenario is often uncontrollable, the data distribution of the target domain data and the source domain data has a large difference, and an over-fitting problem occurs: the model is not ideal in target domain data.
With respect to a common classification problem, such as the need to identify the class to which an object in an image belongs, the undesirable effect of a model on target domain data is represented as: the classification result of a model trained based on a large number of training images of labeled classes on unlabeled test images is not accurate.
Disclosure of Invention
The embodiment of the invention provides a model training method, a data processing method, a classification method, a device and equipment, which are used for realizing accurate classification of target domain data.
In a first aspect, an embodiment of the present invention provides a classification method, where the method includes:
acquiring data in a target domain;
performing feature extraction on the data through a feature extractor, wherein the extracted features have consistent data distribution in a source domain and the target domain;
and inputting the extracted features into a classifier so as to determine the category corresponding to the data through the classifier.
In a second aspect, an embodiment of the present invention provides a classification apparatus, including:
the data acquisition module is used for acquiring data in a target domain;
the characteristic extraction module is used for extracting the characteristics of the data through a characteristic extractor, wherein the extracted characteristics have consistent data distribution in a source domain and the target domain;
and the classification judging module is used for inputting the extracted features into a classifier so as to determine the category corresponding to the data through the classifier.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a memory, where the memory stores executable code, and when the executable code is executed by the processor, the processor is enabled to implement at least the classification method in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to implement at least the classification method of the first aspect.
In a fifth aspect, an embodiment of the present invention provides a data processing method, where the method includes:
acquiring data in a target domain;
performing feature extraction on the data through a feature extractor, wherein the extracted features have consistent data distribution in a source domain and the target domain;
inputting the extracted features into a classifier so as to determine a category corresponding to the data through the classifier;
and processing the data according to the category corresponding to the data.
In a sixth aspect, an embodiment of the present invention provides a data processing apparatus, including:
the acquisition module is used for acquiring data in a target domain;
the classification module is used for extracting the features of the data through a feature extractor, inputting the extracted features into a classifier, and determining the category corresponding to the data through the classifier, wherein the extracted features have consistent data distribution in a source domain and a target domain;
and the processing module is used for processing the data according to the category corresponding to the data.
In a seventh aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a memory, where the memory stores executable code, and when the executable code is executed by the processor, the processor is enabled to implement at least the data processing method in the fifth aspect.
In an eighth aspect, the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an electronic device, the processor is enabled to implement at least the data processing method in the fifth aspect.
In a ninth aspect, an embodiment of the present invention provides a data processing method, where the method includes:
receiving a first picture;
extracting features of the first picture;
determining the category of the first picture according to the extracted features;
outputting the category of the first picture;
wherein the features extracted from the second picture with the category label have a consistent data distribution with the features extracted from the first picture.
In a tenth aspect, an embodiment of the present invention provides a model training method, where the method includes:
acquiring source domain data and target domain data serving as training samples;
training a first classifier and a second classifier based on the source domain data and the target domain data to enable the first classifier and the second classifier to domain classify the source domain data and the target domain data;
training a feature extractor with a data class as a target, which makes the first classifier and the second classifier unable to distinguish the source domain data from the target domain data;
the model includes the feature extractor and at least one of the first classifier and the second classifier.
Training a feature extractor aiming at the data types of the source domain data and the target domain data which cannot be distinguished by the first classifier and the second classifier, namely training the feature extractor aiming at the data features corresponding to the same types of the source domain data and the target domain data learned by the feature extractor.
In the embodiment of the invention, the source domain refers to the field where the training sample is located and has rich supervision information, namely the training sample is labeled by a category, the target domain is the field where the test sample is located, and the test sample is not labeled by the category. The source domain and the target domain often have the same classification task, i.e. the data categories corresponding to the source domain and the target domain can be considered as identical, but the data distribution of the two domains is different. For data in a target domain which needs to be classified and identified, feature extraction can be performed on the data through a feature extractor obtained through training, and the features extracted by the feature extractor have consistent data distribution on a source domain and the target domain through training, so that when the extracted features are input into a classifier, the classifier can accurately determine the category corresponding to the data in the target domain.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart of a classification method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the resistance training provided by the embodiment of the present invention;
FIG. 3 is a flowchart of a method for training a classifier according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a network structure of a model training process according to an embodiment of the present invention;
FIG. 5 is a flowchart of a training method of a domain classifier according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a training process of a domain classifier according to an embodiment of the present invention;
FIG. 7 is a flowchart of a training method for a feature extractor according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of a training process of a feature extractor according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a sorting apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an electronic device corresponding to the classification device provided in the embodiment shown in fig. 9.
FIG. 11 is a flowchart of a data processing method according to an embodiment of the present invention;
FIG. 12 is a diagram illustrating a data processing scenario according to an embodiment of the present invention;
FIG. 13 is a flow chart of another data processing method provided by the embodiments of the present invention;
FIG. 14 is a flow chart of another data processing method provided by the embodiments of the present invention;
FIG. 15 is a schematic diagram of another data processing scenario provided by an embodiment of the present invention;
FIG. 16 is a diagram illustrating another data processing scenario provided by an embodiment of the present invention;
FIG. 17 is a diagram illustrating another data processing scenario provided by an embodiment of the present invention;
FIG. 18 is a schematic diagram of another data processing scenario provided by an embodiment of the present invention;
fig. 19 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention;
fig. 20 is a schematic structural diagram of an electronic device corresponding to the data processing apparatus provided in the embodiment shown in fig. 19.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a plurality" typically includes at least two.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a good or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such good or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a commodity or system that includes the element.
In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.
The classification method provided by the embodiment of the invention can be executed by an electronic device, and the electronic device can be a terminal device such as a PC (personal computer), a notebook computer, a smart phone and the like, and can also be a server. The server may be a physical server including an independent host, or may also be a virtual server carried by a host cluster, or may also be a cloud server.
The classification method provided by the embodiment of the invention can be applied to any classification task scene, such as classification of objects contained in the image (image classification for short) and the like.
The implementation of the classification method is described below with reference to the following embodiments.
Several core concepts involved in this document are explained first:
in this context, the source domain refers to the field where the training sample is located, and has rich supervision information, that is, the training sample is labeled with a category, and the target domain is the field where the test sample is located, and the test sample is not labeled with a category.
In a classification application scenario, the source domain and the target domain often have the same classification task, that is, the data categories corresponding to the source domain and the target domain may be considered to be consistent, but the data distribution of the source domain and the target domain is different.
For example, assuming that the classification task of the source domain needs to identify which of A, B and C categories the source domain data belongs to, the classification task of the target domain data may also identify which of A, B and C categories the target domain data belongs to. Of course, the data types corresponding to the source domain and the target domain are identical, and the case that the type corresponding to the source domain data and the type corresponding to the target domain data are partially overlapped may be included.
In the prior art, due to different data distributions of a source domain and a target domain, data of the source domain and the target domain are mapped to different feature spaces, so that a classification result is inaccurate when the data of the target domain is classified by using a model obtained based on source domain data training.
In order to obtain a good classification result of the target domain data, the following embodiment is provided to describe the implementation process of the classification method provided herein.
Fig. 1 is a flowchart of a classification method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
101. data in the target domain is acquired.
102. And performing feature extraction on the data of the target domain through a feature extractor, wherein the extracted features have consistent data distribution in the source domain and the target domain.
103. And inputting the extracted features into a classifier so as to determine the category corresponding to the data of the target domain through the classifier.
Taking the application scenario of image classification as an example, in this case, the data of the source domain may be an annotated image used for training a model (i.e., a model for classification). The labeling means performing class labeling on an image serving as a training sample, so that the image has a class label, and performing supervised training on the model based on the class label. In contrast, the data of the target domain refers to images of the model under test, and these images under test have no label information.
The trained model is functionally split and can be divided into two parts: a feature extractor and a classifier. The feature extractor is used for extracting features of input data, the extracted features are input into the classifier, and the classifier identifies categories corresponding to the corresponding data according to the input features. It should be noted that, in the embodiment of the present invention, in the model training phase, the data serving as the training sample includes data of the source domain and data of the target domain. The data in the target domain in step 101 is data to be classified which is input to the model at the stage of actually using the model after the model training is completed, and is called target domain data because the data has no label information.
The training process for the feature extractor and the classifier will be described in the following embodiments.
In practical application, the feature extractor and the classifier can be implemented as a convolutional neural network model, wherein a multilayer convolutional layer of the convolutional neural network model is used as the feature extractor, and a fully-connected layer connected behind the multilayer convolutional layer is used as the classifier. Of course, other neural network models may be used as the feature extractor, and the convolutional neural network model is not limited.
For data in a target domain that needs to be classified and identified in practical application, for example, any image in the target domain, feature extraction may be performed on the data through a trained feature extractor. The features extracted by the feature extractor have consistent data distribution on the source domain and the target domain after training, that is, the feature extractor can map the data in the source domain and the target domain to the same feature space, so that when the extracted features are input into the classifier, the classifier can accurately determine the category corresponding to the data in the target domain.
The training process of the feature extractor and the classifier is explained below.
Firstly, the core idea of the training process is: a model is trained with labeled (i.e., labeled) source domain data and unlabeled (i.e., unlabeled) target domain data to have good classification performance on the target domain data, and the model consists of a trained feature extractor and classifier.
In order to finally obtain a model with good classification performance on the target domain data, a countertraining method is adopted.
The final purpose of the method for resisting training is to achieve domain alignment of the category levels of the source domain data and the target domain data, that is, achieve data distribution consistency of the source domain data and the target domain data at the category levels. Specifically, it is expected that the feature extractor can extract features with domain invariance from the source domain and target domain data by training, and the classifier can distinguish the features of the source domain from the features of the target domain, so it can be seen that the targets of the feature extractor and the classifier are opposite, and therefore, the training is called confrontation training, and can also be called game training.
The feature of domain invariance refers to that the feature extracted from the source domain data and the feature extracted from the target domain data are in the same feature space, that is, have consistent data distribution. In addition, the extraction of features that achieve domain invariance, that is, the domain alignment that achieves the class hierarchy of the source domain data and the target domain data, can be simply understood as requiring the feature extractor to learn the features of the same class of data of the two domains, such as the features of the class a data of the two domains and the features of the class B data of the two domains.
For ease of understanding, the above-described resistance training is, in a figurative sense, as shown in fig. 2, for the purpose of: based on the data of the source domain and the target domain, the feature extractor can extract features which are not distinguished by the classifier and belong to which category of which domain, namely the features with domain invariance; regardless of the features extracted by the feature extractor, the classifier can accurately identify the domain and the specific category to which the input data belongs.
To achieve this, the feature extractor and classifier can be trained with reference to the following embodiments.
Fig. 3 is a flowchart of a training method of a classifier according to an embodiment of the present invention, and as shown in fig. 3, a training process of the classifier may include the following steps:
301. a labeled first training sample of a source domain is obtained.
For the example of image classification scene, assume that the number of classes corresponding to the classification task is 3, and assume that the 3 classes are A, B and C, respectively. It will be appreciated then that the first training sample of the source domain described above consists of several images with class labels.
Assuming that the three categories are bicycle, cup and backpack, a large number of bicycle pictures, cup pictures and backpack pictures can be collected, and labeling of corresponding category labels is performed for each picture, so that a large number of first training samples are obtained.
302. And performing feature extraction on the first training sample through a feature extractor.
As described above, the feature extractor may be implemented as a plurality of convolutional layers, initial parameters of the convolutional layers may be initialized randomly, and a process of extracting features of an input image serving as a first training sample through a convolution operation belongs to the prior art, and is not described herein again.
It is only emphasized here that in practical applications, in order to avoid the influence of the difference in size convenience of different images on the training process, some pre-processing may be performed on a large number of images as the first training sample in advance, such as scaling all the images to the same size.
303. The extracted features are input to a first classifier and a second classifier, respectively, to predict a class of the first training sample by the first classifier and the second classifier, respectively.
In the embodiment of the present invention, two classifiers are trained based on source domain data, i.e., a first training sample, and for convenience of understanding, the structural relationship between a feature extractor and the two classifiers is described with reference to fig. 4, where as shown in fig. 4, outputs of the feature extractor are respectively connected to inputs of the two classifiers. In fig. 4, the first classifier is represented as Cs and the second classifier is represented as Ct.
In practical applications, both the first classifier and the second classifier may be implemented as a fully connected layer (FC layer) connected to the multi-layered convolutional layer as the feature extractor. That is, the first classifier and the second classifier have the same network structure, except that the first classifier and the second classifier may have different initialization parameters.
It should be noted that the reason why the first classifier and the second classifier are trained by using the first training sample of the source domain is that the first training sample of the source domain has the labeling information of the class label, and the training sample of the target domain (referred to as the second training sample) has no labeling information of the class label, so that the first classifier and the second classifier cannot be supervised trained.
Based on this, assuming that the currently input first training sample is a certain image corresponding to the class a, after the feature extraction processing of the feature extractor, the extracted features are respectively input to the first classifier and the second classifier so as to respectively predict the class of the first training sample through the first classifier and the second classifier, and then parameters of the two classifiers are correspondingly adjusted based on the respective prediction results of the two classifiers.
The two classifiers obtained by training based on the source domain data with the class labels only have good classification effect on the source domain at this time, but cannot obtain good classification effect on the target domain data.
To obtain a good classification effect on the target domain data, domain alignment of the above-mentioned category hierarchy is required. The domain alignment of the category hierarchy can be realized through countertraining, and the foundation of the countertraining is as follows: a classifier is obtained that can distinguish the classes of the source domain and the target domain, because this is the countermeasure target, the feature extractor will be made to learn the feature that can not distinguish the same class of features of the source domain and the target domain, i.e., the feature of the domain invariance.
In the embodiment of the present invention, on the basis of the first classifier and the second classifier obtained by training, the "classifier capable of distinguishing each class of the source domain and the target domain" is obtained by training based on the two classifiers. Functionally, if the first classifier and the second classifier are referred to as a class classifier, i.e., a classifier for identifying a specific class to which data belongs, a classifier capable of distinguishing each class of a source domain and a target domain may be referred to as a domain classifier, i.e., a classifier for distinguishing different domains, which is denoted by Cst for convenience of description and distinction from the first classifier and the second classifier. The training process of the domain classifier is described below with reference to fig. 5.
First, it is worth explaining that, as shown in fig. 4, the domain classifier Cst is actually composed of a first classifier Cs and a second classifier Ct.
Fig. 5 is a flowchart of a training method of a domain classifier according to an embodiment of the present invention, where on the basis of obtaining the first classifier Cs and the second classifier Ct based on the embodiment shown in fig. 3, as shown in fig. 5, a training process of the domain classifier may include the following steps:
501. feature extraction is performed on the labeled first training sample of the source domain by a feature extractor.
502. And respectively inputting the extracted features into a first classifier and a second classifier, splicing a first feature vector output by the first classifier and a second feature vector output by the second classifier to obtain a third feature vector, and performing classification operation processing on the third feature vector to obtain a first probability vector.
503. And determining a first probability value corresponding to the category in the first probability vector according to the labeled category of the first training sample, wherein the first probability value corresponds to the first classifier, and parameters of the first classifier and the second classifier are adjusted by taking the first probability value as the maximum and the residual probability value in the first probability value vector as the minimum as targets.
504. And performing feature extraction on the second unlabeled training sample of the target domain through a feature extractor.
505. And respectively inputting the extracted features into the first classifier and the second classifier, splicing a fourth feature vector output by the first classifier and a fifth feature vector output by the second classifier to obtain a sixth feature vector, and performing classification operation processing on the sixth feature vector to obtain a second probability vector.
506. The parameters of the first classifier and the second classifier are adjusted to minimize the cumulative sum of the probability values corresponding to the first classifier in the second probability vector and to maximize the cumulative sum of the probability values corresponding to the second classifier in the second probability vector.
The steps 501 and 503 are performed when the input data is the first training sample of the source domain, and the steps 504 and 506 are performed when the input data is the second training sample of the target domain, and there is no strict limitation on the execution timing, depending on the input data.
It can be understood that the first classifier Cs and the second classifier Ct obtained after the training process are the domain-forming classifier Cst.
The first classifier Cs and the second classifier Ct after parameter adjustment based on the adjustment targets of steps 503 and 506 may be considered to correspond to the source domain and the target domain, respectively, the first classifier Cs corresponding to the source domain, and the second classifier Ct corresponding to the target domain.
It should be noted that the classifier in the embodiment shown in fig. 1 may be the first classifier Cs or the second classifier Ct after training, because actually, although the parameters corresponding to the two classifiers after training are different, the predicted classes are exactly the same for the same picture of the target domain.
For ease of understanding, a training process of the domain classifier Cst is exemplarily described in connection with fig. 6. Assume that the source domain and the target domain have the same classification category: A. b and C, it can be understood that the first classifier Cs and the second classifier Ct perform class prediction on the input data to output a vector of dimension 3, regardless of whether the current input data is the first training sample of the source domain or the second training sample of the target domain.
It should be noted that, in this embodiment, the two classifiers are implemented as a full connection layer as an example. Based on this, in fig. 6, it is assumed that the current input data is some first training sample of the source domain: and assuming that the class label corresponding to the image i is class a, assuming that the first feature vector output by the first classifier Cs at this time is [ Ds1, Ds2, Ds3], assuming that the second feature vector output by the second classifier Ct at this time is [ Dt1, Dt2, Dt3], since the domain classifier Cst is composed of the first classifier Cs and the second classifier Ct, the concatenation result of the first feature vector [ Ds1, Ds2, Ds3] and the second feature vector [ Dt1, Dt2, Dt3] can be: the third feature vector ═ Ds1, Ds2, Ds3, Dt1, Dt2, Dt3, is processed by a classification operation such as SoftMax operation, and is used as a probability output result of the domain classifier Cst: the first probability vector is [ Ps1, Ps2, Ps3, Pt1, Pt2, Pt3 ]. Wherein Ps1 and Pt1 are probability values corresponding to class a, Ps2 and Pt2 are probability values corresponding to class B, and Ps3 and Pt3 are probability values corresponding to class C, respectively. Ps1, Ps2 and Ps3 correspond to the first classifier Cs, and Pt1, Pt2 and Pt3 correspond to the second classifier Ct.
It will be appreciated that the input data is instead self-labelling information, i.e. a first training sample from the source domain is by default associated with the label of the source domain and a second training sample from the target domain is by default associated with the label of the target domain.
Thus, when the input data is image i in the source domain, image i is actually associated with two tags: domain labels and class labels, based on the supervision of these two labels, the domain classifier Cst can be actually trained for the purpose of distinguishing classes of different domains.
At this time, for the purpose of distinguishing the categories of the different domains by the domain classifier Cst, the parameters of the first classifier Cs and the second classifier Ct, that is, the parameters of the domain classifier Cst, may be adjusted according to the following manner:
and according to the labeled class A of the image i, determining a first probability value corresponding to the class A in the first vector, aiming at enabling the first probability value to be maximum and the residual probability values in the first vector and the second vector to be minimum, and adjusting parameters of the first classifier and the second classifier. In the above example, the first probability value is Ps1, the first probability value may be the largest, and Ps1 may be 1, and the other probability values may be the smallest, and the other probability values may be set to 0.
It is understood that although Ps1 and Pt1 are both probability values corresponding to the category a, since the image i is from the source domain, in order for the domain classifier Cst to accurately distinguish data from the source domain and the target domain, the probability value Ps1 corresponding to the category a of the source domain is made 1.
In addition, let Ps1 be 1, and other probability values set to 0, which can be understood by being subdivided into two layers: a domain level and a category level. Specifically, at the domain level, the domain classifier Cst can distinguish the source domain from the target domain only in order to allow the domain classifier Cst to distinguish the source domain from the target domain, and therefore, when the input data is the image i from the source domain, the domain classifier Cst can distinguish the source domain from the target domain by adjusting the parameters of the first classifier Cs and the second classifier Ct with the sum of the first vectors as the prediction probability corresponding to the source domain and the sum of the second vectors as the prediction probability corresponding to the target domain, such that the prediction probability corresponding to the source domain is 1 and the prediction probability corresponding to the target domain is 0. In order to allow the domain classifier Cst to distinguish a specific class, when the input data is the image i from the source domain, if Ps1 is 1 and the other probability values are 0, it is described that the domain classifier Cst can distinguish not only which domain the input data belongs to, but also the corresponding class.
The above description exemplifies how the parameter of the domain classifier Cst should be adjusted when the input data is the image i in the source domain. Then, in contrast, in fig. 6, if the current input data is a certain second training sample of the target domain: for the image j, it is assumed that the fourth feature vector output by the first classifier Cs at this time is [ Ds4, Ds5, Ds6], and it is assumed that the fifth feature vector output by the second classifier Ct at this time is [ Dt4, Dt5, Dt6], and similarly, the fourth feature vector and the fifth feature vector may be spliced to obtain a sixth feature vector [ Ds4, Ds5, Ds6, Dt4, Dt5, Dt6], and after the classification operation processing is performed on the sixth feature vector, the output result of the domain classifier Cst at this time is obtained: the second probability vector is [ Ps4, Ps5, Ps6, Pt4, Pt5, Pt6 ].
Since the input data is tagged with a domain label, when the input data is image j in the target domain, image j is from the target domain that is not tagged, and therefore image j is associated with only one label: the domain label, based on supervision of this label, can train the domain classifier Cst to achieve the purpose of distinguishing different domains.
At this time, for the purpose of distinguishing different domains by the domain classifier Cst, the parameters of the first classifier Cs and the second classifier Ct, that is, the parameters of the domain classifier Cst are adjusted according to the following manner:
the parameters of the first classifier and the second classifier are adjusted to minimize the cumulative sum of the probability values corresponding to the first classifier in the second probability vector and to maximize the cumulative sum of the probability values corresponding to the second classifier in the second probability vector. In the above example, the cumulative sum of the probability values corresponding to the first classifier in the second probability vector is: ps4+ Ps5+ Ps6, and the cumulative sum of the probability values corresponding to the second classifier in the second probability vector is: pt4+ Pt5+ Pt 6. Letting the cumulative sum of the probability values in the second probability vector corresponding to the first classifier be the smallest may be: ps4+ Ps5+ Ps6 is 0. Let the cumulative sum of the probability values in the second probability vector corresponding to the second classifier be: pt4+ Pt5+ Pt6 is 1. It can be understood that Ps4+ Ps5+ Ps6 is the probability of the source domain correspondence, and Pt4+ Pt5+ Pt6 is the probability of the target domain correspondence.
In summary, by comprehensively using training samples of the source domain and the target domain and training the first classifier and the second classifier, that is, the domain classifier, the trained domain classifier can well distinguish features of different domains, and even can well distinguish features corresponding to the same class of different domains. For example, the source domain and the target domain both have the categories a and B, and distinguishing the features corresponding to the same category of different domains means that the features corresponding to the category a of the source domain and the category a of the target domain can be distinguished, and the features corresponding to the category B of the source domain and the category B of the target domain can be distinguished.
On the basis of well distinguishing the features corresponding to the same category of different domains by the domain classifier, the feature extractor can learn the data features corresponding to the same category of the source domain and the target domain together by the countertraining feature extractor, for example, the data features corresponding to the category A of the source domain and the category B of the target domain together and the data features corresponding to the category B of the source domain and the category B of the target domain together. The confrontation training process may also be described as training the feature extractor with a data class of a first training sample of the source domain and a second training sample of the target domain as a target, which makes the first classifier Cs and the second classifier Ct unable to distinguish between them. The process of performing the countermeasure training on the feature extractor can be seen in fig. 7.
Fig. 7 is a flowchart of a training method of a feature extractor according to an embodiment of the present invention, where on the basis of obtaining the domain classifier Cst based on the foregoing embodiment, as shown in fig. 7, a training process of the feature extractor may include the following steps:
701. feature extraction is performed on the labeled first training sample of the source domain by a feature extractor.
702. And respectively inputting the extracted features into a first classifier and a second classifier, splicing a first feature vector output by the first classifier and a second feature vector output by the second classifier to obtain a third feature vector, and performing classification operation processing on the third feature vector to obtain a first probability vector.
703. And determining a first probability value corresponding to the category in the first probability vector according to the labeled category of the first training sample, wherein the first probability value corresponds to the first classifier, and parameters of the first classifier and the second classifier are adjusted by taking the first probability value as the maximum and the residual probability value in the first probability value vector as the minimum as targets.
704. And determining a second probability value corresponding to the category in the first probability vector according to the labeled category of the first training sample, wherein the second probability value corresponds to the second classifier, and adjusting the parameters of the feature extractor by taking the first probability value and the second probability value as targets, wherein the first probability value and the second probability value are both 0.5.
The execution of steps 701-703 may refer to the description in the foregoing embodiments, which is not repeated herein.
As described above, through the implementation of step 701-703, the domain classifier can distinguish the data features corresponding to the same category of the source domain and the target domain based on the first training sample of the source domain. At this time, the purpose of the countermeasure training of the feature extractor is: and performing countermeasure training on the feature extractor according to the first training sample of the source domain so that the feature extractor learns the data features which are commonly corresponding to the same categories of the source domain and the target domain, thereby enabling the domain classifier to be incapable of distinguishing the same categories of the source domain and the target domain.
The countermeasure training process of the feature extractor is illustrated in connection with fig. 8, wherein. The hypothetical case in fig. 6 is still used as an example for illustration.
Still assume that the current input data is some first training sample of the source domain: and an image i, and the corresponding class label of the image i is assumed to be a class A. Assume that the output result of the time domain classifier Cst is: the first probability vector is [ Ps1, Ps2, Ps3, Pt1, Pt2, Pt3 ]. As described above, the domain classifier Cst can distinguish the categories of different domains by targeting Ps1 as 1 and other probability values as 0. To counter this, it is necessary to train the feature extractor so that after the features extracted from the image i are input to the domain classifier Cst, the domain classifier Cst cannot distinguish which class in which domain the image i corresponds.
To achieve this, as shown in fig. 8, a second probability value Pt1 corresponding to the category a in the first probability vector may be determined according to the category a to which the image i is labeled, the second probability value corresponding to the second classifier, and the parameters of the feature extractor may be adjusted with the first probability value Ps1 and the second probability value Pt1 both being 0.5 as targets. Let Ps1 be Pt1 be 0.5 and the other probability values be 0, which indicates that the time-domain classifier cannot distinguish which category in which domain the image i corresponds to.
705. And performing feature extraction on the second unlabeled training sample of the target domain through a feature extractor.
706. And respectively inputting the extracted features into the first classifier and the second classifier, splicing a fourth feature vector output by the first classifier and a fifth feature vector output by the second classifier to obtain a sixth feature vector, and performing classification operation processing on the sixth feature vector to obtain a second probability vector.
707. The parameters of the first classifier and the second classifier are adjusted to minimize the cumulative sum of the probability values corresponding to the first classifier in the second probability vector and to maximize the cumulative sum of the probability values corresponding to the second classifier in the second probability vector.
708. Taking the cumulative sum of the probability values corresponding to the first classifier in the second probability vector and the cumulative sum of the probability values corresponding to the second classifier in the second probability vector as a target to be 0.5, adjusting parameters of the feature extractor, and adding two probability values corresponding to the same category in the second probability vector to obtain a third probability vector; the parameters of the feature extractor are adjusted with the goal of minimizing the entropy of the third probability vector.
The execution of step 705-707 can refer to the description in the foregoing embodiments, which is not described herein. Through the implementation of step 705-707, the domain classifier can distinguish the data features corresponding to the source domain and the target domain based on the second training sample of the target domain. At this time, the purpose of the countermeasure training of the feature extractor is: and performing countermeasure training on the feature extractor according to the second training sample of the target domain so that the feature extractor learns the data features which are corresponding to the same categories of the source domain and the target domain together, thereby enabling the domain classifier to be incapable of distinguishing the source domain and the target domain.
Some second training sample still targeting the current input data: for example, image j, still assuming that the output result of the temporal classifier Cst is: the second probability vector is [ Ps4, Ps5, Ps6, Pt4, Pt5, Pt6 ].
As described above, the domain classifier Cst can distinguish different domains by aiming to set Ps4+ Ps5+ Ps6 to 0 and Pt4+ Pt5+ Pt6 to 1. To combat this, it is necessary to train the feature extractor so that after the features extracted from image j are input to the domain classifier Cst, the domain classifier Cst cannot distinguish which domain image j corresponds to.
To achieve this, as shown in fig. 8, the parameters of the feature extractor may be adjusted with Ps4+ Ps5+ Ps6 of 0.5 and Pt4+ Pt5+ Pt6 of 0.5 as targets. The Ps4+ Ps5+ Ps6 is 0.5, and the Pt4+ Pt5+ Pt6 is 0.5, so that the domain classifier Cst cannot distinguish the source domain from the target domain.
On the basis, two probability values corresponding to the same category in the second probability vector are further added to obtain a third probability vector, and the parameter of the feature extractor is adjusted by taking the minimum entropy of the third probability vector as a target. Under the condition that the source domain and the target domain are corresponding to three categories of the categories A, B, C, the probability values Ps4, Ps5 and Ps6 in the second probability vector are probability values corresponding to the three categories of the categories A, B, C in sequence, and the three probability values correspond to the first classifier; pt4, Pt5, Pt6 are also probability values corresponding to the three categories of category A, B, C in turn, and the three probability values correspond to the second classifier. Adding the two probability values corresponding to the same class in the second probability vector means: adding Ps4 and Pt4, and assuming that the result is P4; adding Ps5 and Pt5, and assuming that the result is P5; ps6 is added to Pt6, assuming the result is P6, and thus the third probability vector is P4, P5, P6. Further, an entropy corresponding to the third probability vector is calculated, and the parameter of the feature extractor is adjusted with the minimum entropy as a target.
In summary, the feature extractor is subjected to the above-mentioned countermeasure training based on the training samples of the source domain and the target domain, so that the feature extractor can learn the features of the source domain and the target domain with domain invariance, and based on the feature extraction capability of the features, the trained feature extractor and classifier can have good classification performance on the target domain, and the classification performance is not affected by the interference of inconsistent data distribution of the source domain and the target domain.
In addition, in practical application, the training process of the model including the feature extractor and the classifier can be performed in a server, and a terminal device needing to use the trained model can download the model to the local, so that the model can be used on the terminal device side.
The sorting apparatus of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these sorting devices can each be configured using commercially available hardware components through the steps taught in this scheme.
Fig. 9 is a schematic structural diagram of a sorting apparatus according to an embodiment of the present invention, and as shown in fig. 9, the sorting apparatus includes: the device comprises a data acquisition module 11, a feature extraction module 12 and a classification judgment module 13.
And the data acquisition module 11 is used for acquiring data in the target domain.
And the feature extraction module 12 is configured to perform feature extraction on the data through a feature extractor, where the extracted features have consistent data distribution in a source domain and the target domain.
And a classification and judgment module 13, configured to input the extracted features into a classifier, so as to determine a category corresponding to the data through the classifier.
Optionally, the apparatus further comprises: the classifier training module is used for acquiring a labeled first training sample of the source domain; performing feature extraction on the first training sample through a feature extractor; inputting the extracted features into a first classifier and a second classifier, respectively, to predict a class of the first training sample by the first classifier and the second classifier, respectively, the classifier being the first classifier or the second classifier.
Optionally, the classifier training module is further configured to: splicing the first feature vector output by the first classifier and the second feature vector output by the second classifier to obtain a third feature vector; performing classification operation processing on the third feature vector to obtain a first probability vector; determining, from the class to which the first training sample is labeled, a first probability value in the first probability vector corresponding to the class, the first probability value corresponding to the first classifier; and adjusting the parameters of the first classifier and the second classifier by taking the first probability value as the maximum and the remaining probability value in the first probability vector as the minimum as a target.
Optionally, the apparatus further comprises: and the feature extractor training module is used for carrying out countermeasure training on the feature extractor according to the first training sample so that the feature extractor learns the data features which are corresponding to the same category of the source domain and the target domain.
Optionally, the feature extractor training module may be specifically configured to: determining a second probability value corresponding to the category in the first probability vector according to the labeled category of the first training sample, wherein the second probability value corresponds to the second classifier; and adjusting the parameters of the feature extractor aiming at making the first probability value and the second probability value both 0.5.
Additionally, optionally, the classifier training module may be further configured to: acquiring an unlabeled second training sample of the target domain; performing feature extraction on the second training sample through the feature extractor; inputting the extracted features into the first classifier and the second classifier, respectively, to predict a class of the second training sample by the first classifier and the second classifier, respectively.
Optionally, the classifier training module may be further configured to: splicing the fourth feature vector output by the first classifier and the fifth feature vector output by the second classifier to obtain a sixth feature vector; carrying out classification operation processing on the sixth feature vector to obtain a second probability vector; and adjusting the parameter numbers of the first classifier and the second classifier so that the cumulative sum of the probability values corresponding to the first classifier in the second probability vector is minimum and the cumulative sum of the probability values corresponding to the second classifier in the second probability vector is maximum.
Optionally, the feature extractor training module may be further configured to: and carrying out countermeasure training on the feature extractor according to the second training sample so that the feature extractor learns the data features which are commonly corresponding to the same category of the source domain and the target domain.
Wherein, optionally, the feature extractor training module may be further configured to: adjusting parameters of the feature extractor with a target that the cumulative sum of the probability values corresponding to the first classifier in the second probability vector and the cumulative sum of the probability values corresponding to the second classifier in the second probability vector are both 0.5; adding two probability values corresponding to the same category in the second probability vector to obtain a third probability vector; adjusting parameters of the feature extractor with a goal of minimizing entropy of the third probability vector.
The classification apparatus shown in fig. 9 may perform the methods provided in the foregoing embodiments, and details of the parts not described in this embodiment may refer to the related descriptions of the foregoing embodiments, which are not described herein again.
In one possible design, the structure of the sorting apparatus shown in fig. 9 may be implemented as an electronic device. As shown in fig. 10, the electronic device may include: a processor 21 and a memory 22. Wherein the memory 22 has stored thereon executable code which, when executed by the processor 21, at least makes the processor 21 capable of implementing the classification method as provided in the previous embodiments.
The electronic device may further include a communication interface 23 for communicating with other devices or a communication network.
In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the classification method provided in the foregoing embodiments.
Fig. 11 is a flowchart of a data processing method according to an embodiment of the present invention, and as shown in fig. 11, the data processing method may include the following steps:
1101. a first picture is received.
1102. And extracting the characteristics of the first picture.
1103. And determining the category of the first picture according to the extracted features.
1104. And outputting the category of the first picture, wherein the feature extracted from the second picture with the category label has consistent data distribution with the feature extracted from the first picture.
The data processing method provided by this embodiment is specifically to perform category identification processing on picture data, and can be used in an actual scene of an object to be identified by a picture, such as teaching a child to identify an object.
The specific execution process of the server may refer to a block diagram drawn by a dotted line in fig. 12, and in fig. 12, it is assumed that a picture is presented in the screen of the current terminal device, and is denoted as a picture q, which is the first picture in the above step. Further, the picture q is subjected to feature extraction by the feature extractor trained in the foregoing, and it is assumed that the extracted features are denoted as features a'. The feature a' is input into a classifier (which may be the second classifier Ct mentioned above), and the classifier outputs a class corresponding to the picture q, which is assumed to be the class X. Further, the classification result of the picture q is: and feeding back the category X to the terminal equipment for display or voice broadcast, so that the user can know the category of the picture q.
In conjunction with the above description of the training process of the feature extractor and the classifier, it can be understood that the feature extractor obtained by training has a consistent data distribution with the feature a' extracted from the unlabeled picture, such as the picture q, and the feature a extracted from the labeled picture (such as the labeled picture p labeled with the category X shown in fig. 12). That is, the feature extractor can cause the tagged data and non-tagged data to have consistent data distribution characteristics at the category level. In the case of the above-mentioned feature a' and feature a, the consistency of data distribution means that the edge distribution and the conditional distribution of the two features are the same in the joint distribution.
In brief, let us assume that the edge distribution is represented as p (x), and x represents the extracted features; the conditional distribution can be represented as P (y | x), where y represents a category. Then the combined distribution of these two distributions is p (xy). If the edge distributions of the feature a' and the feature a are consistent, such as gaussian distributions, and the condition distributions are consistent, i.e. corresponding categories at the same coordinate are consistent, then the joint distributions of the edge distributions and the condition distributions of the two features will be the same.
The data processing method provided by this embodiment may also be executed by a terminal device, such as a notebook computer, a PC, a smart phone, and the like. The terminal device can be operated with a model downloaded from a server and containing the feature extractor and the classifier.
Fig. 13 is a flowchart of another data processing method according to an embodiment of the present invention, and as shown in fig. 13, the data processing method may include the following steps:
1301. acquiring a plurality of frames of images contained in a video.
1302. And respectively carrying out feature extraction on the multi-frame images, wherein the features extracted from the reference images with the category labels have consistent data distribution with the features extracted from the multi-frame images.
1303. And determining the category corresponding to the multi-frame images according to the characteristics corresponding to the multi-frame images.
1304. And determining the video category according to the categories respectively corresponding to the multiple frames of images.
In this embodiment, it is assumed that the video needs to be classified into two categories, where the classification is to predict whether the video belongs to category a or category B. In practical applications, the category a may be, for example, yellow-related movies, and correspondingly, the category B is non-yellow-related movies. For example, if category a may be horror discs, category B is non-horror discs.
Specifically, the classification result of the video may be finally determined according to the classification result corresponding to each of the multiple frames of images included in the video, that is, the classification result corresponding to the category a and the category B.
For example, when a large number of images in the multi-frame image correspond to the category a, the category corresponding to the video is finally determined to be the category a.
In practical applications, the plurality of frames of images may be screened from all images included in the video randomly or at set sampling intervals.
For the classification processing procedure of each frame of image, reference may be made to the processing procedure of the picture q in the foregoing embodiment, which is not described herein again.
It should be understood that the "reference image with class label" in the present embodiment refers to the training sample for training the feature extractor and classifier, and corresponds to the source domain data in the foregoing, while the multi-frame image in the video corresponds to the target domain data. The reference image may be an image extracted from a video that already has a category label.
In step 1302, feature extraction of multiple frames of images is performed by the trained feature extractor. In step 1303, the classifier obtained by training is used to classify and recognize the multi-frame images.
Further, the feature extracted from the reference image having the category label and the feature extracted from the multi-frame image have a uniform data distribution, and the meaning of the uniformity of the data distribution can refer to the description in the foregoing embodiment.
Fig. 14 is a flowchart of another data processing method according to an embodiment of the present invention, and as shown in fig. 14, the data processing method may include the following steps:
1401. data in the target domain is acquired.
1402. And performing feature extraction on the data through a feature extractor, and inputting the extracted features into a classifier to determine the category corresponding to the data through the classifier, wherein the extracted features have consistent data distribution in a source domain and a target domain.
1403. And processing the data according to the category corresponding to the data.
The execution process of step 1401 and step 1402 may refer to the description in the foregoing other embodiments, and is not described herein. The source and target domains may also be referred to herein as training and test domains.
How to process the data based on the above-described class determination result of the data in the target domain is exemplified below with reference to fig. 15 to 18.
In fig. 15, such a practical scenario is assumed: different categories of advertising material are pushed to different users. In this scenario, a server has stored therein a library of advertising material in which a large amount of advertising material is stored. The advertisement material may be an advertisement material of a video, an advertisement material of a picture, or an advertisement material of a text. Fig. 15 illustrates an example of a picture advertisement material. The server can sequentially input each picture in the advertisement material library into the feature extractor, perform feature extraction through the feature extractor, input the extracted features into the classifier, output the category corresponding to each picture by the classifier, and finally push the advertisement material of the corresponding category to the corresponding user according to the categories preferred by different users, for example, in fig. 15, push the picture corresponding to category X to the user who prefers category X; and pushing the picture corresponding to the category Y to the user with the preference category X.
In fig. 16, such a practical scenario is assumed: currently, a certain user is visiting a certain video website, and in order to achieve the purpose of enabling a suitable group of people to watch a suitable video, category identification needs to be performed on the user, for example, the preset user category may include two categories of children and non-children, and of course, may also be set to include three categories of old people, adults, and children, and so on. In this scenario, the data in the target domain may be image data of the user currently acquired, so that the data access right of the user may be determined according to a user category corresponding to the image data, for example, if the category identification result of the user currently indicates that the user is a child, if the child is in the range of live videos including violent shots, access to the children is denied.
In fig. 17, such a practical scenario is assumed: each of the networks may generate a large amount of text data, such as microblogs, blogs, social media, news sites, which may be, for example, political, entertainment, sports, financial, etc. In order to enable people to obtain the content of the interested area in massive text data, when certain text data is released, classification and identification of the article area of the text data can be carried out, such as belonging to the current political field, belonging to the entertainment field, belonging to the sports field, and the like. Based on this, the data in the target domain may be a text data, and the classification result of the text data may be the article domain described by the text data. Therefore, in response to a search request of a user for the target article field, if the category corresponding to the text data is matched with the target article field, the text data is output and is fed back to the user as one item of the search result.
In fig. 18, such a practical scenario is assumed: a user's terminal, such as a mobile phone, a camera, etc., stores a large number of photos, and the user wants to store the photos in a classified manner when sorting the photos, and the classified storage is based on dividing photos containing the same class or the same object into a group for storage, where the object is, for example, a dog, a landscape, a person, etc. In this scenario, if the data in the target domain refers to a plurality of image data that need to be classified and identified as illustrated in fig. 17, the processing of the data in the target domain is: the plurality of image data are grouped according to the category to which the plurality of image data respectively correspond, so that the image data corresponding to the same category are classified into the same group. Such as the arrangement of multiple photographs of dog dogs in the same group and multiple photographs of scenery in the same group as illustrated in fig. 18.
Fig. 16 to 18 do not necessarily illustrate the working process of the feature extractor and the classifier, and it can be seen for understanding that similar to the example case in the foregoing other embodiments.
Fig. 19 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention, and as shown in fig. 19, the apparatus includes: an acquisition module 31, a classification module 32 and a processing module 33.
And an obtaining module 31, configured to obtain data in the target domain.
The classification module 32 is configured to perform feature extraction on the data through a feature extractor, and input the extracted features into a classifier so as to determine a category corresponding to the data through the classifier, where the extracted features have consistent data distribution in a source domain and a target domain.
And the processing module 33 is configured to process the data according to the category corresponding to the data.
Optionally, the data is a plurality of image data, and the processing module 33 may specifically be configured to: and grouping the plurality of image data according to the categories corresponding to the plurality of image data respectively so as to divide the image data corresponding to the same category into the same group.
Optionally, the data is image data of a user, and the processing module 33 may specifically be configured to: and determining the data access authority of the user according to the user category corresponding to the image data.
Optionally, the data is text data, and the processing module 33 may specifically be configured to: responding to a search request of a user for a target article field, and outputting the text data if the category corresponding to the text data is matched with the target article field.
The data processing apparatus shown in fig. 19 can execute the data processing method illustrated in the embodiments shown in fig. 14 to fig. 18, and parts not described in detail in this embodiment may refer to the related description of the embodiments, which is not described herein again.
In one possible design, the structure of the sorting apparatus shown in fig. 19 may be implemented as an electronic device. As shown in fig. 20, the electronic device may include: a processor 41, and a memory 42. Wherein the memory 42 has stored thereon executable code, which when executed by the processor 41, at least makes the processor 41 capable of implementing the data processing method as illustrated in the foregoing embodiments shown in fig. 14 to 18.
The electronic device may further include a communication interface 43 for communicating with other devices or a communication network.
In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the data processing method illustrated in the foregoing embodiments shown in fig. 14 to 18.
The above-described apparatus embodiments are merely illustrative, wherein the various modules illustrated as separate components may or may not be physically separate. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course, can also be implemented by a combination of hardware and software. With this understanding in mind, the above-described aspects and portions of the present technology which contribute substantially or in part to the prior art may be embodied in the form of a computer program product, which may be embodied on one or more computer-usable storage media having computer-usable program code embodied therein, including without limitation disk storage, CD-ROM, optical storage, and the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (25)

1. A method of classification, comprising:
acquiring data in a target domain;
performing feature extraction on the data through a feature extractor, wherein the extracted features have consistent data distribution in a source domain and the target domain;
and inputting the extracted features into a classifier so as to determine the category corresponding to the data through the classifier.
2. The method of claim 1, further comprising:
obtaining a labeled first training sample of the source domain;
performing feature extraction on the first training sample through a feature extractor;
inputting the extracted features into a first classifier and a second classifier, respectively, to predict a class of the first training sample by the first classifier and the second classifier, respectively, the classifier being the first classifier or the second classifier.
3. The method of claim 2, further comprising:
splicing the first feature vector output by the first classifier and the second feature vector output by the second classifier to obtain a third feature vector;
performing classification operation processing on the third feature vector to obtain a first probability vector;
determining, from the class to which the first training sample is labeled, a first probability value in the first probability vector corresponding to the class, the first probability value corresponding to the first classifier;
and adjusting the parameters of the first classifier and the second classifier by taking the first probability value as the maximum and the remaining probability value in the first probability vector as the minimum as a target.
4. The method of claim 3, further comprising:
and carrying out countermeasure training on the feature extractor according to the first training sample so that the feature extractor learns the data features which are commonly corresponding to the same category of the source domain and the target domain.
5. The method of claim 4, wherein the opportunistically training the feature extractor based on the first training sample comprises:
determining a second probability value corresponding to the category in the first probability vector according to the labeled category of the first training sample, wherein the second probability value corresponds to the second classifier;
and adjusting the parameters of the feature extractor aiming at making the first probability value and the second probability value both 0.5.
6. The method according to any one of claims 2 to 5, further comprising:
acquiring an unlabeled second training sample of the target domain;
performing feature extraction on the second training sample through the feature extractor;
inputting the extracted features into the first classifier and the second classifier, respectively, to predict a class of the second training sample by the first classifier and the second classifier, respectively.
7. The method of claim 6, further comprising:
splicing the fourth feature vector output by the first classifier and the fifth feature vector output by the second classifier to obtain a sixth feature vector;
carrying out classification operation processing on the sixth feature vector to obtain a second probability vector;
adjusting parameters of the first classifier and the second classifier such that a cumulative sum of probability values corresponding to the first classifier in the second probability vector is minimized and a cumulative sum of probability values corresponding to the second classifier in the second probability vector is maximized to a target.
8. The method of claim 7, further comprising:
and carrying out countermeasure training on the feature extractor according to the second training sample so that the feature extractor learns the data features which are commonly corresponding to the same category of the source domain and the target domain.
9. The method of claim 8, wherein the opportunistically training the feature extractor based on the second training sample comprises:
adjusting parameters of the feature extractor with a target that the cumulative sum of the probability values corresponding to the first classifier in the second probability vector and the cumulative sum of the probability values corresponding to the second classifier in the second probability vector are both 0.5;
adding two probability values corresponding to the same category in the second probability vector to obtain a third probability vector;
adjusting parameters of the feature extractor with a goal of minimizing entropy of the third probability vector.
10. A sorting apparatus, comprising:
the data acquisition module is used for acquiring data in a target domain;
the characteristic extraction module is used for extracting the characteristics of the data through a characteristic extractor, wherein the extracted characteristics have consistent data distribution in a source domain and the target domain;
and the classification judging module is used for inputting the extracted features into a classifier so as to determine the category corresponding to the data through the classifier.
11. An electronic device, comprising: a memory, a processor; wherein the memory has stored thereon executable code which, when executed by the processor, causes the processor to perform the classification method of any one of claims 1 to 9.
12. A data processing method, comprising:
acquiring data in a target domain;
performing feature extraction on the data through a feature extractor, wherein the extracted features have consistent data distribution in a source domain and the target domain;
inputting the extracted features into a classifier so as to determine a category corresponding to the data through the classifier;
and processing the data according to the category corresponding to the data.
13. The method of claim 12, wherein the data is a plurality of image data, and wherein processing the data according to the category to which the data corresponds comprises:
and grouping the plurality of image data according to the categories corresponding to the plurality of image data respectively so as to divide the image data corresponding to the same category into the same group.
14. The method of claim 12, wherein the data is image data of a user, and the processing the data according to the category to which the data corresponds comprises:
and determining the data access authority of the user according to the user category corresponding to the image data.
15. The method of claim 12, wherein the data is text data, and the processing the data according to the category to which the data corresponds comprises:
responding to a search request of a user for a target article field, and outputting the text data if the category corresponding to the text data is matched with the target article field.
16. The method according to claim 12, wherein the processing the data according to the category to which the data corresponds comprises:
and pushing data corresponding to the data type preferred by the user to the user according to the data type preferred by the user.
17. A data processing apparatus, comprising:
the acquisition module is used for acquiring data in a target domain;
the classification module is used for extracting the features of the data through a feature extractor, inputting the extracted features into a classifier, and determining the category corresponding to the data through the classifier, wherein the extracted features have consistent data distribution in a source domain and a target domain;
and the processing module is used for processing the data according to the category corresponding to the data.
18. An electronic device, comprising: a memory, a processor; wherein the memory has stored thereon executable code which, when executed by the processor, causes the processor to carry out the data processing method of any one of claims 12 to 16.
19. A data processing method, comprising:
receiving a first picture;
extracting features of the first picture;
determining the category of the first picture according to the extracted features;
outputting the category of the first picture;
wherein the features extracted from the second picture with the category label have a consistent data distribution with the features extracted from the first picture.
20. A data processing method, comprising:
acquiring a plurality of frame images contained in a video;
respectively extracting the features of the multi-frame images;
determining the categories of the multiple frames of images respectively corresponding to the characteristics of the multiple frames of images;
determining the category of the video according to the categories respectively corresponding to the multiple frames of images;
wherein the features extracted from the reference image having the category label have a data distribution that is identical to the features extracted from the multi-frame images.
21. A method of model training, comprising:
acquiring a labeled first training sample of a source domain and an unlabeled second training sample of a target domain;
training a first classifier and a second classifier based on the first training sample and the second training sample to enable the first classifier and the second classifier to domain classify the first training sample and the second training sample;
training a feature extractor with a target of making the first classifier and the second classifier unable to distinguish the data categories of the first training sample and the second training sample;
the model includes the feature extractor and at least one of the first classifier and the second classifier.
22. The method of claim 21, wherein training a first classifier and a second classifier based on the first training sample and the second training sample comprises:
performing feature extraction on the first training sample through the feature extractor;
inputting the extracted features into the first classifier and the second classifier respectively, and splicing a first feature vector output by the first classifier and a second feature vector output by the second classifier to obtain a third feature vector;
performing classification operation processing on the third feature vector to obtain a first probability vector;
determining, from the class to which the first training sample is labeled, a first probability value in the first probability vector corresponding to the class, the first probability value corresponding to the first classifier;
and adjusting the parameters of the first classifier and the second classifier by taking the first probability value as the maximum and the remaining probability value in the first probability vector as the minimum as a target.
23. The method of claim 22, wherein training a feature extractor with the goal of making the first classifier and the second classifier unable to distinguish the data classes of the first training sample and the second training sample comprises:
determining a second probability value corresponding to the category in the first probability vector according to the labeled category of the first training sample, wherein the second probability value corresponds to the second classifier;
and adjusting the parameters of the feature extractor aiming at making the first probability value and the second probability value both 0.5.
24. The method of any one of claims 21 to 23, wherein training a first classifier and a second classifier based on the first training sample and the second training sample comprises:
performing feature extraction on the second training sample through the feature extractor;
inputting the extracted features into the first classifier and the second classifier, respectively;
splicing the fourth feature vector output by the first classifier and the fifth feature vector output by the second classifier to obtain a sixth feature vector;
carrying out classification operation processing on the sixth feature vector to obtain a second probability vector;
adjusting parameters of the first classifier and the second classifier such that a cumulative sum of probability values corresponding to the first classifier in the second probability vector is minimized and a cumulative sum of probability values corresponding to the second classifier in the second probability vector is maximized to a target.
25. The method of claim 24, wherein training a feature extractor with a goal of making the first classifier and the second classifier unable to distinguish the data classes of the first training sample and the second training sample comprises:
adjusting parameters of the feature extractor with a target that the cumulative sum of the probability values corresponding to the first classifier in the second probability vector and the cumulative sum of the probability values corresponding to the second classifier in the second probability vector are both 0.5;
adding two probability values corresponding to the same category in the second probability vector to obtain a third probability vector;
adjusting parameters of the feature extractor with a goal of minimizing entropy of the third probability vector.
CN201910650980.2A 2019-07-18 2019-07-18 Model training method, data processing method, classification method, device and equipment Pending CN112241752A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910650980.2A CN112241752A (en) 2019-07-18 2019-07-18 Model training method, data processing method, classification method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910650980.2A CN112241752A (en) 2019-07-18 2019-07-18 Model training method, data processing method, classification method, device and equipment

Publications (1)

Publication Number Publication Date
CN112241752A true CN112241752A (en) 2021-01-19

Family

ID=74167953

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910650980.2A Pending CN112241752A (en) 2019-07-18 2019-07-18 Model training method, data processing method, classification method, device and equipment

Country Status (1)

Country Link
CN (1) CN112241752A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113420888A (en) * 2021-06-03 2021-09-21 中国石油大学(华东) Unsupervised federal learning method based on generalization domain self-adaptation
CN114186612A (en) * 2021-11-17 2022-03-15 南方科技大学 Model training method, terrain environment recognition method and device and electronic equipment
WO2024251253A1 (en) * 2023-06-09 2024-12-12 深圳前海环融联易信息科技服务有限公司 Model training method and apparatus, and computer device and readable storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107613120A (en) * 2017-09-15 2018-01-19 努比亚技术有限公司 A kind of access restriction method, device and computer-readable recording medium
US20180024968A1 (en) * 2016-07-22 2018-01-25 Xerox Corporation System and method for domain adaptation using marginalized stacked denoising autoencoders with domain prediction regularization
CN108053030A (en) * 2017-12-15 2018-05-18 清华大学 A kind of transfer learning method and system of Opening field
US20180174071A1 (en) * 2016-12-20 2018-06-21 Conduent Business Services, Llc Method and system for text classification based on learning of transferable feature representations from a source domain
CN108256561A (en) * 2017-12-29 2018-07-06 中山大学 A kind of multi-source domain adaptive migration method and system based on confrontation study
CN108921206A (en) * 2018-06-15 2018-11-30 北京金山云网络技术有限公司 A kind of image classification method, device, electronic equipment and storage medium
CN109189921A (en) * 2018-08-07 2019-01-11 阿里巴巴集团控股有限公司 Comment on the training method and device of assessment models
CN109271425A (en) * 2018-09-30 2019-01-25 北京字节跳动网络技术有限公司 It constructs the method for rumour database, analyze the method and electronic equipment of rumour data
CN109543031A (en) * 2018-10-16 2019-03-29 华南理工大学 A kind of file classification method based on multitask confrontation study
CN109583342A (en) * 2018-11-21 2019-04-05 重庆邮电大学 Human face in-vivo detection method based on transfer learning

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180024968A1 (en) * 2016-07-22 2018-01-25 Xerox Corporation System and method for domain adaptation using marginalized stacked denoising autoencoders with domain prediction regularization
US20180174071A1 (en) * 2016-12-20 2018-06-21 Conduent Business Services, Llc Method and system for text classification based on learning of transferable feature representations from a source domain
CN107613120A (en) * 2017-09-15 2018-01-19 努比亚技术有限公司 A kind of access restriction method, device and computer-readable recording medium
CN108053030A (en) * 2017-12-15 2018-05-18 清华大学 A kind of transfer learning method and system of Opening field
CN108256561A (en) * 2017-12-29 2018-07-06 中山大学 A kind of multi-source domain adaptive migration method and system based on confrontation study
CN108921206A (en) * 2018-06-15 2018-11-30 北京金山云网络技术有限公司 A kind of image classification method, device, electronic equipment and storage medium
CN109189921A (en) * 2018-08-07 2019-01-11 阿里巴巴集团控股有限公司 Comment on the training method and device of assessment models
CN109271425A (en) * 2018-09-30 2019-01-25 北京字节跳动网络技术有限公司 It constructs the method for rumour database, analyze the method and electronic equipment of rumour data
CN109543031A (en) * 2018-10-16 2019-03-29 华南理工大学 A kind of file classification method based on multitask confrontation study
CN109583342A (en) * 2018-11-21 2019-04-05 重庆邮电大学 Human face in-vivo detection method based on transfer learning

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YABIN ZHANG ET AL.,: "domain-symmetric networks for adversarial domain adaptation", 《ARXIV》, 3 July 2019 (2019-07-03), pages 1 - 10 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113420888A (en) * 2021-06-03 2021-09-21 中国石油大学(华东) Unsupervised federal learning method based on generalization domain self-adaptation
CN114186612A (en) * 2021-11-17 2022-03-15 南方科技大学 Model training method, terrain environment recognition method and device and electronic equipment
WO2024251253A1 (en) * 2023-06-09 2024-12-12 深圳前海环融联易信息科技服务有限公司 Model training method and apparatus, and computer device and readable storage medium

Similar Documents

Publication Publication Date Title
CN110837579B (en) Video classification method, apparatus, computer and readable storage medium
EP3559804B1 (en) Vision intelligence management for electronic devices
CN111611436A (en) Label data processing method and device and computer readable storage medium
KR102537568B1 (en) Image auditing method and device, electronic equipment and storage medium
CN109919244B (en) Method and apparatus for generating a scene recognition model
CN106973244A (en) Using it is Weakly supervised for image match somebody with somebody captions
CN106204165A (en) A kind of advertisement placement method and device
CN109460512A (en) Recommendation information processing method, device, equipment and storage medium
CN101371001A (en) Detecting and rejecting annoying documents
CN105787133B (en) Advertisement information filtering method and device
CN111432282B (en) Video recommendation method and device
CN110121108B (en) Video value evaluation method and device
CN112487242A (en) Method and device for identifying video, electronic equipment and readable storage medium
US11636282B2 (en) Machine learned historically accurate temporal classification of objects
CN113344048B (en) Multi-task behavior recognition model training method, device, equipment and storage medium
CN112241752A (en) Model training method, data processing method, classification method, device and equipment
CN111897950A (en) Method and apparatus for generating information
CN114329028B (en) Data processing method, device and computer readable storage medium
US11010935B2 (en) Context aware dynamic image augmentation
US11392788B2 (en) Object detection and identification
Gökstorp et al. Temporal and non-temporal contextual saliency analysis for generalized wide-area search within unmanned aerial vehicle (uav) video
US20200074218A1 (en) Information processing system, information processing apparatus, and non-transitory computer readable medium
CN114419514B (en) Data processing method, device, computer equipment and storage medium
CN111597361B (en) Multimedia data processing method, device, storage medium and equipment
CN112446214A (en) Method, device and equipment for generating advertisement keywords and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination