CN111461151A - Multi-group sample construction method and device - Google Patents

Multi-group sample construction method and device Download PDF

Info

Publication number
CN111461151A
CN111461151A CN201910049706.XA CN201910049706A CN111461151A CN 111461151 A CN111461151 A CN 111461151A CN 201910049706 A CN201910049706 A CN 201910049706A CN 111461151 A CN111461151 A CN 111461151A
Authority
CN
China
Prior art keywords
sample
feature
obtaining
feature set
features
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
CN201910049706.XA
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.)
Beijing Sogou Technology Development Co Ltd
Original Assignee
Beijing Sogou Technology Development Co Ltd
Sogou Hangzhou Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sogou Technology Development Co Ltd, Sogou Hangzhou Intelligent Technology Co Ltd filed Critical Beijing Sogou Technology Development Co Ltd
Priority to CN201910049706.XA priority Critical patent/CN111461151A/en
Publication of CN111461151A publication Critical patent/CN111461151A/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides a method and a device for constructing a multi-element sample, wherein the method comprises the following steps: obtaining a first feature set consisting of first sample features; obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; forward calculation is carried out on the model to be trained according to the first multi-element group sample to obtain a second sample characteristic; in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set; and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set. The invention improves the quality of the construction of the multi-element group sample, and the multi-element group sample constructed by the method can adapt to the learning of the model to be trained in different stages, thereby improving the convergence speed and the effect of the model to be trained.

Description

Multi-group sample construction method and device
Technical Field
The invention relates to the technical field of machine learning and image recognition, in particular to a sample acquisition method and device.
Background
In the metric learning task, the similarity between pictures learned by the network is usually supervised by constructing a multi-group consisting of similar and dissimilar pictures. The multi-tuple of samples respectively comprise a reference sample (anchor), a positive sample (positive) and a negative sample (negative). Where the reference samples are similar to the positive samples and not to the negative samples.
In the conventional multi-tuple sample construction strategy, the samples are usually subjected to traversal calculation in a fixed sample training set, and due to low calculation efficiency, the multi-tuple samples can be constructed only in a small range of the sample training set, so that the constructed samples have low quality and the learning of the model to be trained at different stages cannot be effectively guided.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method and an apparatus for constructing a multi-element sample, which improve the quality of the multi-element sample construction; the multi-element group sample constructed by the method can adapt to the learning of the model to be trained in different stages, and the convergence speed and effect of the model to be trained are improved.
In a first aspect, the present application provides the following technical solutions through an embodiment of the present application:
a method of multi-component sample construction, comprising:
obtaining a first feature set consisting of first sample features; obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; forward calculation is carried out according to the first multi-element group sample through the model to be trained, and second sample characteristics are obtained; in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set; and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
Preferably, the step of obtaining a first multi-element group sample required by the current training of the preset model to be trained according to the first feature set includes:
according to random features, extracting reference features from the first feature set, and obtaining reference samples based on the reference features, wherein the random features are obtained by randomly selecting from the first feature set, and first sample features similar to the reference features in the first feature set are all marked with identification marks; obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample characteristic marked with the identification mark; obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample characteristic without the identification mark; obtaining a first multi-tuple sample according to the reference sample, a positive sample corresponding to the reference sample and a negative sample corresponding to the reference sample, wherein each reference sample corresponds to one multi-tuple sample.
Preferably, the step of extracting the reference feature from the first feature set according to the random feature and obtaining the reference sample based on the reference feature includes:
acquiring a first similarity between the random feature and each first sample feature; when the first similarity belongs to a preset first range, extracting a first sample feature corresponding to the first similarity belonging to the first range as a reference feature; and taking the sample corresponding to the reference characteristic as the reference sample.
Preferably, the step of obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample feature marked with the identification mark includes:
for the same reference sample, obtaining a second similarity between the reference feature corresponding to the reference sample and the first sample feature marked with the identification mark; when the second similarity belongs to a preset second range, extracting a first sample feature corresponding to the second similarity belonging to the second range as a feature of a positive sample corresponding to the reference sample; and obtaining a positive sample corresponding to the reference sample according to the characteristics of the positive sample.
Preferably, the step of obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample feature without marking the identification mark comprises:
for the same reference sample, obtaining a third similarity between a reference feature corresponding to the reference sample and a first sample feature not marked with the identification mark; when the third similarity belongs to a preset third range, extracting a first sample characteristic corresponding to the third similarity belonging to the third range as a characteristic of a negative sample corresponding to the reference sample; and obtaining the negative sample corresponding to the reference sample according to the characteristics of the negative sample.
Preferably, the first sample feature and the second sample feature are both features of a picture.
In a second aspect, based on the same inventive concept, the present application provides the following technical solutions through an embodiment of the present application:
a multi-element sample construction device comprising:
the first characteristic set acquisition module is used for acquiring a first characteristic set consisting of first sample characteristics; the first sample acquisition module is used for acquiring a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; the forward calculation module is used for performing forward calculation according to the first multi-element group sample through the model to be trained to obtain a second sample characteristic; an updating module, configured to update, in the first feature set, a first sample feature corresponding to the first multi-group sample to the second sample feature, so as to obtain a second feature set; and the second sample acquisition module is used for acquiring a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
Preferably, the first sample obtaining module is further configured to:
according to random features, extracting reference features from the first feature set, and obtaining reference samples based on the reference features, wherein the random features are obtained by randomly selecting from the first feature set, and first sample features similar to the reference features in the first feature set are all marked with identification marks; obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample characteristic marked with the identification mark; obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample characteristic without the identification mark; obtaining a first multi-tuple sample according to the reference sample, a positive sample corresponding to the reference sample and a negative sample corresponding to the reference sample, wherein each reference sample corresponds to one multi-tuple sample.
Preferably, the first sample obtaining module is further configured to:
acquiring a first similarity between the random feature and each first sample feature; when the first similarity belongs to a preset first range, extracting a first sample feature corresponding to the first similarity belonging to the first range as a reference feature; and taking the sample corresponding to the reference characteristic as the reference sample.
Preferably, the first sample obtaining module is further configured to:
for the same reference sample, obtaining a second similarity between the reference feature corresponding to the reference sample and the first sample feature marked with the identification mark; when the second similarity belongs to a preset second range, extracting a first sample feature corresponding to the second similarity belonging to the second range as a feature of a positive sample corresponding to the reference sample; and obtaining a positive sample corresponding to the reference sample according to the characteristics of the positive sample.
Preferably, the first sample obtaining module is further configured to:
for the same reference sample, obtaining a third similarity between a reference feature corresponding to the reference sample and a first sample feature not marked with the identification mark; when the third similarity belongs to a preset third range, extracting a first sample characteristic corresponding to the third similarity belonging to the third range as a characteristic of a negative sample corresponding to the reference sample; and obtaining the negative sample corresponding to the reference sample according to the characteristics of the negative sample.
Preferably, the first sample feature and the second sample feature are both features of a picture.
In a third aspect, based on the same inventive concept, the present application provides the following technical solutions through an embodiment of the present application:
a multi-tuple sample construction apparatus comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured for execution by one or more processors the one or more programs comprising instructions for:
obtaining a first feature set consisting of first sample features; obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; forward calculation is carried out according to the first multi-element group sample through the model to be trained, and second sample characteristics are obtained; in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set; and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
In a fourth aspect, based on the same inventive concept, the present application provides the following technical solutions through an embodiment of the present application:
a computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
obtaining a first feature set consisting of first sample features; obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; forward calculation is carried out according to the first multi-element group sample through the model to be trained, and second sample characteristics are obtained; in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set; and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
according to the method, the first sample characteristics in the first characteristic set are updated through the second sample characteristics obtained in the training process of the model to be trained by using the first multi-element group samples, so that the second characteristic set is obtained. The distance distribution of the sample characteristics is ensured to be continuously updated and changed when the model to be trained excavates the learning sample in different training stages. When the second multi-element group sample is mined, the method is more targeted, and the multi-element group sample with higher quality and more suitable for the current training stage can be mined. The multi-element group sample obtained by the method can adapt to the learning of the model to be trained in different stages, the model to be trained is guided to reach a better solution more quickly, and the convergence speed and effect of the model to be trained are improved.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flow chart of a method for constructing a multi-element sample according to a first embodiment of the present invention;
FIG. 2 is a detailed flowchart of step S20 in FIG. 1;
fig. 3 is a functional block diagram of a multi-component sample constructing apparatus according to a second embodiment of the present invention;
fig. 4 is a block diagram illustrating a multi-element sample constructing apparatus according to a third embodiment of the present invention;
fig. 5 is a block diagram of an exemplary server according to a fourth embodiment of the present invention.
Detailed Description
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 only a part of the embodiments of the present invention, and not all of the embodiments.
For purposes of explanation and understanding, the following detailed description describes embodiments of the invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numbers indicate like or similar elements or elements having like or similar functionality throughout. The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
First embodiment
Referring to fig. 1, a method for constructing a multi-element sample is provided in the present embodiment. Fig. 1 shows a specific flow of the method in this embodiment, and the steps of the method will be described in detail in this embodiment with reference to the drawings. The method for constructing the multi-tuple sample specifically comprises the following steps:
step S10: a first feature set consisting of first sample features is obtained.
Step S20: and obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set.
Step S30: and carrying out forward calculation according to the first multi-element group sample by the model to be trained to obtain a second sample characteristic.
Step S40: and updating the first sample characteristic corresponding to the first multi-element group sample into the second sample characteristic in the first characteristic set to obtain a second characteristic set.
Step S50: and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
In step S10, a first feature set composed of first sample features is acquired.
Each first sample feature corresponds to a sample. The first sample feature can be obtained during forward calculation of the network model, or obtained by vectorization learning of the sample, and the expression form of the first sample feature can be a feature vector. The first feature set corresponds to a sample set.
In this embodiment, the network model includes, but is not limited to, convolutional neural network models of various architectures, such as: the training and the use of the VGG16, VGG19(Visual Geometry Group, VGG), ResNet50 model, inclusion V3 model, Xception model, etc. can be directly implemented by those skilled in the art, and are not described again.
In step S20, a first multi-element group sample required by the current training of the preset model to be trained is obtained according to the first feature set.
In step S20, the model to be trained may be any of the above-mentioned network models. In the training process of the model to be trained, the training samples can be constructed in batches according to different training stages of the model to be trained, so that the model to be trained can be converged to a better value quickly. Therefore, the training process of the model to be trained can be decomposed into multiple times, and a batch of multi-group samples are used in each training.
The current training pass described in step S20 may be any training pass of a plurality of training passes that is not the last training pass.
Specifically, the present embodiment provides a specific implementation manner, which is used to obtain the current first tuple sample. Referring to fig. 2, the method includes:
step S21: and according to the random features, extracting reference features from the first feature set, and obtaining a reference sample based on the reference features. The random features are obtained by random selection from the first feature set, and first sample features similar to the reference features in the first feature set are all marked with identification marks.
Step S22: obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample characteristic marked with the identification mark;
step S23: obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample characteristic without the identification mark;
step S24: obtaining a first multi-tuple sample according to the reference sample, a positive sample corresponding to the reference sample and a negative sample corresponding to the reference sample, wherein each reference sample corresponds to one multi-tuple sample.
In step S21, the random feature is obtained by randomly selecting from the first feature set, in this embodiment, the first feature set includes a corresponding reference set, and the random feature may be a feature randomly selected from the reference set. Similarly, a sample may be randomly selected from the sample set as a random sample, and then the random sample is taken as a random feature corresponding to the first sample feature in the first feature set. Furthermore, in some embodiments the random features may be obtained from outside the first set of features. For example: and randomly determining a picture as a random sample, then performing vectorization learning on the picture to obtain a feature vector of the picture, and using the feature vector for subsequent calculation in the first feature set, namely that the feature vector of the picture is a random feature.
The first sample features similar to the reference features in the first feature set are all marked with identification marks so as to more accurately select the positive samples and the negative samples corresponding to the reference samples; in the first feature set, a first feature of the same series that is similar may be labeled with an identifier that is distinguishable from other first features.
One specific embodiment of reference sample acquisition is:
first, a first similarity between the random feature and each of the first sample features is obtained. In general, a first similarity between the random feature and each first sample feature in the reference set may be directly calculated. If the reference set is larger, a subset of the reference set may be randomly sampled to calculate the first similarity, and the size of the subset may be 50-100 times or 100-200 times the size of the constructed batch of multi-tuple samples. The first similarity (the second similarity and the third similarity are also described below) may be expressed in a specific manner, including: cosine distance, euclidean distance, mahalanobis distance, etc., without limitation. Preferably, in this embodiment, the first sample feature may be represented by a feature vector, and the first similarity, the second similarity, and the third similarity may be measured and represented by a cosine distance.
Then, when the first similarity belongs to a preset first range, extracting a first sample feature corresponding to the first similarity belonging to the first range as a reference feature. The size interval of the first range may be customizable. The extraction may be a full extraction or a partial extraction, for example, a certain number of first sample features are randomly extracted within a specified first range as reference features. In a preferred embodiment, to ensure that the reference samples of the same batch are similar, the first range may be determined to be a region where the first similarity indicates more similarity or a closer distance.
And finally, taking the sample corresponding to the reference characteristic as the reference sample.
Step S21 is illustrated as an example:
taking the sample of pictures as an example, a random picture (corresponding to a random feature) is randomly selected from the sample set. Random sampling of the reference set in the first feature set constructs a subset of the first feature set that is 50 times the size of the batch size. Then, the distances between the random feature and all the first sample features in the sampled subset (i.e. the distance between the random picture and the corresponding sample in the sample set) are calculated, and the set with the minimum batch size is recalled from the subset. And taking the samples corresponding to the recalled first sample characteristics as all reference samples of the current batch, so that all the reference samples in the current batch are relatively similar, and batch acquisition of the reference samples is realized.
After the reference sample is obtained, the positive sample and the negative sample corresponding to the reference sample are also required to be obtained to construct the multi-group sample. Further:
step S22: and obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample characteristic marked with the identification mark.
In the specific implementation process in step S22, for each reference sample, a sample similar to the reference sample needs to be selected as a positive sample, and a sample not similar to the reference sample needs to be selected as a negative sample. Whether the specific similarity is similar or not can be measured by the second similarity or the third similarity. One reference sample may correspond to one positive or negative sample, or to multiple positive or negative samples.
Specifically, the acquisition of a positive sample:
firstly, for the same reference sample, obtaining a second similarity between the reference feature corresponding to the reference sample and the first sample feature marked with the identification mark. If the number of the first sample features marked with the identification marks corresponding to one reference sample is larger, a subset can be randomly selected from the first sample features marked with the identification marks corresponding to the reference sample to calculate the second similarity, and the size of the subset can be 50-100 times or 100-200 times that of the constructed batch of the multi-tuple samples.
Then, when the second similarity belongs to a preset second range, extracting a first sample feature corresponding to the second similarity belonging to the second range as a feature of a positive sample corresponding to the reference sample.
And finally, obtaining a positive sample corresponding to the reference sample according to the characteristics of the positive sample.
In step S22, the extraction may be a full extraction or a partial extraction, for example, a certain number of first sample features are randomly extracted within a specified second range as positive samples corresponding to the reference samples. The second range is not limited and may be determined according to the requirements of the application scenario.
If the similarity between the similar samples and the dissimilar samples in the multi-element group samples is too small, the learning of the constructed multi-element group on the network is too simple, and the network cannot learn the characteristics with strong discriminative power. The hard samples include a reference sample, a positive sample which is not similar to the reference sample, and a negative sample which is similar to the reference sample. At this time, the second range may be defined in an interval where the second similarity representation is not similar or far away to obtain a positive sample that is not similar to the reference sample. In summary, in a preferred embodiment of this embodiment, a less similar sample is selected as the positive sample among samples similar to the reference sample.
Step S23: and obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample characteristic without the identification mark.
In step S23, the method specifically includes the following steps:
firstly, for the same reference sample, obtaining a third similarity between a reference feature corresponding to the reference sample and a first sample feature not marked with the identification mark. If the number of the first sample features not marked with the identification mark corresponding to one reference sample is larger, a subset can be randomly selected from the first sample features not marked with the identification mark corresponding to the reference sample to calculate the third similarity, and the size of the subset can be 50-100 times or 100-200 times that of the constructed batch of the multi-tuple samples.
Then, when the third similarity belongs to a preset third range, extracting a first sample feature corresponding to the third similarity belonging to the third range as a feature of a negative sample corresponding to the reference sample.
And finally, obtaining a negative sample corresponding to the reference sample according to the characteristics of the negative sample.
In step S23, the extraction may be a full extraction or a partial extraction, for example, a certain number of first sample features are randomly extracted within a third range as negative samples corresponding to the reference samples. The determination of the third range is not limited, and may be determined according to the requirements of the application scenario.
In a preferred embodiment of this embodiment, when constructing the hard sample, the third range may be defined in an interval where the third similarity represents similarity or a short distance, so as to obtain a negative sample that is similar to the reference sample. In general, a more similar sample is selected as a negative sample among samples that are not similar to the reference sample.
Through the difficult samples constructed in the steps S22 and S23, the problem that the similarity between similar samples and dissimilar samples is too high, so that the learning of the multi-element group to the network is too difficult, and the network is difficult to converge is solved.
For convenience of calculation, the first sample feature, the second sample feature and/or a third sample feature (as described below) may be normalized before the first similarity, the second similarity and the third similarity are calculated.
In this embodiment, the first range, the second range and the third range may be one or more segmented ranges. For example, when sampling in a plurality of segmented, non-adjacent first areas, by selecting samples that are not more than adjacent, local defects in the samples can be avoided.
Step S24: a first tuple of samples is obtained from the reference sample, a positive sample corresponding to the reference sample, and a negative sample corresponding to the reference sample. Wherein each of the reference samples corresponds to a first tuple of samples. In the current multi-element sample construction, all the first multi-element sample forms a batch sample set required by the current training of the model to be trained.
In the calculation of step S20, because of the existence of the first feature set, the corresponding feature calculation similarity may be directly selected from the first feature set, and the feature does not need to be obtained through the forward calculation of the network model again, thereby improving the calculation efficiency.
Step S30: and carrying out forward calculation according to the first multi-element group sample by the model to be trained to obtain a second sample characteristic.
In step S30, the forward calculation of the first tuple of samples includes the reference samples, which correspond to the positive and negative samples. The new features of the sample can be learned in the forward calculation of the model to be trained, namely the features of the second sample.
Step S40: and updating the first sample characteristic corresponding to the first multi-element group sample into the second sample characteristic in the first characteristic set to obtain a second characteristic set.
In step S40, the second feature set is used to replace the first feature set, and since the first sample feature and the second sample feature are both obtained in the forward calculation by the same sample, the first sample feature corresponding to the second sample feature can be found in the first feature set. For example:
TABLE 1 Prior to update
Sample(s) First feature set
Sample 1 Characteristic A
Sample 2 Characteristic B
... ...
Sample 5 Characteristic E
Sample 6 Characteristic F
Sample 7 Feature G
... ...
Sample N Characteristic X
If the sample 2, the sample 5 and the sample 6 in the table 1 are selected as a multi-group sample, respectively obtaining a feature b, a feature e and a feature f, namely a second sample feature, after forward calculation of the model to be trained; then, step S40 is executed to update the features B, E, and F corresponding to the samples 2, 5, and 6 in the first feature set into features B, E, and F, so as to obtain a second feature set:
after table 2 is updated
Sample(s) Second feature set
Sample 1 Characteristic A
Sample 2 Characteristic b
... ...
Sample 5 Characteristic e
Sample 6 Characteristic f
Sample 7 Feature G
... ...
Sample N Characteristic X
Thus, the distances or distributions between the samples 2, 5, and 6 corresponding to the features b, e, and f are changed with respect to the other samples. The above tables 1 and 2 are only exemplary illustrations, and do not limit the storage form, size, and the like of the feature set.
Step S50: and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
In step S50, the second multi-component sample may be obtained by referring to the first multi-component sample, determining a random feature, extracting a reference feature from the second feature set according to the random feature, obtaining a reference sample according to the reference feature, and obtaining positive and negative samples corresponding to the reference sample according to the reference feature and the sample features in the second feature set, that is, forming the second multi-component sample.
Similarly, when the model to be trained is trained by using the second multi-element group sample, a corresponding third sample feature can be obtained in the forward calculation, and then the corresponding sample feature in the second feature set is replaced/updated to obtain a new set, which can be used as a third feature set.
And circularly executing, obtaining new sample characteristics in the forward calculation of the model to be trained every time, and continuously maintaining the updating of the characteristic set.
And in the whole training process of the model to be trained, the forward calculation process and the backward propagation process are included, and the training is stopped until the convergence condition is met.
Since the method in this embodiment calculates by using the first sample feature in the process of constructing the first multi-element group sample, the calculated distance/similarity between the sample corresponding to the first sample feature/the second sample feature and other samples can be changed after the first sample feature is replaced and updated, that is, the sample distribution is indirectly changed. Therefore, the updating of the feature set can be maintained in the process of training the model to be trained every time. The obtained second multi-tuple sample can guide the convergence of the model to be trained more quickly.
It should be noted that, corresponding to different application scenarios, the samples mentioned in this embodiment include, but are not limited to, pictures and texts in various forms. Steps S10-S50 are performed in a loop throughout the training phase of the model to be trained, and each training may be updated for the feature set once.
In summary, in the training process of the model to be trained, the first sample features in the first feature set are updated by the second sample features obtained in the training of the first multi-element group samples, so as to obtain the second feature set. The distance distribution of the sample characteristics is ensured to be continuously updated and changed when the model to be trained excavates the learning sample in different training stages. When the second multi-element group sample is mined, the method is more targeted, and the multi-element group sample with higher quality and more suitable for the current training stage can be mined. The multi-element group sample obtained by the method can adapt to the learning of the model to be trained in different stages, the model to be trained is guided to reach a better solution more quickly, and the convergence speed and effect of the model to be trained are improved.
Second embodiment
Referring to fig. 3, based on the same inventive concept, in the present embodiment, a multi-element sample constructing apparatus 400 is provided, the apparatus 400 includes:
a first feature set obtaining module 401, configured to obtain a first feature set composed of first sample features.
A first sample obtaining module 402, configured to obtain, according to the first feature set, a first multi-element group sample required by the current training of the preset model to be trained.
A forward calculation module 403, configured to perform forward calculation according to the first multi-group sample through the model to be trained, so as to obtain a second sample characteristic.
An updating module 404, configured to update the first sample feature corresponding to the first multi-group sample in the first feature set to the second sample feature, so as to obtain a second feature set.
A second sample obtaining module 405, configured to obtain, according to the second feature set, a second multi-element group sample required by the next training of the model to be trained.
As an optional implementation manner, the first sample obtaining module 402 is further configured to:
according to random features, extracting reference features from the first feature set, and obtaining reference samples based on the reference features, wherein the random features are obtained by randomly selecting from the first feature set, and first sample features similar to the reference features in the first feature set are all marked with identification marks; obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample characteristic marked with the identification mark; obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample characteristic without the identification mark; obtaining a first multi-tuple sample according to the reference sample, a positive sample corresponding to the reference sample and a negative sample corresponding to the reference sample, wherein each reference sample corresponds to one multi-tuple sample.
As an optional implementation manner, the first sample obtaining module 402 is further configured to:
acquiring a first similarity between the random feature and each first sample feature; when the first similarity belongs to a preset first range, extracting a first sample feature corresponding to the first similarity belonging to the first range as a reference feature; and taking the sample corresponding to the reference characteristic as the reference sample.
As an optional implementation manner, the first sample obtaining module 402 is further configured to:
for the same reference sample, obtaining a second similarity between the reference feature corresponding to the reference sample and the first sample feature marked with the identification mark; when the second similarity belongs to a preset second range, extracting a first sample feature corresponding to the second similarity belonging to the second range as a feature of a positive sample corresponding to the reference sample; and obtaining a positive sample corresponding to the reference sample according to the characteristics of the positive sample.
As an optional implementation manner, the first sample obtaining module 402 is further configured to:
for the same reference sample, obtaining a third similarity between a reference feature corresponding to the reference sample and a first sample feature not marked with the identification mark; when the third similarity belongs to a preset third range, extracting a first sample characteristic corresponding to the third similarity belonging to the third range as a characteristic of a negative sample corresponding to the reference sample; and obtaining the negative sample corresponding to the reference sample according to the characteristics of the negative sample.
As an optional implementation manner, the first sample feature and the second sample feature are both features of a picture.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Third embodiment
Fig. 4 is a block diagram illustrating a multi-tuple sample construction apparatus 800 according to an exemplary embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 4, the apparatus 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing elements 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operation at the device 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power component 806 provides power to the various components of device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 800.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and a user in some embodiments, the screen may include a liquid crystal display (L CD) and a Touch Panel (TP). if the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed state of the device 800, the relative positioning of the components, such as a display and keypad of the apparatus 800, the sensor assembly 814 may also detect a change in position of the apparatus 800 or a component of the apparatus 800, the presence or absence of user contact with the apparatus 800, orientation or acceleration/deceleration of the apparatus 800, and a change in temperature of the apparatus 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast associated information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), programmable logic devices (P L D), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components for performing the methods described above in relation to the first embodiment.
Fourth embodiment
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the device 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A computer-readable storage medium, in particular a non-transitory computer-readable storage medium, having instructions which, when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of tuple sample construction, the method comprising:
obtaining a first feature set consisting of first sample features; obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; forward calculation is carried out according to the first multi-element group sample through the model to be trained, and second sample characteristics are obtained; in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set; and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
Fig. 5 is a schematic structural diagram of a server in an embodiment of the present invention. The server 1900 may vary widely by configuration or performance and may include one or more Central Processing Units (CPUs) 1922 (e.g., one or more processors) and memory 1932, one or more storage media 1930 (e.g., one or more mass storage devices) storing applications 1942 or data 1944. Memory 1932 and storage medium 1930 can be, among other things, transient or persistent storage. The program stored in the storage medium 1930 may include one or more modules (not shown), each of which may include a series of instructions operating on a server. Still further, a central processor 1922 may be provided in communication with the storage medium 1930 to execute a series of instruction operations in the storage medium 1930 on the server 1900.
The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input/output interfaces 1958, one or more keyboards 1956, and/or one or more operating systems 1941, such as Windows server, Mac OS XTM, UnixTM, &lttttranslation = L "&tttl &/t &gttinuxtm, FreeBSDTM, and so forth.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A multi-group sample construction method is characterized by comprising the following steps:
obtaining a first feature set consisting of first sample features;
obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set;
forward calculation is carried out according to the first multi-element group sample through the model to be trained, and second sample characteristics are obtained;
in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set;
and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
2. The method according to claim 1, wherein the step of obtaining a first multi-tuple sample required by the current training of the preset model to be trained according to the first feature set comprises:
according to random features, extracting reference features from the first feature set, and obtaining reference samples based on the reference features, wherein the random features are obtained by randomly selecting from the first feature set, and first sample features similar to the reference features in the first feature set are all marked with identification marks;
obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample characteristic marked with the identification mark;
obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample characteristic without the identification mark;
obtaining a first multi-tuple sample according to the reference sample, a positive sample corresponding to the reference sample and a negative sample corresponding to the reference sample, wherein each reference sample corresponds to one multi-tuple sample.
3. The method according to claim 2, wherein the step of extracting the reference feature from the first feature set according to the random feature and obtaining the reference sample based on the reference feature comprises:
acquiring a first similarity between the random feature and each first sample feature;
when the first similarity belongs to a preset first range, extracting a first sample feature corresponding to the first similarity belonging to the first range as a reference feature;
and taking the sample corresponding to the reference characteristic as the reference sample.
4. The method according to claim 3, wherein the step of obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample feature marked with the identification mark comprises:
for the same reference sample, obtaining a second similarity between the reference feature corresponding to the reference sample and the first sample feature marked with the identification mark;
when the second similarity belongs to a preset second range, extracting a first sample feature corresponding to the second similarity belonging to the second range as a feature of a positive sample corresponding to the reference sample;
and obtaining a positive sample corresponding to the reference sample according to the characteristics of the positive sample.
5. The method according to claim 3, wherein the step of obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample feature not marked with the identification mark comprises:
for the same reference sample, obtaining a third similarity between a reference feature corresponding to the reference sample and a first sample feature not marked with the identification mark;
when the third similarity belongs to a preset third range, extracting a first sample characteristic corresponding to the third similarity belonging to the third range as a characteristic of a negative sample corresponding to the reference sample;
and obtaining the negative sample corresponding to the reference sample according to the characteristics of the negative sample.
6. The method of claim 1, wherein the first sample feature and the second sample feature are both features of a picture.
7. A multi-element sample building apparatus comprising:
the first characteristic set acquisition module is used for acquiring a first characteristic set consisting of first sample characteristics;
the first sample acquisition module is used for acquiring a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set;
the forward calculation module is used for performing forward calculation according to the first multi-element group sample through the model to be trained to obtain a second sample characteristic;
an updating module, configured to update, in the first feature set, a first sample feature corresponding to the first multi-group sample to the second sample feature, so as to obtain a second feature set;
and the second sample acquisition module is used for acquiring a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
8. The apparatus of claim 7, wherein the first sample obtaining module is further configured to:
according to random features, extracting reference features from the first feature set, and obtaining reference samples based on the reference features, wherein the random features are obtained by randomly selecting from the first feature set, and first sample features similar to the reference features in the first feature set are all marked with identification marks;
obtaining a positive sample corresponding to the reference sample according to the reference sample and the first sample characteristic marked with the identification mark;
obtaining a negative sample corresponding to the reference sample according to the reference sample and the first sample characteristic without the identification mark;
obtaining a first multi-tuple sample according to the reference sample, a positive sample corresponding to the reference sample and a negative sample corresponding to the reference sample, wherein each reference sample corresponds to one multi-tuple sample.
9. A multi-tuple sample construction apparatus comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory, and wherein execution of the one or more programs by one or more processors comprises instructions for:
obtaining a first feature set consisting of first sample features; obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; forward calculation is carried out according to the first multi-element group sample through the model to be trained, and second sample characteristics are obtained; in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set; and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
10. A computer-readable storage medium, on which a computer program is stored, which program, when executed by a processor, carries out the steps of:
obtaining a first feature set consisting of first sample features; obtaining a first multi-element group sample required by the current training of a preset model to be trained according to the first feature set; forward calculation is carried out according to the first multi-element group sample through the model to be trained, and second sample characteristics are obtained; in the first feature set, updating the first sample features corresponding to the first multi-element group samples into the second sample features to obtain a second feature set; and obtaining a second multi-element group sample required by the next training of the model to be trained according to the second feature set.
CN201910049706.XA 2019-01-18 2019-01-18 Multi-group sample construction method and device Pending CN111461151A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910049706.XA CN111461151A (en) 2019-01-18 2019-01-18 Multi-group sample construction method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910049706.XA CN111461151A (en) 2019-01-18 2019-01-18 Multi-group sample construction method and device

Publications (1)

Publication Number Publication Date
CN111461151A true CN111461151A (en) 2020-07-28

Family

ID=71678201

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910049706.XA Pending CN111461151A (en) 2019-01-18 2019-01-18 Multi-group sample construction method and device

Country Status (1)

Country Link
CN (1) CN111461151A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112466334A (en) * 2020-12-14 2021-03-09 腾讯音乐娱乐科技(深圳)有限公司 Audio identification method, equipment and medium
CN113792104A (en) * 2021-09-16 2021-12-14 平安科技(深圳)有限公司 Medical data error detection method and device based on artificial intelligence and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112466334A (en) * 2020-12-14 2021-03-09 腾讯音乐娱乐科技(深圳)有限公司 Audio identification method, equipment and medium
CN113792104A (en) * 2021-09-16 2021-12-14 平安科技(深圳)有限公司 Medical data error detection method and device based on artificial intelligence and storage medium
CN113792104B (en) * 2021-09-16 2024-03-01 平安科技(深圳)有限公司 Medical data error detection method and device based on artificial intelligence and storage medium

Similar Documents

Publication Publication Date Title
CN110782468B (en) Training method and device of image segmentation model and image segmentation method and device
JP6918181B2 (en) Machine translation model training methods, equipment and systems
US11455491B2 (en) Method and device for training image recognition model, and storage medium
CN104951335B (en) The processing method and processing device of application program installation kit
CN105389296A (en) Information partitioning method and apparatus
CN109360197B (en) Image processing method and device, electronic equipment and storage medium
CN107133354B (en) Method and device for acquiring image description information
CN109543536B (en) Image identification method and device, electronic equipment and storage medium
CN107341509B (en) Convolutional neural network training method and device and readable storage medium
CN109543069B (en) Video recommendation method and device and computer-readable storage medium
CN111461304A (en) Training method for classifying neural network, text classification method, text classification device and equipment
US20200135205A1 (en) Input method, device, apparatus, and storage medium
CN109819288A (en) Determination method, apparatus, electronic equipment and the storage medium of advertisement dispensing video
CN110889489A (en) Neural network training method, image recognition method and device
CN111461156A (en) Multitask training method and device
CN110941727A (en) Resource recommendation method and device, electronic equipment and storage medium
CN111461151A (en) Multi-group sample construction method and device
CN112948704A (en) Model training method and device for information recommendation, electronic equipment and medium
CN104268149A (en) Clustering method and clustering device
CN107992894B (en) Image recognition method, image recognition device and computer-readable storage medium
CN112259122A (en) Audio type identification method and device and storage medium
CN115512116B (en) Image segmentation model optimization method and device, electronic equipment and readable storage medium
CN110659726B (en) Image processing method and device, electronic equipment and storage medium
CN114299427A (en) Method and device for detecting key points of target object, electronic equipment and storage medium
CN110751223B (en) Image matching method and device, electronic equipment 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
TA01 Transfer of patent application right

Effective date of registration: 20220812

Address after: 100084. Room 9, floor 01, cyber building, building 9, building 1, Zhongguancun East Road, Haidian District, Beijing

Applicant after: BEIJING SOGOU TECHNOLOGY DEVELOPMENT Co.,Ltd.

Address before: 310016 room 1501, building 17, No.57, kejiyuan Road, Baiyang street, Hangzhou Economic and Technological Development Zone, Zhejiang Province

Applicant before: SOGOU (HANGZHOU) INTELLIGENT TECHNOLOGY Co.,Ltd.

Applicant before: BEIJING SOGOU TECHNOLOGY DEVELOPMENT Co.,Ltd.

TA01 Transfer of patent application right