Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can be using the application for generating the method for model or the example of the device for generating model
Property system architecture 100.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105.
Network 104 between terminal device 101,102,103 and server 105 to provide the medium of communication link.Network 104 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102,103 and be interacted by network 104 with server 105, to receive or send out
Send message etc..Various telecommunication customer end applications can be installed, such as video record class is answered on terminal device 101,102,103
With the application of, video playback class, the application of interactive voice class, searching class application, instant messaging tools, mailbox client, social platform
Software etc..
Terminal device 101,102,103 can be hardware, be also possible to software.When terminal device 101,102,103 is hard
When part, it can be the various electronic equipments with display screen, including but not limited to smart phone, tablet computer, on knee portable
Computer and desktop computer etc..When terminal device 101,102,103 is software, above-mentioned cited electricity may be mounted at
In sub- equipment.Multiple softwares or software module (such as providing Distributed Services) may be implemented into it, also may be implemented into
Single software or software module.It is not specifically limited herein.
When terminal device 101,102,103 is hardware, it is also equipped with image capture device thereon.Image Acquisition is set
It is standby to can be the various equipment for being able to achieve acquisition image function, such as camera, sensor.User can use terminal device
101, the image capture device on 102,103, to acquire video.
Server 105 can be to provide the server of various services, such as carrying out data storage and data processing
Data processing server.Sample set is can store in data processing server.It may include a large amount of sample in sample set.Its
In, the sample in above-mentioned sample set can have markup information.In addition, data processing server can use the sample in sample set
This, is trained initial model, and training result (such as the object module generated) can be stored.In this way, can benefit
Corresponding data processing is carried out with the object module trained to realize function that the object module is supported.
It should be noted that server 105 can be hardware, it is also possible to software.When server is hardware, Ke Yishi
The distributed server cluster of ready-made multiple server compositions, also may be implemented into individual server.When server is software,
Multiple softwares or software module (such as providing Distributed Services) may be implemented into, single software or soft also may be implemented into
Part module.It is not specifically limited herein.
It should be noted that the method provided by the embodiment of the present application for generating model is generally held by server 105
Row, correspondingly, the device for generating model is generally positioned in server 105.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
With continued reference to Fig. 2, the process of one embodiment of the method for generating model according to the application is shown
200.The method for being used to generate model, comprising the following steps:
Step 201, sample set is obtained.
It in the present embodiment, can be with for generating the executing subject (such as server 105 shown in FIG. 1) of the method for model
Obtain sample set in several ways.For example, executing subject can by wired connection mode or radio connection, from
It is obtained in another server (such as database server) of storage sample and is stored in existing sample set therein.Example again
Such as, user can collect sample by terminal device (such as terminal device shown in FIG. 1 101,102,103).In this way, above-mentioned
Executing subject can receive sample collected by terminal, and these samples are stored in local, to generate sample set.It needs to refer to
Out, above-mentioned radio connection can include but is not limited to 3G/4G connection, WiFi connection, bluetooth connection, WiMAX connection,
Zigbee connection, UWB (ultra wideband) connection and other currently known or exploitation in the future radio connections.
It herein, may include a large amount of sample in sample set.Wherein, the sample in above-mentioned sample set can be with mark letter
Breath.It should be noted that the sample in sample set can obtain according to actual needs.For example, if desired train one can be into
The model of row image category detection, then the sample in sample set can be sample image, and markup information, which can be, is used to indicate figure
The mark of the classification of picture.For another example if desired training the model for being able to carry out Face datection, then the sample in sample set can
To be sample facial image, the position that markup information can be the face object region being used to indicate in sample image is believed
Breath.
Step 202, the part sample extracted in sample set forms subset.
In the present embodiment, part sample is extracted in the sample set that executing subject can be obtained from step 201 to form
Subset, and execute the training step of step 203 to step 206.Wherein, the extracting mode of sample is in this application and unlimited
System.For example, it is also possible to which a certain number of samples that need to currently extract are extracted according to designated order from sample set.
In machine learning field, the subset for extracting sample composition every time is properly termed as minibatch (mini crowd
It is secondary).The behavior that traversal completes all samples in sample set can be called an epoch (period).As an example, sample set
In have 128000 samples, wherein 128 samples composition subset can be chosen every time, carry out the training of model.In sample set
128000 samples can successively form 1000 subsets.After each subset use, then it is assumed that have passed through an epoch.It needs
It is noted that different epoch, can extract the sample composition subset of different number.For example, first epoch, it can be with every
It is secondary to extract 128 data composition subsets.Second epoch can extract 256 data composition subsets every time.
Since the sample size in usual sample set is larger, in each round training, if in disposable sample set
Whole samples, then time-consuming larger, treatment effeciency is lower.The part sample chosen in sample set herein forms subset, in training,
Each subset carries out a subgradient decline, has finally traversed the sample in sample set, so that the data volume of iteration is smaller every time.
Therefore, time-consuming can be reduced, improve treatment effeciency.
Step 203, the sample in subset is input to initial model, in information and subset based on initial model output
The markup information that sample is had determines the penalty values of each sample inputted.
In the present embodiment, above-mentioned executing subject can first input the sample in subset composed in step 202
To initial model.Wherein, initial model can carry out the processing such as feature extraction, analysis, and then output information to sample.It needs
Bright, above-mentioned initial model can be the model pre-established as needed, be also possible to existing to some as needed
Model carries out obtained model after initial training.For example, if desired training one to be able to carry out image category detection or text
The model of this classification detection, then can be used existing disaggregated model as initial model.As an example, existing disaggregated model
The convolutional neural networks of various existing structures (such as DenseBox, VGGNet, ResNet, SegNet etc.) can be used.?
Support vector machines (Support Vector Machine, SVM) etc. can be used.
After the sample in extracted subset is input to initial model, above-mentioned executing subject can extract introductory die
The information that type is exported.Wherein, each sample inputted can correspond to the information of initial model output.For example, sub
128 samples are concentrated with, then one-to-one 128 information of 128 samples that initial model can be exported and be inputted.
Then, the mark that above-mentioned executing subject can be had based on the sample in the information and the subset that initial model exports
Information is infused, determines the penalty values of each sample inputted.Herein, the target of training initial model is the information for being allowed to export and institute
The difference for the markup information that the sample of input is had is as small as possible.Therefore, it will can be used to characterize the letter of initial model output
The value of the difference of breath and markup information is as penalty values.In practice, various existing loss function (loss can be used
Function), come characterize initial model output information and markup information difference.It, will for each sample inputted
The information corresponding with the sample of initial model output and the markup information of the sample are input to loss function, and the sample can be obtained
This penalty values.
In practice, loss function can be the predicted value (information exported) and true value for estimating initial model
The inconsistent degree of (i.e. markup information).It is a non-negative real-valued function.Under normal circumstances, the value (penalty values) of loss function
Smaller, the robustness of model is better.Loss function can be arranged according to actual needs.For example, it may be using Euclidean away from
From, cross entropy loss function etc..
In some optional implementations of the present embodiment, above-mentioned initial model is also possible to as needed to building in advance
Vertical model carries out obtained model after initial training.Specifically, above-mentioned initial model obtains as follows: Ke Yili
With machine learning method, using the sample in above-mentioned sample set as input, using the markup information of the sample inputted as exporting,
Training obtains initial model.Herein, existing model structure can be used to be trained to obtain initial model.As an example, if
Training one model for image category detection is needed, then can use corresponding sample set, (sample is that can be image, sample
This markup information can serve to indicate that the classification of image), in the way of supervised learning, convolutional neural networks are carried out preliminary
Training.Convolutional neural networks after initial training are determined as initial model.Specifically, sample can be successively extracted from sample set
This is to constitute subset, after being trained using the sample in each subset, can use gradient descent algorithm and carries out to model
It is primary to update.The model that above-mentioned executing subject is trained when the sample in sample set can be traversed and be completed is determined as initially
Model.
Step 204, the penalty values that destination number is chosen according to the sequence of penalty values from small to large, by selected penalty values
Average value be determined as target loss value.
In the present embodiment, above-mentioned executing subject can choose the damage of destination number according to the sequence of penalty values from small to large
The average value of selected penalty values is determined as target loss value by mistake value.Wherein, destination number is less than step 202 and is formed
Subset in sample quantity.In practice, target loss value is the penalty values of the extracted subset.It can be for difference
Training round, preset different destination numbers.Alternatively, it is also possible to set fixed value for destination number.
Since the penalty values of usual noise sample are larger, thus, number of targets is chosen according to the sequence of penalty values from small to large
The penalty values for measuring (less than the quantity of the sample in subset) carry out the training of initial model, can screen out the influence of noise sample,
Help to improve the accuracy of model generated.
In some optional implementations of the present embodiment, destination number can be set in advance for trained round
It is fixed.Round is bigger, and destination number is bigger.For example, destination number can be set for first round training (i.e. first epoch)
It is set to 64.Training (i.e. second epoch) is taken turns for second, destination number can be set to 66.(i.e. for third round training
Third epoch), destination number can be set to 68.For another example for first round training, destination number can be set
It is 64.For the second wheel training, destination number can be set to 68.For third round training, destination number can be set
It is 70.
In some optional implementations of the present embodiment, destination number can also be based on preset initial value and training
Round and calculate automatically.Round is bigger, and destination number is bigger.For example, can be using pre-set initial value as the first round
Destination number used in training.Then, for later each round training, can determine last round of training round and some
The sum of the product and initial value are determined as destination number used in wheel training by the product of specified numerical value.For example, the first round
Training, destination number are initial value 64.Second wheel training, destination number are 66 (64+1 × 2).Third round training, destination number
For 68 (64+2 × 2).And so on.
In some optional implementations of the present embodiment, the initial value of destination number can be the subset formed for the first time
In sample quantity half.
Since in initial model training process, usually with the increase of training round, the performance of initial model (is predicted
Accuracy) usually become better and better, the calculated penalty values of institute are more and more accurate.For showing preferable model, noise sample
Penalty values it is usually larger.After being ranked up penalty values from small to large, the order of noise sample is more rearward.However,
When iteration round is lower, the penalty values that initial model is exported may be not accurate enough.It is inadequate so as to cause the order of noise sample
Rearward.Lesser number is set by destination number at this time, can effectively screen out the penalty values of noise sample.Help to improve model
Training effect, make training after model have preferably performance.Therefore, destination number is set as increasing with training round
And the numerical value increased, the accuracy of model generated can be improved.
Step 205, it is based on target loss value, determines whether initial model trains completion.
In the present embodiment, above-mentioned executing subject can be based on target loss value, and benefit determines initial model in various manners
Whether completion is trained.As an example, above-mentioned executing subject can determine whether target loss value has restrained.When determining target loss
When value convergence, then it can determine that initial model at this time has trained completion.As another example, above-mentioned executing subject can be first
Target loss value is compared with preset value.In response to determining that target loss value is less than or equal to preset value, can count most
In target loss value determined by close preset quantity (such as 100) secondary training step, less than or equal to the mesh of above-mentioned preset value
The quantity of mark penalty values accounts for the ratio of the preset quantity.When the ratio is greater than preset ratio (such as 95%), can determine just
Beginning model training is completed.It should be noted that preset value can be generally used for indicating inconsistent between predicted value and true value
The ideal situation of degree.That is, when penalty values are less than or equal to preset value, it is believed that predicted value is nearly or approximately true
Real value.Preset value can be arranged according to actual needs.
It should be noted that can then continue to execute step 206 in response to determining that initial model has trained completion.Response
In determining that initial model not complete by training, the target loss value based on determined by step 204 updates the ginseng in initial model
Number, extracts sample composition subset again from above-mentioned sample set, initial model after using undated parameter as initial model, after
It is continuous to execute above-mentioned training step.Herein, it can use back-propagation algorithm and acquire ladder of the target loss value relative to model parameter
Degree is then based on gradient updating model parameter using gradient descent algorithm.It should be pointed out that the penalty values that do not choose are not involved in
Gradient decline.It should be noted that above-mentioned back-propagation algorithm, gradient descent algorithm and machine learning method are extensive at present
The well-known technique of research and application, details are not described herein.
It is above-mentioned to hold in response to determining that initial model not complete by training in some optional implementations of the present embodiment
Row main body can be based on above-mentioned target loss value, update the parameter in initial model.And it is possible to which determining in above-mentioned sample set is
It is no to there is the sample for being not carried out above-mentioned training step.It is understood that when there is the sample for being not carried out training step in sample set
This, it is meant that epicycle (current epoch) training does not complete, i.e., the sample in epicycle sample set does not traverse completion.At this point it is possible to from
It is not carried out in the sample of above-mentioned training step and extracts sample composition subset, initial model after using undated parameter is as introductory die
Type continues to execute above-mentioned training step.In general, in same wheel (same epoch) training process, the quantity of the sample extracted every time
(quantity of the sample in subset formed every time) can be identical.Therefore, the quantity of sample extracted here can be with
It is identical as the quantity of the sample extracted in step 202.
Optionally, in response in the above-mentioned sample set of determination there is no the sample of above-mentioned training step is not carried out, i.e., epicycle (when
Preceding epoch) training be completed and epicycle sample set in sample traversed completion.Can then determine whether destination number is small
In default value.As an example, default value can be set to be less than the sample if the quantity of the sample in subset is 128
The value of quantity, such as 110 or 120.It, can be by destination number and designated value in response to determining that destination number is less than default value
The sum of (such as 2) are used as destination number, and the initial model after using undated parameter extracts above-mentioned sample as initial model again
The part sample of concentration forms subset, continues to execute above-mentioned training step.It is understood that since a training in rotation being completed at this time
Practice, therefore, it is to carry out next round training that the part sample composition subset extracted again in above-mentioned sample set herein, which is trained,.
Optionally, in response to determining that destination number is not less than above-mentioned default value, update is can be used in above-mentioned executing subject
Initial model after parameter extracts the part sample composition subset in above-mentioned sample set again, continues to execute as initial model
Above-mentioned training step.It is understood that since wheel training being completed at this time, extract above-mentioned sample set again herein
In part sample composition subset be trained, be carry out next round training.
Step 206, in response to determining that initial model training is completed, the initial model after training is determined as object module.
In the present embodiment, in response to determine initial model training complete, above-mentioned executing subject can will after training at the beginning of
Beginning model is determined as object module.
In some optional implementations of the present embodiment, the sample in above-mentioned sample set is Sample video, sample institute
The markup information having is used to indicate the classification of Sample video, and above-mentioned object module is for detecting the other video classification of video class
Detection model.
In some optional implementations of the present embodiment, object module can be stored in this by above-mentioned executing subject
Ground can also send it to other electronic equipments (such as terminal device shown in FIG. 1 101,102,103).
With continued reference to the signal that Fig. 3, Fig. 3 are according to the application scenarios of the method for generating model of the present embodiment
Figure.In the application scenarios of Fig. 3, in the application scenarios of Fig. 3, mould can be installed on terminal device 301 used by a user
Type training class application.When user opens the application, and after uploading the store path of sample set or sample set, after providing the application
The server 302 that platform is supported can run the method for generating model, comprising:
It is possible, firstly, to obtain sample set.Wherein, the sample in above-mentioned sample set has markup information.
Then, the part sample composition subset 303 in above-mentioned sample set is extracted, executes following training step: by subset 303
In sample be input to initial model 304, the mark that the information based on initial model output, the sample in subset 303 are had
Information determines the penalty values of each sample inputted.Then, destination number can be chosen according to the sequence of penalty values from small to large
Penalty values, the average value of selected penalty values is determined as target loss value 305, wherein destination number is less than selected
Penalty values quantity.Then, it can be based on above-mentioned target loss value, determine whether initial model trains completion.If it is determined that instruction
Practice and complete, the initial model after training can be determined as object module 306.
The method provided by the above embodiment of the application can therefrom extract sample composition subset by obtaining sample set
To carry out the training of initial model.Wherein, the sample in sample set has markup information.In this way, by the sample in the subset of extraction
Originally it is input to initial model, the corresponding information of each sample of initial model output can be obtained.Later, defeated based on initial model
The markup information that sample in information out, extracted subset is had, can determine the penalty values of each sample inputted.
Then, the loss of destination number (less than the quantity of the sample in subset) can be chosen according to the sequence of penalty values from small to large
Value, is determined as target loss value for the average value of selected penalty values.Later, introductory die can be determined based on target loss value
Whether type trains completion.If initial model training is completed, so that it may which the initial model after training is determined as object module.By
It is larger in the penalty values of usual noise sample, thus, destination number, which is chosen, according to the sequence of penalty values from small to large (is less than subset
In sample quantity) penalty values carry out initial model training, the influence of noise sample can be screened out, improve and generated
Model accuracy.
With further reference to Fig. 4, it illustrates the processes 400 of another embodiment of the method for generating model.The use
In the process 400 for the method for generating model, comprising the following steps:
Step 401, sample set is obtained.
It in the present embodiment, can be with for generating the executing subject (such as server 105 shown in FIG. 1) of the method for model
Obtain sample set.It herein, may include a large amount of sample in sample set.Wherein, the sample in above-mentioned sample set can be with mark
Infuse information.
In the present embodiment, the sample in above-mentioned sample set can be Sample video, and the markup information that sample is had can
To be used to indicate the classification of Sample video,
Step 402, the part sample extracted in sample set forms subset.
In the present embodiment, part sample is extracted in the sample set that executing subject can be obtained from step 401 to form
Subset, and execute the training step of step 403 to step 411.Wherein, the extracting mode of sample is in this application and unlimited
System.For example, the sample that need to currently extract can be extracted according to designated order from sample set.
Step 403, the sample in subset is input to initial model, the information and extracted based on initial model output
The markup information that sample in subset is had determines the penalty values of each sample inputted.
In the present embodiment, above-mentioned executing subject can first input the sample in subset composed in step 402
To initial model.Then, the information that initial model is exported can be extracted.Wherein, each sample inputted can correspond to
The information of one initial model output.Then, it can be had based on the sample in the information and the subset that initial model exports
Markup information, determine the penalty values of each sample inputted.It should be noted that the calculating operation of penalty values and step 203
In it is documented operation it is essentially identical, details are not described herein again.
In the present embodiment, above-mentioned initial model can be initial training is carried out to the model that pre-establishes as needed after
Obtained model.Specifically, above-mentioned initial model obtains as follows: it can use machine learning method, it will be above-mentioned
Sample in sample set is as input, and using the markup information of the sample inputted as output, training obtains initial model.This
Place, can be used existing model structure and is trained to obtain initial model.
In the present embodiment, the model for being used to carry out video classification detection can be trained.Above-mentioned executing subject can be with
In the way of supervised learning, initial training is carried out to convolutional neural networks.Convolutional neural networks after training are determined as just
Beginning model.It should be noted that each subset traversal is completed, then it can use gradient descent algorithm and model carried out once more
Newly.The model that above-mentioned executing subject is trained when the sample in sample set can be traversed and be completed is determined as initial model.
Step 404, the penalty values that destination number is chosen according to the sequence of penalty values from small to large, by selected penalty values
Average value be determined as target loss value.
In the present embodiment, above-mentioned executing subject can choose the damage of destination number according to the sequence of penalty values from small to large
The average value of selected penalty values is determined as target loss value by mistake value.Wherein, destination number can be less than step 402 institute
The quantity of sample in the subset of composition.Since the penalty values of usual noise sample are larger, thus, from small to large according to penalty values
Sequence choose destination number penalty values carry out initial model training, the influence of noise sample can be screened out, help to mention
The accuracy of high model generated.
In the present embodiment, destination number can also be calculated automatically based on preset initial value and the round trained.Wheel
Secondary bigger, destination number is bigger.For example, can be using pre-set initial value as the first round (i.e. first epoch) training
Used destination number.Herein, the initial value of destination number can be the two of the quantity of the sample in the subset formed for the first time
/ mono-.It then, can be by destination number used in last round of training and some specified number for each round training later
The sum of value (such as 2) is determined as destination number used in wheel training.For example, first round training, destination number is initial value
64.Second wheel training, destination number are 66 (64+2).Third round training, destination number are 68 (66+2).And so on, until
When destination number reaches default value (such as 110).After destination number reaches default value, in each round training later
In, no longer destination number can be updated.
Since in initial model training process, usually with the increase of training round, the performance of initial model (is predicted
Accuracy) usually become better and better, the calculated penalty values of institute are more and more accurate.For showing preferable model, noise sample
Penalty values it is usually larger.After being ranked up penalty values from small to large, the order of noise sample is more rearward.However,
When iteration round is lower, the penalty values that initial model is exported may be not accurate enough.It is inadequate so as to cause the order of noise sample
Rearward.Lesser number is set by destination number at this time, can effectively screen out the penalty values of noise sample.Help to improve model
Training effect, make training after model have preferably performance.Therefore, destination number is set as increasing with training round
And the numerical value increased, the accuracy of model generated can be improved.
Step 405, it is based on target loss value, determines whether initial model trains completion.
In the present embodiment, above-mentioned executing subject can be based on target loss value, and benefit determines initial model in various manners
Whether completion is trained.As an example, above-mentioned executing subject can determine whether target loss value has restrained.When determining target loss
When value convergence, then it can determine that initial model at this time has trained completion.
It should be noted that can then continue to execute step 411 in response to determining that initial model training is completed.In response to
Determine that initial model not complete by training, can execute step 406.
Step 406, in response to determining that initial model not complete by training, is based on target loss value, updates in initial model
Parameter determines in sample set with the presence or absence of the sample for being not carried out above-mentioned training step.
In the present embodiment, in response to determining that initial model not complete by training, above-mentioned executing subject can be based on above-mentioned mesh
Penalty values are marked, the parameter in initial model is updated.Herein, it can use back-propagation algorithm and acquire target loss value relative to mould
The gradient of shape parameter is then based on gradient updating model parameter using gradient descent algorithm.It should be pointed out that the damage that do not choose
Mistake value is not involved in gradient decline.It should be noted that above-mentioned back-propagation algorithm, gradient descent algorithm and machine learning method
It is the well-known technique studied and applied extensively at present, details are not described herein.At the same time, can determine in above-mentioned sample set whether
In the presence of the sample for being not carried out above-mentioned training step.If it exists, step 407 can be executed, if it does not exist, step 408 can be executed.
Step 407, in response to determining the sample for existing in sample set and being not carried out training step, training step is not carried out
Sample is extracted in sample and forms subset, and the initial model after using undated parameter continues to execute training step as initial model.
It is understood that when there is the sample for being not carried out training step in sample set, it is meant that epicycle (current epoch)
Training does not complete, i.e., the sample in epicycle sample set does not traverse completion.At this point it is possible to which the sample of above-mentioned training step is not carried out
Middle extraction sample forms subset, and the initial model after using undated parameter continues to execute above-mentioned training step as initial model.
Step 408, in response to, there is no the sample for being not carried out above-mentioned training step, determining target in the above-mentioned sample set of determination
Whether quantity is less than default value.
In the present embodiment, the sample of above-mentioned training step is not carried out in response to being not present in the above-mentioned sample set of determination, on
Stating executing subject can determine whether current destination number is less than default value.As an example, if the number of the sample in subset
Amount is 128, then default value can be set to the value less than the sample size, such as 110 or 120.In response to determining target
Quantity is less than default value, can execute step 409.In response to determining that destination number is not less than default value, step can be performed
410。
Step 409, in response to determining that destination number is less than default value, the sum of destination number and designated value are regard as target
Quantity, for the initial model after using undated parameter as initial model, the part sample extracted in sample set again forms subset,
Continue to execute training step.
In the present embodiment, in response to determining that destination number is less than default value, above-mentioned executing subject can be by number of targets
The sum of amount and designated value (such as 2) are used as destination number, and the initial model after using undated parameter mentions again as initial model
It takes the part sample in above-mentioned sample set to form subset, continues to execute above-mentioned training step.It is understood that due at this time
A wheel training is completed, therefore, it is to carry out down that the part sample composition subset extracted again in above-mentioned sample set herein, which is trained,
One wheel training.
Step 410, in response to determining that destination number is not less than above-mentioned default value, the initial model after undated parameter is used
As initial model, the part sample composition subset in above-mentioned sample set is extracted again, continues to execute above-mentioned training step.
In the present embodiment, in response to determining that destination number is not less than above-mentioned default value, above-mentioned executing subject can make
Initial model after using undated parameter extracts the part sample composition subset in above-mentioned sample set as initial model again, after
It is continuous to execute above-mentioned training step.It is understood that since wheel training being completed at this time, it extracts again herein above-mentioned
Part sample composition subset in sample set is trained, and is to carry out next round training.It should be noted that training at this time
Destination number used in journey is without updating.
Step 411, in response to determining that initial model training is completed, the initial model after training is determined as object module.
In the present embodiment, in response to determine initial model training complete, above-mentioned executing subject can will after training at the beginning of
Beginning model is determined as object module.Herein, above-mentioned object module is for detecting the other video classification detection model of video class.
Figure 4, it is seen that the method for generating model compared with the corresponding embodiment of Fig. 2, in the present embodiment
Process 400 relate in the training process, gradually increase destination number, that is, gradually increase the quantity of selected penalty values
Operation.Thus, it is possible to further increase the accuracy of model generated.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides one kind for generating mould
One embodiment of the device of type, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which can specifically answer
For in various electronic equipments.
As shown in figure 5, being used to generate the device 500 of model described in the present embodiment includes: acquiring unit 501, it is configured
At acquisition sample set, wherein the sample in above-mentioned sample set has markup information;Training unit 502 is configured to extract above-mentioned
Part sample in sample set forms subset, executes following training step: the sample in above-mentioned subset is input to initial model,
The markup information that sample in information, above-mentioned subset based on initial model output is had, determines each sample inputted
Penalty values;The penalty values that destination number is chosen according to the sequence of penalty values from small to large, by the average value of selected penalty values
It is determined as target loss value, wherein destination number is less than the quantity of the sample in above-mentioned subset;Based on above-mentioned target loss value,
Update the parameter in initial model;Determine whether initial model trains completion;If so, the initial model after training is determined as mesh
Mark model.
In some optional embodiments of the present embodiment, which further includes the first determination unit and the first execution unit
(not shown).Wherein, above-mentioned first determination unit may be configured in response to determining that initial model not complete by training, really
With the presence or absence of the sample for being not carried out above-mentioned training step in fixed above-mentioned sample set.Above-mentioned first execution unit may be configured to ring
Should exist in determining, be not carried out in the sample of above-mentioned training step and extract sample composition subset, using first after undated parameter
Beginning model continues to execute above-mentioned training step as initial model.
In some optional embodiments of the present embodiment, which further includes the second determination unit and the second execution unit
(not shown).Wherein, above-mentioned second determination unit is configured in response to determine in above-mentioned sample set that there is no be not carried out
The sample of above-mentioned training step, determines whether destination number is less than default value;Second execution unit is configured in response to really
The quantity that sets the goal is less than default value, the sum of destination number and preset quantity is regard as destination number, after undated parameter
Initial model extracts the part sample composition subset in above-mentioned sample set again, continues to execute above-mentioned training as initial model
Step.
In some optional embodiments of the present embodiment, which further includes third execution unit (not shown).
Wherein, above-mentioned third execution unit is configured in response to determine that destination number not less than above-mentioned default value, is joined using updating
Initial model after number extracts the part sample composition subset in above-mentioned sample set again, continues to execute as initial model
State training step.
In some optional embodiments of the present embodiment, the initial value of destination number can be in the subset formed for the first time
Sample quantity half.
In some optional embodiments of the present embodiment, initial model can obtain as follows: utilize machine
Learning method, it is trained using the markup information of the sample inputted as exporting using the sample in above-mentioned sample set as input
To initial model.
In some optional embodiments of the present embodiment, the sample in above-mentioned sample set can be Sample video, sample
The markup information being had can serve to indicate that the classification of Sample video, and above-mentioned object module can be for for detecting video classification
Video classification detection model.
The device provided by the above embodiment of the application obtains sample set by acquiring unit 501, can therefrom extract sample
This composition subset is to carry out the training of initial model.Wherein, the sample in sample set has markup information.In this way, training unit
Sample in the subset of extraction is input to initial model by 502, can obtain the corresponding letter of each sample of initial model output
Breath.Later, the mark letter that the sample in training unit 502 is exported based on initial model information, extracted subset is had
Breath, can determine the penalty values of each sample inputted.Then, number of targets can be chosen according to the sequence of penalty values from small to large
The penalty values for measuring (less than the quantity of the sample in subset), are determined as target loss value for the average value of selected penalty values.
Later, it can determine whether initial model trains completion based on target loss value.If initial model training is completed, so that it may will
Initial model after training is determined as object module.Since the penalty values of usual noise sample are larger, thus, according to penalty values from
The small penalty values for choosing destination number (less than the quantity of the sample in subset) to big sequence carry out the training of initial model, can
To screen out the influence of noise sample, the accuracy of model generated is improved.
Fig. 6 is referred to, it illustrates provided by the present application for detecting the stream of one embodiment of video class method for distinguishing
Journey 600.This is used to detect video class method for distinguishing and may comprise steps of:
Step 601, target video is received.
In the present embodiment, for detecting the other executing subject of video class (such as server shown in FIG. 1 105, Huo Zhecun
Contain other servers of video classification detection model) it can use wired connection or radio connection, it receives terminal and sets
Target video transmitted by standby (such as terminal device shown in FIG. 1 101,102,103).
Step 602, by the frame input video classification detection model in target video, video classification testing result is obtained.
In the present embodiment, the frame input video classification in above-mentioned target video can be detected mould by above-mentioned executing subject
Type obtains video classification testing result.Video classification detection model can be using the generation as described in above-mentioned Fig. 2 embodiment
The method of object module and generate.Specific generating process may refer to the associated description of Fig. 2 embodiment, and details are not described herein again.
Video classification testing result can serve to indicate that the classification of target video
In some optional implementations of the present embodiment, above-mentioned executing subject is obtaining video classification testing result
Afterwards, target video can be stored in video library corresponding with classification indicated by the video classification testing result.
The present embodiment can be used for detecting the classification of video for detecting video class method for distinguishing, can be improved video classification
The accuracy of detection.
With continued reference to Fig. 7, as the realization to method shown in above-mentioned Fig. 6, this application provides one kind for detecting video
One embodiment of the device of classification.The Installation practice is corresponding with embodiment of the method shown in fig. 6, which specifically can be with
Applied in various electronic equipments.
As shown in fig. 7, being used to detect the other device 700 of video class described in the present embodiment includes: receiving unit 701, quilt
It is configured to receive target video;Input unit 702 is configured to the frame input video classification in above-mentioned target video detecting mould
Type obtains video classification testing result.
It is understood that all units recorded in the device 700 and each step phase in the method with reference to Fig. 6 description
It is corresponding.As a result, above with respect to the operation of method description, the beneficial effect of feature and generation be equally applicable to device 700 and its
In include unit, details are not described herein.
Below with reference to Fig. 8, it illustrates the computer systems 800 for the electronic equipment for being suitable for being used to realize the embodiment of the present application
Structural schematic diagram.Electronic equipment shown in Fig. 8 is only an example, function to the embodiment of the present application and should not use model
Shroud carrys out any restrictions.
As shown in figure 8, computer system 800 includes central processing unit (CPU) 801, it can be read-only according to being stored in
Program in memory (ROM) 802 or be loaded into the program in random access storage device (RAM) 803 from storage section 808 and
Execute various movements appropriate and processing.In RAM 803, also it is stored with system 800 and operates required various programs and data.
CPU 801, ROM 802 and RAM 803 are connected with each other by bus 804.Input/output (I/O) interface 805 is also connected to always
Line 804.
I/O interface 805 is connected to lower component: the importation 806 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 807 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 808 including hard disk etc.;
And the communications portion 809 of the network interface card including LAN card, modem etc..Communications portion 809 via such as because
The network of spy's net executes communication process.Driver 810 is also connected to I/O interface 805 as needed.Detachable media 811, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 810, in order to read from thereon
Computer program be mounted into storage section 808 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communications portion 809, and/or from detachable media
811 are mounted.When the computer program is executed by central processing unit (CPU) 801, limited in execution the present processes
Above-mentioned function.It should be noted that computer-readable medium described herein can be computer-readable signal media or
Computer readable storage medium either the two any combination.Computer readable storage medium for example can be --- but
Be not limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.
The more specific example of computer readable storage medium can include but is not limited to: have one or more conducting wires electrical connection,
Portable computer diskette, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only deposit
Reservoir (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory
Part or above-mentioned any appropriate combination.In this application, computer readable storage medium, which can be, any include or stores
The tangible medium of program, the program can be commanded execution system, device or device use or in connection.And
In the application, computer-readable signal media may include in a base band or the data as the propagation of carrier wave a part are believed
Number, wherein carrying computer-readable program code.The data-signal of this propagation can take various forms, including but not
It is limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer
Any computer-readable medium other than readable storage medium storing program for executing, the computer-readable medium can send, propagate or transmit use
In by the use of instruction execution system, device or device or program in connection.Include on computer-readable medium
Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc., Huo Zheshang
Any appropriate combination stated.
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard
The mode of part is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor packet
Include acquiring unit and training unit.Wherein, the title of these units does not constitute the limit to the unit itself under certain conditions
It is fixed, for example, acquiring unit is also described as " obtaining the unit of sample set ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can be
Included in device described in above-described embodiment;It is also possible to individualism, and without in the supplying device.Above-mentioned calculating
Machine readable medium carries one or more program, when said one or multiple programs are executed by the device, so that should
Device: sample set is obtained;The part sample composition subset in the sample set is extracted, executes following training step: will be in the subset
Sample be input to initial model, the markup information that the information based on initial model output, the sample in the subset are had, really
The penalty values of the fixed each sample inputted;The penalty values of destination number are chosen according to the sequence of penalty values from small to large, it will be selected
The average value of the penalty values taken is determined as target loss value;Based on the target loss value, the parameter in initial model is updated;It determines
Whether initial model trains completion;If so, the initial model after training is determined as object module.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein
Can technical characteristic replaced mutually and the technical solution that is formed.