WO2021169473A1 - 模型性能优化方法、装置、设备及存储介质 - Google Patents

模型性能优化方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2021169473A1
WO2021169473A1 PCT/CN2020/134671 CN2020134671W WO2021169473A1 WO 2021169473 A1 WO2021169473 A1 WO 2021169473A1 CN 2020134671 W CN2020134671 W CN 2020134671W WO 2021169473 A1 WO2021169473 A1 WO 2021169473A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
trained
training data
loss function
function value
Prior art date
Application number
PCT/CN2020/134671
Other languages
English (en)
French (fr)
Inventor
蔡林
周古月
吴泽衡
徐倩
杨强
Original Assignee
深圳前海微众银行股份有限公司
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 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2021169473A1 publication Critical patent/WO2021169473A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Definitions

  • This application relates to the field of machine learning technology, and in particular to a method, device, device, and storage medium for optimizing model performance.
  • the main purpose of this application is to provide a model performance optimization method, device, equipment and storage medium, aiming to solve the problem of inaccurate model prediction or classification effect due to the use of incorrectly labeled negative examples to train the model. problem.
  • the model performance optimization method includes the following steps:
  • the loss function value corresponding to the negative training data is corrected, wherein the corrected loss function value is less than the corrected The previous loss function value
  • the prediction result is the probability that the negative training data is predicted to be a negative example, and when the prediction result indicates that the probability that the negative training data is predicted to be a negative example is greater than a preset threshold ,
  • the step of correcting the loss function value corresponding to the negative example training data includes:
  • the loss correction coefficient is multiplied by the loss function value corresponding to the negative example training data to correct the loss function value.
  • the step of obtaining a preset loss correction coefficient includes:
  • the prediction result is substituted into a preset smooth descent formula to obtain the loss correction coefficient, wherein the loss correction coefficient becomes smaller as the prediction result becomes larger .
  • ⁇ (p) is the loss correction coefficient
  • is the preset threshold
  • p is the prediction result.
  • the method before the step of inputting preset negative training data into the model to be trained to obtain a prediction result, the method further includes:
  • the step of adjusting the model parameters of the model to be trained according to the corrected loss function value includes:
  • the model parameters of the model to be trained are adjusted.
  • the step of adjusting the model parameters of the model to be trained according to the corrected loss function value to train the model to be trained to obtain a target model includes:
  • the model to be trained after adjusting the model parameters is used as the target model.
  • the model to be trained is a model for detecting farms in remote sensing satellite images, and the model parameters of the model to be trained are adjusted according to the corrected loss function value to compare the model to be trained. After the step of training to obtain the target model, it also includes:
  • the method before the step of inputting preset negative training data into the model to be trained to obtain a prediction result, the method further includes:
  • the data augmentation operation includes at least a distortion operation, a flip operation, and an addition. Noise operation.
  • the loss function is:
  • DL 2 is the loss function value
  • p is the classification category of the pixel output by the model to be trained
  • n is the number of the pixel
  • N is the total number of pixels
  • r is the label category of the pixel
  • is the preset A minimum value.
  • the step of correcting the loss function value corresponding to the negative training data so that the corrected loss function value is smaller than the loss function value before the correction includes:
  • the loss function value corresponding to the negative training data is reduced by a preset value, and the loss function value corresponding to the negative training data is multiplied by a preset positive number less than 1.
  • the adjusting the model parameters of the model to be trained according to the corrected loss function value includes:
  • the gradient corresponding to the model parameter is calculated according to the corrected loss function value, and the model parameter is correspondingly updated according to the gradient of each model parameter.
  • the present application also provides a model performance optimization device, the model performance optimization device includes:
  • the input module is used to input preset negative training data into the model to be trained to obtain a prediction result
  • the correction module is used to correct the loss function value corresponding to the negative training data when the prediction result indicates that the probability that the negative training data is predicted to be a negative is greater than a preset threshold, where the corrected The loss function value is less than the loss function value before correction;
  • the adjustment module is used to adjust the model parameters of the model to be trained according to the corrected loss function value, so as to train the model to be trained to obtain a target model.
  • the prediction result includes the probability that the negative example training data is predicted to be a negative example
  • the correction module includes:
  • An obtaining unit configured to obtain a preset loss correction coefficient when the prediction result is greater than the preset threshold, wherein the loss correction coefficient is a positive number less than 1;
  • the correction unit is configured to multiply the loss correction coefficient by the loss function value corresponding to the negative example training data to correct the loss function value.
  • the acquiring unit includes:
  • the calculation unit is configured to, when the prediction result is greater than the preset threshold, substitute the prediction result into a preset smooth descent formula to obtain the loss correction coefficient, wherein the loss correction coefficient follows the prediction result Get bigger and get smaller.
  • the model performance optimization device further includes:
  • the preliminary training module is used to perform preliminary training on the initial model based on preset positive training data to obtain the model to be trained;
  • the adjustment module includes:
  • the first adjustment unit is configured to adjust the model parameters of the model to be trained according to the loss function value corresponding to the positive training data and the revised loss function value corresponding to the negative training data.
  • the adjustment module includes:
  • the second adjustment unit is configured to adjust the model parameters of the model to be trained according to the corrected loss function value
  • the detection unit is used to detect whether the model to be trained after adjusting the model parameters meets the preset model conditions
  • the third adjustment unit is configured to, if it is detected that the model to be trained after adjusting the model parameters does not meet the preset model conditions, after adjusting the preset threshold according to the preset rules, based on the model to be trained after adjusting the model parameters , And then perform the steps: input the preset negative training data into the model to be trained to obtain the prediction result; and
  • the determining unit is configured to, if it is detected that the model to be trained after adjusting the model parameters satisfies the preset model condition, the model to be trained after adjusting the model parameters is used as the target model.
  • the model to be trained is a model for detecting farms in remote sensing satellite images
  • the model performance optimization device further includes:
  • An image input module configured to input the satellite image to be detected into the target model to obtain a classification result of each pixel in the satellite image to be detected, wherein the classification result is used to indicate whether the corresponding pixel belongs to a farm;
  • the detection module is used to obtain the detection result of the breeding farm of the satellite image to be detected according to the classification result.
  • the model performance optimization device further includes:
  • the augmentation module is configured to perform data augmentation operations on the collected remote sensing satellite images to obtain the negative example training data, wherein the annotation corresponding to the remote sensing satellite image is the negative example annotation, and the data augmentation operation includes at least distortion Operation, flip operation and noise adding operation.
  • this application also provides a model performance optimization device.
  • the model performance optimization device includes a memory, a processor, and a model performance optimization program that is stored in the memory and can run on the processor, When the model performance optimization program is executed by the processor, the steps of the model performance optimization method described above are implemented.
  • this application also proposes a computer-readable storage medium with a model performance optimization program stored on the computer-readable storage medium, and when the model performance optimization program is executed by a processor, the above-mentioned The steps of the model performance optimization method.
  • the prediction result is obtained by inputting negative training data into the model to be trained during the training process of the model to be trained.
  • the loss function value of the negative training data is corrected so that the corrected loss function value is smaller than the corrected loss function value, and the model parameters of the model to be trained are adjusted according to the corrected loss function value to obtain the target model, so that it is actually negative
  • the training data of negative examples with a higher probability of example has an increased effect on the convergence of the loss function, so in comparison, the training data of negative examples with a higher probability of actually being a positive example has a reduced effect on the convergence of the loss function, and then It can reduce the influence of falsely labeled negative example training data on model training, thereby avoiding the reduction of the prediction or classification accuracy of the final target model, that is, improving the prediction or classification accuracy of the target model, and improving the performance of the model.
  • FIG. 1 is a schematic structural diagram of a hardware operating environment involved in a solution of an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for optimizing model performance of this application
  • FIG. 3 is a diagram of a value case of a loss correction coefficient involved in an embodiment of the application.
  • Fig. 4 is a functional schematic block diagram of a preferred embodiment of the model performance optimization device of the present application.
  • FIG. 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
  • model performance optimization device in the embodiment of the present application may be a smart phone, a personal computer, a server, and other devices, which are not specifically limited here.
  • the model performance optimization device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
  • the device structure shown in FIG. 1 does not constitute a limitation on the model performance optimization device, and may include more or less components than shown in the figure, or a combination of certain components, or a different component arrangement .
  • a memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a model performance optimization program.
  • the operating system is a program that manages and controls equipment hardware and software resources, and supports the operation of model performance optimization programs and other software or programs.
  • the user interface 1003 is mainly used to communicate with the client;
  • the network interface 1004 is mainly used to establish a communication connection with the server;
  • the processor 1001 can be used to call the model stored in the memory 1005 for performance optimization Program and do the following:
  • the loss function value corresponding to the negative training data is corrected, wherein the corrected loss function value is less than the corrected The previous loss function value
  • the prediction result is the probability that the negative training data is predicted to be a negative example, and when the prediction result indicates that the probability that the negative training data is predicted to be a negative example is greater than a preset threshold ,
  • the step of correcting the loss function value corresponding to the negative example training data includes:
  • the loss correction coefficient is multiplied by the loss function value corresponding to the negative example training data to correct the loss function value.
  • the step of obtaining a preset loss correction coefficient includes:
  • the prediction result is substituted into a preset smooth descent formula to obtain the loss correction coefficient, wherein the loss correction coefficient becomes smaller as the prediction result becomes larger .
  • the processor 1001 may also be used to call a model performance optimization program stored in the memory 1005 to perform the following operations:
  • the step of adjusting the model parameters of the model to be trained according to the corrected loss function value includes:
  • the model parameters of the model to be trained are adjusted.
  • the step of adjusting the model parameters of the model to be trained according to the corrected loss function value to train the model to be trained to obtain a target model includes:
  • the model to be trained after adjusting the model parameters is used as the target model.
  • the model to be trained is a model for detecting farms in remote sensing satellite images, and the model parameters of the model to be trained are adjusted according to the corrected loss function value to compare the model parameters to the model to be trained.
  • the processor 1001 may also be used to call the model performance optimization program stored in the memory 1005 to perform the following operations:
  • the processor 1001 may also be used to call a model performance optimization program stored in the memory 1005 to perform the following operations:
  • the data augmentation operation includes at least a distortion operation, a flip operation, and an addition. Noise operation.
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for optimizing model performance of this application.
  • the embodiment of the application provides an embodiment of the model performance optimization method. It should be noted that although the logical sequence is shown in the flowchart, in some cases, the sequence shown or shown may be executed in a different order than here. Describe the steps.
  • the execution subject of each embodiment of the model performance optimization method of the present application may be devices such as a smart phone, a personal computer, and a server. For ease of description, the execution subject is omitted in the following embodiments.
  • the model performance optimization method includes:
  • Step S10 input the preset negative training data into the model to be trained to obtain a prediction result
  • a model can be preset, and the model structure can be a commonly used model structure for the target task.
  • the image target detection task can use the commonly used image target detection model, such as the semantic image segmentation model DeepLab-v3+.
  • the parameters of the model need to be trained on the model to determine, and the preset model is referred to as the model to be trained hereinafter.
  • Training data can be collected in advance for training the model to be trained, and the training data can include positive training data and negative training data.
  • the collected training data is different.
  • the collected positive training data can be multiple images containing the target
  • the negative training data can be multiple An image that does not contain the target.
  • the positive training data can be a variety of remote sensing satellite images that contain farms
  • the negative training data can be multiple images that do not contain farms. Remote sensing satellite images.
  • the training data can be labeled, and the labeled data corresponding to each training data can be obtained.
  • the labeled data is also different.
  • the annotation data can be a mask map corresponding to the remote sensing satellite image.
  • the mask map has the classification category corresponding to each pixel of each remote sensing satellite image, such as 0
  • the pixel does not belong to the farm, 1 means the pixel belongs to the farm, and the mask map can use different colors to indicate different categories, so the mask map corresponding to the negative training data is that each pixel is marked as 0; in addition, ,
  • the positive training data and the negative training data can have a label. For example, the positive training data is marked as 1, and the negative training data is marked as -1.
  • the training data can be used in various orders. For example, it can be first to use positive training data to train the training model, and then use negative training data to adjust the training model, or use positive training data to adjust the training model.
  • the training data and the negative training data are used to train the model to be trained.
  • the negative example training data is input to the model to be trained, and the model to be trained outputs the prediction result corresponding to each negative example training data.
  • the prediction result can be the probability that the negative training data is predicted to be a negative example, it can also be the probability that the negative training data is predicted to be a positive example, and it can also be the probability that other training data that can characterize the negative example is predicted to be a negative example.
  • the probability of the outcome can be the classification result of each pixel in the image.
  • a two-classifier can be connected, and the two-classifier can be commonly used
  • the second classifier such as the softmax classifier; after the binary classification model processes each classification result, a probability that the negative training data is predicted as a negative example can be obtained, and this probability can be used as the prediction result corresponding to the negative training data .
  • the positive example training data is also input into the model to be trained to obtain the prediction result.
  • Step S20 When the prediction result indicates that the probability that the negative training data is predicted to be a negative is greater than a preset threshold, the loss function value corresponding to the negative training data is corrected, wherein the corrected loss function The value is less than the value of the loss function before correction;
  • the loss function can be calculated according to the prediction result and the labeled data corresponding to the training data.
  • the loss function of the training model may be a loss function commonly used for the target task.
  • the loss function value includes the loss function value corresponding to the negative training data and the loss function value corresponding to the positive training data.
  • the negative training data is labeled as negative, it may be wrongly labeled negative. That is, part of the negative training data may actually be positive, so the labeled data of the negative training data may also be wrong.
  • the loss function value corresponding to the calculated negative training data is wrong, and the gradient of the model parameter is calculated according to the wrong loss function value, and then the model parameter is adjusted according to the gradient, which will lead to the model obtained when the final loss function converges
  • the parameters are deviated.
  • the model is used with deviated model parameters, the prediction or classification will be inaccurate.
  • the probability that the negative example training data is predicted to be a negative example is greater than a preset threshold
  • the loss function value corresponding to the negative example training data can be performed Correction
  • the value of the loss function after the correction is smaller than the value of the loss function before the correction.
  • the preset threshold is a preset threshold
  • the range of the threshold may be greater than zero and less than one. That is, when the probability that a negative example training data is predicted to be a negative example by the model to be trained is relatively large, it means that the possibility that the negative example training data is indeed a negative example is relatively large.
  • the negative example can be trained The value of the loss function of the data becomes smaller, so that the negative training data makes a greater contribution to the convergence of the loss function, that is, the loss function can quickly converge; correspondingly, the probability of being predicted as a negative example is not greater than the preset threshold If the training data of the negative example is not processed, the loss function of the training data of the negative example is not processed, which can make the possibility that the negative example training data is indeed a negative example is relatively small, that is, it is likely to be actually a positive example. The effect on the convergence of the loss function remains unchanged; thus, the negative training data that is actually likely to be a positive example is compared with the negative training data that is actually likely to be a negative example.
  • the former reduces the convergence of the loss function. If it is smaller, the latter has a greater convergence effect on the loss function, which reduces the impact of incorrectly labeled negative examples (in fact, it is likely to be positive examples of negative example training data) on the model, which in turn improves the final model obtained
  • the prediction accuracy rate or classification accuracy rate that is, improve the performance of the model. That is, in this embodiment, whether the probability of the negative training data being predicted as a negative example is greater than a preset threshold is used to indicate the possibility that the negative training data is incorrectly labeled.
  • the loss function can be corrected according to the possibility of negative training data being incorrectly labeled; when it is incorrectly labeled
  • reduce the loss function when the possibility of being incorrectly marked is small, reduce the loss function.
  • the loss function is not changed, so that the negative example training data with a high possibility of being incorrectly marked will relatively reduce the impact of model training.
  • the loss function value corresponding to the negative training data can also be increased, so as to reduce it even more. It is actually possible It is the effect of the negative training data of the positive example on the convergence of the loss function; because the probability of a negative training data being predicted as a negative example is not greater than the preset threshold, it still cannot be determined that the negative training data of the negative example is the negative of the wrong mark. For example, it cannot be determined that the training data of the negative example is a positive example. Therefore, the loss function value corresponding to the training data of the negative example is not processed, so as to avoid erroneously applying the negative training data of the negative example to the loss The effect of function convergence is reduced.
  • Step S30 Adjust the model parameters of the model to be trained according to the corrected loss function value, so as to train the model to be trained to obtain a target model.
  • Adjust the model parameters of the model to be trained according to the corrected loss function value Specifically, the gradient corresponding to each model parameter is calculated according to the corrected loss function value, and each model parameter is correspondingly updated according to the gradient of each model parameter, that is, each model parameter is adjusted.
  • the process and current situation of updating the model parameters according to the loss function The update process of some model parameters is similar, so I won't go into details here. If the positive training data and the negative training data are used for training together, the gradient corresponding to each model parameter is calculated together according to the loss function value corresponding to the positive training data and the loss function value corresponding to the revised negative training data.
  • the prediction result is obtained by inputting negative training data into the model to be trained during the training process of the model to be trained.
  • the prediction result indicates that the probability that the negative training data is predicted to be a negative example is greater than a preset threshold
  • Revise the loss function value of the negative training data so that the revised loss function value is smaller than the revised loss function value
  • Negative training data with a higher probability of being a negative example has an increased effect on the convergence of the loss function, so in comparison, the negative training data with a higher probability of actually being a positive example has a reduced effect on the convergence of the loss function.
  • it can reduce the impact of incorrectly labeled negative training data on model training, thereby avoiding the reduction of the prediction or classification accuracy of the final target model, that is, improving the prediction or classification accuracy of the target model, and improving model performance .
  • the prediction result is the probability that the negative example training data is predicted to be a negative example
  • the step S20 includes:
  • Step S201 when the prediction result is greater than the preset threshold, obtain a preset loss correction coefficient, where the loss correction coefficient is a positive number less than 1;
  • the prediction result may be a probability, which is the probability that the training data of a negative example is predicted as a negative example by the model to be trained.
  • the prediction result of the negative training data is compared with the preset threshold. If the prediction result is greater than the preset threshold, a preset loss correction coefficient is obtained, and the loss correction coefficient may be a positive number less than 1.
  • Step S202 Multiply the loss correction coefficient by the loss function value corresponding to the negative example training data to correct the loss function value.
  • the loss correction coefficient is multiplied by the loss function value corresponding to the negative training data, and in this way, the loss function value corresponding to the negative training data is corrected. Since the loss correction coefficient is a positive number less than 1, the value of the loss function after correction is smaller than the value of the loss function before correction, which can increase the convergence of the loss function by the training data of negative examples that are actually more likely to be negative examples The role of.
  • the step of obtaining a preset loss correction coefficient includes:
  • Step a When the prediction result is greater than the preset threshold, substitute the prediction result into a preset smooth descent formula to obtain the loss correction coefficient, wherein the loss correction coefficient becomes larger as the prediction result And become smaller.
  • a smooth descent formula can be set in advance.
  • the smooth descent formula can make the loss correction coefficient gradually decrease smoothly as the prediction result becomes larger. Then, when the prediction result is greater than the preset threshold, the prediction result is brought into the smooth descent The formula obtains the loss correction coefficient, so that when the prediction result is larger, the loss correction coefficient obtained is smaller, and when the prediction result is smaller, the loss correction coefficient obtained is larger.
  • the smooth descent formula makes the loss correction coefficient gradually become smaller as the prediction result becomes larger, so that during the training process, the loss function does not miss the convergence point and is difficult to converge, thereby improving the model training process. Stability also improves the efficiency of model training.
  • the smooth descent formula can use the commonly used curve descent formula.
  • the following formula can be used to calculate the loss correction coefficient.
  • ⁇ (p) is the loss correction coefficient
  • is the preset threshold
  • p is the prediction result.
  • Figure 3 the relationship between ⁇ (p), ⁇ and p is shown in Figure 3.
  • p is greater than ⁇
  • ⁇ ( p) is 1.
  • p is less than or equal to ⁇
  • ⁇ (p) is less than 1.
  • a third embodiment of the model performance optimization method of the present application is proposed.
  • the model to be trained is used to detect farms in remote sensing satellite images.
  • the model after the step S30, further includes:
  • Step S40 Input the satellite image to be detected into the target model to obtain a classification result of each pixel in the satellite image to be detected, wherein the classification result is used to indicate whether the corresponding pixel belongs to a farm;
  • the target task may be to detect farms in remote sensing satellite images
  • the model to be trained may be a model used to detect farms in remote sensing satellite images
  • the structure of the model to be trained can be a commonly used image target detection model .
  • the target model can be used to complete the task of detecting the farm in the remote sensing satellite image.
  • the satellite image to be detected may be input to the target model, and the target model outputs the classification result of each pixel in the satellite image to be detected. The classification result is used to indicate whether the corresponding pixel belongs to the farm.
  • Step S50 Obtain the farm detection result of the satellite image to be detected according to the classification result.
  • the detection result of the breeding farm of the satellite image to be detected can be obtained according to the classification result.
  • a mask map can be obtained according to the classification result.
  • different colors can be used for pixels with different classification results. For example, the area belonging to the farm is white, and the area not belonging to the farm is white. Black, then you can intuitively determine the area where the breeding site is based on the mask map.
  • the pixels belonging to the farm can also be determined according to the classification results, and the latitude and longitude of the farm can be determined according to the corresponding relationship between the pixels and the actual latitude and longitude, so as to directly determine the geographic location of the farm from the remote sensing satellite image. Realize the monitoring and management of farms.
  • a target model of the farm in the detection image is obtained by training in steps S10 to S30, so that the trained model can accurately detect the farm area in the remote sensing satellite image, thereby achieving refinement
  • the management of farms realizes the correct and timely understanding of the situation of the farms, and avoids the phenomenon that the farmers fail to report or conceal the report in time, resulting in the training model that cannot fully identify the problems of various farms.
  • the method before the step S10, the method further includes:
  • Step S60 Perform a data augmentation operation on the collected remote sensing satellite image to obtain the negative example training data, wherein the label corresponding to the remote sensing satellite image is a negative example label, and the data augmentation operation includes at least a twisting operation and a flipping operation. Operation and noise adding operation.
  • the collection of training data may be: crop the remote sensing satellite map to obtain multiple remote sensing satellite images, and then label the multiple remote sensing satellite images , Mark the area of the farm, and use common annotation software. Based on the annotation, you can also generate a mask with a black background, that is, the area outside the farm area in the mask is black. For remote sensing satellite images without farms (negative training data), the corresponding mask image is completely black. The category corresponding to the black area is 0, which means it is background, and the category corresponding to the white area is 1, which means it is a farm.
  • Data augmentation operations can also be performed on the collected remote sensing satellite images.
  • the data augmentation operations can be operations such as distortion operations, flip operations, and noise addition operations on the remote sensing satellite images. These operations are similar to the existing data augmentation operations. , I won’t go into details here.
  • the data augmentation operation on the one hand, when the number of remote sensing satellite images is small, the number of remote sensing satellite images can be increased, thereby increasing the training data, so that the model can be fully trained.
  • the trained model can be Identifying various farms also improves the versatility of the model. It should be noted that for a remote sensing satellite image marked as a negative example, data augmentation is performed on the remote sensing satellite image to obtain multiple remote sensing satellite images, and the multiple remote sensing satellite images are used as the negative example training data.
  • the calculation of the loss function may be to calculate the loss by taking all pixels of a category as a whole, and its essence is to calculate the similarity of two contour regions.
  • the specific calculation formula can be as follows:
  • DL 2 is the loss function value
  • p is the classification category of the pixel output by the model to be trained
  • n is the number of the pixel
  • N is the total number of pixels
  • r is the label category of the pixel
  • is the preset A minimum value used to prevent the numerator and denominator from being zero.
  • two parts are subtracted from 1, the first part is actually the loss corresponding to the target area (farming farm area, that is, the foreground), and the second part is actually the loss corresponding to the background area, which shows that the loss function It is based on the image that only distinguishes the foreground and background annotations to supervise the output of the model to be trained.
  • a fourth embodiment of the method for optimizing model performance of the present application is proposed.
  • the method before the step S10, the method further includes:
  • Step S70 Perform preliminary training on the initial model based on preset positive training data to obtain the model to be trained;
  • the model can be trained using positive training data first, and then the positive training data and negative training data can be used to fine-tune the model, specifically:
  • Pre-collected positive training data can be obtained, and the positive training data can be used to conduct preliminary training on the initial model.
  • the initial model is also the pre-set model to be trained.
  • the initial model in order to distinguish the subsequent models to be trained, the initial model’s describe.
  • the initial training process of the initial model using the positive training data is similar to the existing model training process, that is, no correction of the loss function value is performed.
  • the model parameters of the initial model are adjusted, and the initial model with the adjusted model parameters is called the model to be trained.
  • the step of adjusting the model parameters of the model to be trained according to the corrected loss function value in the step S30 includes:
  • Step S301 Adjust the model parameters of the model to be trained according to the loss function value corresponding to the positive training data and the revised loss function value corresponding to the negative training data.
  • the negative training data and the positive training data are used to train the model to be trained.
  • the training process is the same as the training process of step S10 to step S30 in the above-mentioned first embodiment.
  • the model parameters of the model to be trained are adjusted according to the loss function value corresponding to the positive training data and the loss function value corresponding to the revised negative training data. That is, the gradient of each model parameter is calculated according to the loss function value corresponding to the positive training data and the loss function value corresponding to the corrected negative training data, and then each model parameter is updated based on the gradient.
  • the loss function value corresponding to the positive example training data is similar to the calculation process of the loss function value of the negative example training data, that is, the positive example training data is input into the model to be trained to obtain the prediction result, and then the prediction result is based on the prediction result and the label data of the positive example training data. Calculate the value of the loss function corresponding to the positive training data.
  • the model is preliminarily trained by first using the positive training data, and then the positive training data and the negative training data are used together to fine-tune the model after the preliminary training, that is, to correct the deviation through the negative examples. Reduce the false detection of the model.
  • the model is fine-tuned by combining the positive training data and the negative training data to avoid all the negative training data that causes the training effect of the positive training data to be overwritten.
  • step S30 may further include:
  • Step S302 adjusting the model parameters of the model to be trained according to the corrected loss function value
  • Step S303 detecting whether the model to be trained after adjusting the model parameters meets the preset model conditions
  • Step S304 If it is detected that the model to be trained after adjusting the model parameters does not meet the preset model conditions, after adjusting the preset threshold according to the preset rules, based on the model to be trained after adjusting the model parameters, execute all Said step: input the preset negative training data into the model to be trained to obtain the prediction result;
  • step S305 if it is detected that the model to be trained after adjusting the model parameters satisfies the preset model condition, the model to be trained after adjusting the model parameters is used as the target model.
  • the preset model conditions can be conditions set in advance according to the performance requirements of the model, such as the convergence of the model's loss function as a condition, or the commonly used objective indicators for detecting model performance as conditions, such as accuracy, Objective indicators such as recall rate and IOU (Intersection over Union). If it is detected that the model to be trained meets the preset model conditions, the model to be trained after adjusting the model parameters can be used as the final target model, that is, the training is stopped.
  • the preset threshold is adjusted according to the preset rules. After the preset threshold is adjusted, the negative training data is input into the model to be trained after adjusting the model parameters to obtain the prediction result. When the prediction result indicates that the negative training data is greater than the adjusted preset threshold, the loss function value corresponding to the negative training data is corrected, and then the model parameters of the model to be trained are adjusted according to the corrected loss function value, and the training is to be performed again Judge whether the model meets the preset model conditions. That is, multiple training cycles are performed until it is detected that the model to be trained satisfies the preset model condition.
  • the preset rule for adjusting the preset threshold value may be preset. For example, a larger probability value is first used as the preset threshold value, and the preset threshold value is gradually reduced during the training process.
  • the value of the preset threshold used for the first time may be inappropriate.
  • the threshold is constantly adjusted so that the loss function of the model can converge, and a most suitable preset threshold can be found, that is, to find a prediction that is exactly the proportion of the negative training data that is actually positive to all the negative training data.
  • the threshold is set to make the operation of reducing the influence of falsely labeled negative examples on model training more accurate.
  • the model performance optimization device includes:
  • the input module 10 is used to input preset negative training data into the model to be trained to obtain a prediction result
  • the correction module 20 is configured to correct the loss function value corresponding to the negative training data when the prediction result indicates that the probability that the negative training data is predicted to be a negative is greater than a preset threshold, wherein, after the correction, The loss function value of is less than the loss function value before correction;
  • the adjustment module 30 is configured to adjust the model parameters of the model to be trained according to the corrected loss function value, so as to train the model to be trained to obtain a target model.
  • the prediction result is the probability that the negative training data is predicted to be a negative example
  • the correction module 20 includes:
  • An obtaining unit configured to obtain a preset loss correction coefficient when the prediction result is greater than the preset threshold, where the loss correction coefficient is a positive number less than 1;
  • the correction unit is configured to multiply the loss correction coefficient by the loss function value corresponding to the negative example training data to correct the loss function value.
  • the acquiring unit includes:
  • the calculation unit is configured to, when the prediction result is greater than the preset threshold, substitute the prediction result into a preset smooth descent formula to obtain the loss correction coefficient, wherein the loss correction coefficient follows the prediction result Get bigger and get smaller.
  • the model performance optimization device further includes:
  • the preliminary training module is used to perform preliminary training on the initial model based on preset positive training data to obtain the model to be trained;
  • the adjustment module 30 includes:
  • the first adjustment unit is configured to adjust the model parameters of the model to be trained according to the loss function value corresponding to the positive training data and the revised loss function value corresponding to the negative training data.
  • the adjustment module 30 includes:
  • the second adjustment unit is configured to adjust the model parameters of the model to be trained according to the corrected loss function value
  • the detection unit is used to detect whether the model to be trained after adjusting the model parameters meets the preset model conditions
  • the third adjustment unit is configured to, if it is detected that the model to be trained after adjusting the model parameters does not meet the preset model conditions, after adjusting the preset threshold according to the preset rules, based on the model to be trained after adjusting the model parameters , And then execute the steps: input the preset negative training data into the model to be trained to obtain the prediction result;
  • the determining unit is configured to, if it is detected that the model to be trained after adjusting the model parameters satisfies the preset model condition, the model to be trained after adjusting the model parameters is used as the target model.
  • the model to be trained is a model for detecting farms in remote sensing satellite images
  • the model performance optimization device further includes:
  • An image input module configured to input the satellite image to be detected into the target model to obtain a classification result of each pixel in the satellite image to be detected, wherein the classification result is used to indicate whether the corresponding pixel belongs to a farm;
  • the detection module is used to obtain the detection result of the breeding farm of the satellite image to be detected according to the classification result.
  • the model performance optimization device further includes:
  • the augmentation module is configured to perform data augmentation operations on the collected remote sensing satellite images to obtain the negative example training data, wherein the annotation corresponding to the remote sensing satellite image is the negative example annotation, and the data augmentation operation includes at least distortion Operation, flip operation and noise adding operation.
  • an embodiment of the present application also proposes a computer-readable storage medium with a model performance optimization program stored on the storage medium, and when the model performance optimization program is executed by a processor, the steps of the model performance optimization method described below are implemented .
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to make a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present application.
  • a terminal device which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

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

Abstract

一种模型性能优化方法、装置、设备及存储介质,所述方法包括:将预设的负例训练数据输入待训练模型得到预测结果(S10);当预测结果表征负例训练数据被预测为负例的概率大于预设阈值时,对负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值(S20);根据修正后的损失函数值调整待训练模型的模型参数,以对待训练模型进行训练得到目标模型(S30)。

Description

模型性能优化方法、装置、设备及存储介质
相关申请的交叉引用
本申请要求:2020年2月28日申请的、申请号为202010131522.0、名称为“模型性能优化方法、装置、设备及存储介质”的中国专利申请的优先权,在此将其引入作为参考。
技术领域
本申请涉及机器学习技术领域,尤其涉及一种模型性能优化方法、装置、设备及存储介质。
背景技术
随着机器学习技术的快速发展,机器学习应用的范围也越来越广,对机器学习模型的训练优化,也成为了整个行业的不断探索方向。现有的机器学习模型训练过程中,会采用正例和负例来对模型进行训练,例如,对图像目标检测模型进行训练时,会采用包含目标的图像(正例)和不包含目标的图像(负例)进行训练。然而,在很多场景中,会存在实际上是正例,但是因为各种原因导致错误地标注为负例,进而被当作负例进行训练的情况,例如,训练能够识别遥感卫星图像中养殖场的图像目标检测模型时,会存在养殖主未及时上报或者瞒报的现象,导致许多负例中也存在养殖场。这种错误标注负例的情况,会使得最终训练得到的模型预测或分类效果不准确,也即导致模型性能不佳,例如,导致养殖场检测模型无法全面识别出各种养殖场。
上述内容仅用于辅助理解本申请的技术方案,并不代表承认上述内容是现有技术。
发明内容
本申请的主要目的在于提供一种模型性能优化方法、装置、设备及存储介质,旨在解决现有因采用错误标注的负例对模型进行训练,导致训练得到的模型预测或分类效果不准确的问题。
为实现上述目的,本申请提供一种模型性能优化方法,所述模型性能优化方法包括以下步骤:
将预设的负例训练数据输入待训练模型得到预测结果;
当所述预测结果表征所述负例训练数据被预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值;以及
根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型。
在一实施例中,所述预测结果是所述负例训练数据被预测为负例的概率,所述当所述预测结果表征所述负例训练数据预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正的步骤包括:
当所述预测结果大于所述预设阈值时,获取预设的损失修正系数,其中,所述损失修正系数是小于1的正数;以及
将所述损失修正系数乘以所述负例训练数据对应的损失函数值,以对所述损失函数值进行修正。
在一实施例中,所述当所述预测结果大于所述预设阈值时,获取预设的损失修正系数的步骤包括:
当所述预测结果大于所述预设阈值时,将所述预测结果代入预设的平滑下降公式得到所述损失修正系数,其中,所述损失修正系数随着所述预测结果变大而变小。
在一实施例中,所述
平滑下降公式为:
Figure WO-DOC-FIGURE-1
其中,α(p)为损失修正系数,α为预设阈值,p为预测结果。
在一实施例中,所述将预设的负例训练数据输入待训练模型得到预测结果的步骤之前,还包括:
基于预设的正例训练数据对初始模型进行初步训练,得到所述待训练模型;
所述根据修正后的损失函数值调整所述待训练模型的模型参数的步骤包括:
根据所述正例训练数据对应的损失函数值和修正后的所述负例训练数据对应的损失函数值,调整所述待训练模型的模型参数。
在一实施例中,所述根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型的步骤包括:
根据修正后的损失函数值调整所述待训练模型的模型参数;
检测调整模型参数后的待训练模型是否满足预设模型条件;
若检测到调整模型参数后的待训练模型不满足所述预设模型条件,则在按照预设规则调整所述预设阈值后,基于调整模型参数后的待训练模型,再执行所述步骤:将预设的负例训练数据输入待训练模型得到预测结果;以及
若检测到调整模型参数后的待训练模型满足预设模型条件,则将调整模型参数后的待训练模型作为目标模型。
在一实施例中,所述待训练模型是用于检测遥感卫星图像中养殖场的模型,所述根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型的步骤之后,还包括:
将待检测卫星图像输入所述目标模型得到所述待检测卫星图像中各个像素点的分类结果,其中,所述分类结果用于表示对应的像素点是否属于养殖场;以及
根据所述分类结果得到所述待检测卫星图像的养殖场检测结果。
在一实施例中,所述将预设的负例训练数据输入待训练模型得到预测结果的步骤之前,还包括:
对采集到的遥感卫星图像进行数据增广操作得到所述负例训练数据,其中,所述遥感卫星图像对应的标注是负例标注,所述数据增广操作至少包括扭曲操作、翻转操作和加噪操作。
在一实施例中,损失函数为:
Figure WO-DOC-FIGURE-2
其中,DL 2为损失函数值,p为待训练模型输出的像素点的分类类别,n为像素点的编号,N为总像素点个数,r为像素点的标注类别,ε为预设的一个极小值。
在一实施例中,所述对负例训练数据对应的损失函数值进行修正,使得修正后的损失函数值小于修正前的损失函数值的步骤包括:
将负例训练数据对应的损失函数值减少一个预设值,以及将负例训练数据对应的损失函数值乘以一个预设的小于1的正数。
在一实施例中,所述根据修正后的损失函数值调整所述待训练模型的模型参数包括:
根据修正后的损失函数值计算模型参数对应的梯度,并根据各个模型参数的梯度来对应更新模型参数。
为实现上述目的,本申请还提供一种模型性能优化装置,所述模型性能优化装置包括:
输入模块,用于将预设的负例训练数据输入待训练模型得到预测结果;
修正模块,用于当所述预测结果表征所述负例训练数据被预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值;
调整模块,用于根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型。
在一实施例中,所述预测结果包括所述负例训练数据被预测为负例的概率,所述修正模块包括:
获取单元,用于当所述预测结果大于所述预设阈值时,获取预设的损失修正系数,其中,所述损失修正系数是小于1的正数;以及
修正单元,用于将所述损失修正系数乘以所述负例训练数据对应的损失函数值,以对所述损失函数值进行修正。
在一实施例中,所述获取单元包括:
计算单元,用于当所述预测结果大于所述预设阈值时,将所述预测结果代入预设的平滑下降公式得到所述损失修正系数,其中,所述损失修正系数 随着所述预测结果变大而变小。
在一实施例中,所述模型性能优化装置还包括:
初步训练模块,用于基于预设的正例训练数据对初始模型进行初步训练,得到所述待训练模型;
所述调整模块包括:
第一调整单元,用于根据所述正例训练数据对应的损失函数值和修正后的所述负例训练数据对应的损失函数值,调整所述待训练模型的模型参数。
在一实施例中,所述调整模块包括:
第二调整单元,用于根据修正后的损失函数值调整所述待训练模型的模型参数;
检测单元,用于检测调整模型参数后的待训练模型是否满足预设模型条件;
第三调整单元,用于若检测到调整模型参数后的待训练模型不满足所述预设模型条件,则在按照预设规则调整所述预设阈值后,基于调整模型参数后的待训练模型,再执行所述步骤:将预设的负例训练数据输入待训练模型得到预测结果;以及
确定单元,用于若检测到调整模型参数后的待训练模型满足预设模型条件,则将调整模型参数后的待训练模型作为目标模型。
在一实施例中,所述待训练模型是用于检测遥感卫星图像中养殖场的模型,所述模型性能优化装置还包括:
图像输入模块,用于将待检测卫星图像输入所述目标模型得到所述待检测卫星图像中各个像素点的分类结果,其中,所述分类结果用于表示对应的像素点是否属于养殖场;以及
检测模块,用于根据所述分类结果得到所述待检测卫星图像的养殖场检测结果。
在一实施例中,所述模型性能优化装置还包括:
增广模块,用于对采集到的遥感卫星图像进行数据增广操作得到所述负例训练数据,其中,所述遥感卫星图像对应的标注是负例标注,所述数据增广操作至少包括扭曲操作、翻转操作和加噪操作。为实现上述目的,本申请还提供一种模型性能优化设备,所述模型性能优化设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的模型性能优化程序,所述模型性能优化程序被所述处理器执行时实现如上所述的模型性能优化方法的步骤。
此外,为实现上述目的,本申请还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有模型性能优化程序,所述模型性能优化程序被处理器执行时实现如上所述的模型性能优化方法的步骤。
本申请中,通过在对待训练模型的训练过程中,将负例训练数据输入待训练模型得到预测结果,当预测结果表征该负例训练数据预测为负例的概率大于一个预设阈值时,对该负例训练数据的损失函数值进行修正,使得修正 后的损失函数值小于修正后的损失函数值,根据修正后的损失函数值调整待训练模型的模型参数得到目标模型,使得实际上是负例的可能性较大的负例训练数据对损失函数收敛的作用增大,从而对比来看,使得实际上是正例的可能性比较大的负例训练数据对损失函数收敛的作用减小,进而能够减小错误标记的负例训练数据对模型训练的影响,从而避免最终得到的目标模型的预测或分类准确率降低,也即提高了目标模型的预测或分类准确率,提高了模型性能。
附图说明
图1是本申请实施例方案涉及的硬件运行环境的结构示意图;
图2为本申请模型性能优化方法第一实施例的流程示意图;
图3为本申请实施例涉及的一种损失修正系数的取值案例图;
图4本申请模型性能优化装置较佳实施例的功能示意图模块图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
如图1所示,图1是本申请实施例方案涉及的硬件运行环境的设备结构示意图。
需要说明的是,本申请实施例模型性能优化设备可以是智能手机、个人计算机和服务器等设备,在此不做具体限制。
如图1所示,该模型性能优化设备可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
本领域技术人员可以理解,图1中示出的设备结构并不构成对模型性能优化设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及模型性能优化程序。其中,操作系统是管理和控制设备硬件和软件资源的程序,支持模型性能优化程序以及其它软件或程序的运行。
在图1所示的设备中,用户接口1003主要用于与客户端进行数据通信;网络接口1004主要用于与服务器建立通信连接;而处理器1001可以用于调用存储器1005中存储的模型性能优化程序,并执行以下操作:
将预设的负例训练数据输入待训练模型得到预测结果;
当所述预测结果表征所述负例训练数据被预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值;
根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型。
在一实施例中,所述预测结果是所述负例训练数据被预测为负例的概率,所述当所述预测结果表征所述负例训练数据预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正的步骤包括:
当所述预测结果大于所述预设阈值时,获取预设的损失修正系数,其中,所述损失修正系数是小于1的正数;
将所述损失修正系数乘以所述负例训练数据对应的损失函数值,以对所述损失函数值进行修正。
在一实施例中,所述当所述预测结果大于所述预设阈值时,获取预设的损失修正系数的步骤包括:
当所述预测结果大于所述预设阈值时,将所述预测结果代入预设的平滑下降公式得到所述损失修正系数,其中,所述损失修正系数随着所述预测结果变大而变小。
在一实施例中,所述将预设的负例训练数据输入待训练模型得到预测结果的步骤之前,处理器1001还可以用于调用存储器1005中存储的模型性能优化程序,执行以下操作:
基于预设的正例训练数据对初始模型进行初步训练,得到所述待训练模型;
所述根据修正后的损失函数值调整所述待训练模型的模型参数的步骤包括:
根据所述正例训练数据对应的损失函数值和修正后的所述负例训练数据对应的损失函数值,调整所述待训练模型的模型参数。
在一实施例中,所述根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型的步骤包括:
根据修正后的损失函数值调整所述待训练模型的模型参数;
检测调整模型参数后的待训练模型是否满足预设模型条件;
若检测到调整模型参数后的待训练模型不满足所述预设模型条件,则在按照预设规则调整所述预设阈值后,基于调整模型参数后的待训练模型,再执行所述步骤:将预设的负例训练数据输入待训练模型得到预测结果;
若检测到调整模型参数后的待训练模型满足预设模型条件,则将调整模型参数后的待训练模型作为目标模型。
在一实施例中,所述待训练模型是用于检测遥感卫星图像中养殖场的模型,所述根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型的步骤之后,处理器1001还可以用于调 用存储器1005中存储的模型性能优化程序,执行以下操作:
将待检测卫星图像输入所述目标模型得到所述待检测卫星图像中各个像素点的分类结果,其中,所述分类结果用于表示对应的像素点是否属于养殖场;
根据所述分类结果得到所述待检测卫星图像的养殖场检测结果。
在一实施例中,所述将预设的负例训练数据输入待训练模型得到预测结果的步骤之前,处理器1001还可以用于调用存储器1005中存储的模型性能优化程序,执行以下操作:
对采集到的遥感卫星图像进行数据增广操作得到所述负例训练数据,其中,所述遥感卫星图像对应的标注是负例标注,所述数据增广操作至少包括扭曲操作、翻转操作和加噪操作。
基于上述的结构,提出模型性能优化方法的各个实施例。
参照图2,图2为本申请模型性能优化方法第一实施例的流程示意图。
本申请实施例提供了模型性能优化方法的实施例,需要说明的是,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。本申请模型性能优化方法各个实施例的执行主体可以是智能手机、个人计算机和服务器等设备,为便于描述,以下各实施例中省略执行主体进行阐述。在本实施例中,模型性能优化方法包括:
步骤S10,将预设的负例训练数据输入待训练模型得到预测结果;
在本实施例中,对于一个目标任务,如预测任务或分类任务,可以预先设置一个模型,模型结构可以是采用针对该目标任务所常用的模型结构。例如,图像目标检测任务即可以采用常用的图像目标检测模型,如可采用语义图像分割模型DeepLab-v3+。模型的参数需要经过对模型进行训练才能确定,以下将该预设设置的模型称为待训练模型。
预先可以采集训练数据,用于对待训练模型进行训练,训练数据可包括正例训练数据和负例训练数据。根据目标任务不同,所采集的训练数据不同,例如,目标任务是对图像进行目标检测的任务时,所采集的正例训练数据可以是多张包含目标的图像,负例训练数据可以是多张不包含目标的图像,更具体地,目标任务是检测图像中的养殖场时,正例训练数据可以是多种包含养殖场的遥感卫星图片,负例训练数据可以是多张不包含养殖场的遥感卫星图片。对训练数据可以进行标注,获得每个训练数据对应的标注数据,根据训练数据和目标任务不同,标注数据也不同。例如,目标任务是检测图像中的养殖场时,标注数据可以是与遥感卫星图片对应的掩膜图,掩膜图中有每个遥感卫星图片的每个像素点对应的分类类别,如0表示该像素点不属于养殖场,1表示该像素点属于养殖场,掩膜图可以采用不同的颜色表示不同的类别,那么负例训练数据对应的掩膜图就是各个像素点都标记为0;此外,正例训练数据和负例训练数据本身可以带一个标签,例如,正例训练数据是标记为1,负例训练数据标记为-1。
在训练过程中,训练数据的使用顺序可以多种,例如,可以是先采用正 例训练数据来对待训练模型进行训练,再采用负例训练数据来对待训练模型进行调整,也可以是采用正例训练数据和负例训练数据一起来对待训练模型进行训练。
具体地,对训练过程中采用负例训练数据进行训练的部分进行说明:将负例训练数据分别输入待训练模型,待训练模型输出每个负例训练数据对应的预测结果。其中,预测结果可以是该负例训练数据被预测为负例的概率,也可以是该负例训练数据被预测为正例的概率,还可以是其他能够表征负例训练数据被预测为负例的概率的结果。当目标任务是图像目标检测任务时,待训练模型的输出结果可以是图像中每个像素点的分类结果,在各个分类结果的基础上,可以接上一个二分类器,二分类器可采用常用的二分类器,如softmax分类器;经过二分类模型对各个分类结果的处理,可得到一个表示该负例训练数据预测为负例的概率,该概率即可作为负例训练数据对应的预测结果。
同样地,若采用正例训练数据进行训练,也将正例训练数据输入待训练模型,得到预测结果。
步骤S20,当所述预测结果表征所述负例训练数据被预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值;
在将负例训练数据输入待训练模型得到预测结果后,或将负例训练数据和正例训练数据输入待训练模型得到预测结果后,可依据预测结果和训练数据对应的标注数据计算损失函数,待训练模型的损失函数可以是采用针对目标任务常用的损失函数。损失函数值有负例训练数据对应的损失函数值和正例训练数据对应的损失函数值。
由于负例训练数据虽然被标注为负例,但是可能是错误标记的负例,也即,部分负例训练数据可能实际上是正例,那么负例训练数据的标注数据也可能是错误的,从而导致计算出来的负例训练数据对应的损失函数值是有误的,而根据错误的损失函数值来计算模型参数的梯度,进而根据梯度来调整模型参数,会导致最终损失函数收敛时得到的模型参数是偏离的,模型以偏离的模型参数来进行使用时,会出现预测或分类不准确的现象。
在本实施例中,当检测到一个负例训练数据对应的预测结果表征该负例训练数据被预测为负例的概率大于预设阈值时,可对该负例训练数据对应的损失函数值进行修正,并且,修正后的损失函数值小于修正前的损失函数值。其中,预设阈值是预先设置的一个阈值,该阈值的范围可以是大于零小于1。也即,当一个负例训练数据被待训练模型预测为负例的概率比较大时,说明该负例训练数据确实是负例的可能性是比较大的,此时,可以将该负例训练数据对于的损失函数值变小,使得该负例训练数据对损失函数的收敛做较大的贡献,即使得损失函数能够快速收敛;对应地,对被预测为负例的概率不大于预设阈值的负例训练数据,则对该负例训练数据的损失函数不做处理,可以使得当负例训练数据确实为负例的可能性比较小,也即很可能实际上是 正例时,就让它对损失函数收敛的作用不变;从而使得实际上很可能为正例的负例训练数据,和实际上很可能为负例的负例训练数据,对比起来看,前者对损失函数的收敛作用减小,后者对损失函数的收敛作用变大,从而使得错误标记的负例(实际上很可能为正例的负例训练数据)对模型的影响降低,反过来就提高了最终获取到的模型的预测准确率或分类准确率,也即提高模型的性能。也即,在本实施例中,通过负例训练数据被预测为负例的概率是否大于预设阈值,来表示负例训练数据被错误标记的可能性,当负例训练数据被预测为负例的概率大于预设阈值时,说明错误标记的可能性小,反之则说明错误标记的可能性大;从而实现根据负例训练数据被错误标记的可能性来对损失函数进行修正;当被错误标记的可能性小时,减少损失函数,当被错误标记的可能性大时,不改变损失函数,使得被错误标记可能性大的负例训练数据对模型训练的影响相对减少。
需要说明的是,对于被预测为负例的概率不大于预设阈值的负例训练数据,也可以是对该负例训练数据对应的损失函数值进行增大,从而更加减小实际上很可能是正例的负例训练数据对损失函数收敛的作用;由于一个负例训练数据虽然被预测为负例的概率不大于预设阈值,但也仍不能够确定该负例训练数据就是错误标记的负例,即不能够确定该负例训练数据就是正例,所以,将该负例训练数据对应的损失函数值不做处理的操作,可以避免错误地将本是负例的负例训练数据对损失函数收敛的作用减小。
对负例训练数据对应的损失函数值进行修正,使得修正后的损失函数值小于修正前的损失函数值,具体可以采用的方式有多种,例如,可以将负例训练数据对应的损失函数值减少一个预设值,也可以是将负例训练数据对应的损失函数值乘以一个预设的小于1的正数等等。
步骤S30,根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型。
根据修正后的损失函数值调整待训练模型的模型参数。具体地,根据修正后的损失函数值计算各个模型参数对应的梯度,根据各个模型参数的梯度来对应更新各个模型参数,也即调整各个模型参数,此处根据损失函数更新模型参数的过程与现有的模型参数更新过程类似,在此不做详细赘述。若采用正例训练数据和负例训练数据一起训练时,就根据正例训练数据对应的损失函数值和修正后的负例训练数据对应的损失函数值一起计算各个模型参数对应的梯度。
在调整待训练模型的模型参数后,可以检测损失函数是否收敛;若损失函数收敛,则可以停止训练,将最终最后一次调整过的模型参数作为最终的模型参数,即得到目标模型;若损失函数未收敛,则可以在调整后的模型参数基础上,将训练数据再输入待训练模型得到预测结果,以及修正损失函数值,计算梯度,调整模型参数;循环调整模型参数,直到检测到损失函数收敛为止。
在本实施例中,通过在对待训练模型的训练过程中,将负例训练数据输 入待训练模型得到预测结果,当预测结果表征该负例训练数据预测为负例的概率大于一个预设阈值时,对该负例训练数据的损失函数值进行修正,使得修正后的损失函数值小于修正后的损失函数值,根据修正后的损失函数值调整待训练模型的模型参数得到目标模型,使得实际上是负例的可能性较大的负例训练数据对损失函数收敛的作用增大,从而对比来看,使得实际上是正例的可能性比较大的负例训练数据对损失函数收敛的作用减小,进而能够减小错误标记的负例训练数据对模型训练的影响,从而避免最终得到的目标模型的预测或分类准确率降低,也即提高了目标模型的预测或分类准确率,提高了模型性能。
在一实施例中,基于上述第一实施例,提出本申请模型性能优化方法第二实施例,在本实施例中,所述预测结果是所述负例训练数据被预测为负例的概率,所述步骤S20包括:
步骤S201,当所述预测结果大于所述预设阈值时,获取预设的损失修正系数,其中,所述损失修正系数是小于1的正数;
在一实施例中,在本实施例中,预测结果可以是一个概率,该概率是负例训练数据被待训练模型预测为负例的概率。在将负例训练数据输入待训练模型得到预测结果后,将负例训练数据的预测结果与预设阈值进行比较。若预测结果大于该预设阈值,则获取预设的损失修正系数,该损失修正系数可以是小于1的正数。
步骤S202,将所述损失修正系数乘以所述负例训练数据对应的损失函数值,以对所述损失函数值进行修正。
将该损失修正系数乘以该负例训练数据对应的损失函数值,通过这种方式,对负例训练数据对应的损失函数值进行修正。由于损失修正系数是小于1的正数,所以修正后的损失函数值是小于修正前的损失函数值的,从而可以增加实际上是负例的可能性较大的负例训练数据对损失函数收敛的作用。
在一实施例中,所述S201中当所述预测结果大于所述预设阈值时,获取预设的损失修正系数的步骤包括:
步骤a,当所述预测结果大于所述预设阈值时,将所述预测结果代入预设的平滑下降公式得到所述损失修正系数,其中,所述损失修正系数随着所述预测结果变大而变小。
在一实施例中,为使得实际上是负例的可能性越大的负例训练数据对损失函数收敛的作用越大,对于被预测为负例的概率越大的负例训练数据,可将该负例训练数据的损失函数值减小得越小。此时,可以预先设置一个平滑下降公式,该平滑下降公式可以使得损失修正系数随着预测结果变大而逐渐平滑变小,那么当预测结果大于预设阈值时,将预测结果带入该平滑下降公式获得损失修正系数,可以使得当预测结果越大时,得到的损失修正系数越小,当预测结果越小时得到的损失修正系数越大。并且,平滑下降公式使得损失修正系数随着预测结果变大而逐渐平滑变小,从而使得训练过程中,不会因为损失函数的突变,导致错过了收敛点而难以收敛,从而提高模型训练 过程的稳定性,也提高了模型训练的效率。
其中,平滑下降公式可以采用常用的曲线下降公式。如,可以采用如下公式来计算损失修正系数。
Figure WO-DOC-FIGURE-3
其中,α(p)是损失修正系数,α是预设阈值,p是预测结果,根据该公式,α(p)、α和p的关系如图3所示,当p大于α时,α(p)取1,当p小于等于α时,α(p)是小于1的。
需要说明的是,也可以采用其他公式,使得预测结果越大时,损失修正系数越小,若可采用直线下降公式。
在一实施例中,基于上述第一和第二实施例,提出本申请模型性能优化方法第三实施例,在本实施例中,所述待训练模型是用于检测遥感卫星图像中养殖场的模型,所述步骤S30之后,还包括:
步骤S40,将待检测卫星图像输入所述目标模型得到所述待检测卫星图像中各个像素点的分类结果,其中,所述分类结果用于表示对应的像素点是否属于养殖场;
在一实施例中,目标任务可以是检测遥感卫星图像中的养殖场,那么待训练模型可以是用于检测遥感卫星图像中养殖场的模型,待训练模型的结构可采用常用的图像目标检测模型。对待训练模型采用上述步骤S10~S30的训练过程进行训练得到目标模型后,可使用该目标模型来完成检测遥感卫星图像中养殖场的任务。具体地,可以将待检测卫星图像输入该目标模型,由目标模型输出待检测卫星图像中各个像素点的分类结果。分类结果用于表示对于的像素点是否属于养殖场。
步骤S50,根据所述分类结果得到所述待检测卫星图像的养殖场检测结果。
在得到待检测卫星图像中各个像素点的分类结果后,即可以根据分类结果得到待检测卫星图像的养殖场检测结果。具体地,根据分类结果可以得到一个掩膜图,该掩膜图中,对分类结果不同的像素点,可采用不同的颜色,例如,属于养殖场的区域是白色,不属于养殖场区域的是黑色,那么就可以根据掩膜图直观地确定养殖场所在区域。此外,也可以根据分类结果,确定属于养殖场的像素点,并根据像素点与实际经纬度的对应关系,确定养殖场所在的经纬度,从而实现从遥感卫星图像中直接确定养殖场的地理位置,从而实现对养殖场的监测和管理。
在我国养殖业发展迅速,健康养殖、福利养殖,特别是精准化养殖等概念备受社会关注。当前养殖业存在很多问题,如养殖场没有得到规范化管理,造成严重环境污染以及爆发疫情等。在本实施例中,通过采用步骤S10~S30的方式训练得到一个检测图像中养殖场的目标模型,使得训练得到的模型能 够准确地检测到遥感卫星图像中的养殖场区域,从而能够实现精细化的养殖场管理,实现正确及时地了解养殖场的情况,避免由于各地存在养殖主未及时上报或者瞒报的现象,导致训练得到的模型无法全面识别出各种养殖场的问题。
在一实施例中,所述步骤S10之前,还包括:
步骤S60,对采集到的遥感卫星图像进行数据增广操作得到所述负例训练数据,其中,所述遥感卫星图像对应的标注是负例标注,所述数据增广操作至少包括扭曲操作、翻转操作和加噪操作。
在一实施例中,当目标任务是检测遥感卫星图像中的养殖场时,训练数据的采集可以是:对遥感卫星地图进行裁剪,得到多张遥感卫星图像,然后对多张遥感卫星图像进行标注,标注出其中的养殖场区域,标注可以采用常用的标注软件,基于标注还可以生成背景全黑的掩膜图,也即掩膜图中养殖场区域外的区域是黑色。对于不含养殖场的遥感卫星图片(负例训练数据),对应的掩膜图是全黑。黑色区域对应的类别是0,表示是背景,白色区域对应的类别是1,表示是养殖场。
对采集到的遥感卫星图像,还可以进行数据增广操作,数据增广操作可以是对遥感卫星图像进行扭曲操作、翻转操作和加噪操作等操作,这些操作与现有的数据增广操作类似,在此不做详细赘述。通过数据增广操作一方面可以使得在遥感卫星图像数量较少时,增加遥感卫星图像的数量,从而使得训练数据变多,使得模型得到充分的训练,另一方面,可以使得训练得到的模型能够识别各种不同的养殖场,也即提高了模型的通用性。需要说明的是,对于标注为负例的遥感卫星图像,对该遥感卫星图像进行数据增广,就得到多张遥感卫星图像,将多张遥感卫星图像作为负例训练数据。
在一实施例中,损失函数的计算可以是把一个类别的所有像素作为一个整体去计算损失的,其本质是计算两个轮廓区域的相似程度。具体的计算公式可如下:
Figure WO-DOC-FIGURE-4
其中,DL 2是损失函数值,p是待训练模型输出的像素点的分类类别,n是像素点的编号,N是总像素点个数,r是像素点的标注类别,ε是预设的一个极小值,用于避免分子分母为零。上述公式中,1减去了两个部分,第一个部分实际上是目标区域(养殖场区域,也即前景)对应的损失,第二部分实际上是背景区域对应的损失,这说明损失函数是基于图像仅区分前景和背景的标注去监督待训练模型的输出,如果标注不够好,会严重影响损失函数的计算。因此可以考虑引入一些原图的信息作为辅助,丰富损失函数函数,这种方式称为弱监督。也即,本实施例中通过加入图像整体的标注作为辅助,用于区分正例训练数据和负例训练数据,对于负例训练数据,则修正其对应的损失函数值,从而基于弱监督学习,通过优化损失函数的计算方法,有效 地解决了遥感卫星地图中错误标注负例的问题。
在一实施例中,基于上述第一、第二和第三实施例,提出本申请模型性能优化方法第四实施例,在本实施例中,所述步骤S10之前,还包括:
步骤S70,基于预设的正例训练数据对初始模型进行初步训练,得到所述待训练模型;
在一实施例中,在本实施例中,可以先采用正例训练数据对模型进行训练,再采用正例训练数据和负例训练数据对模型进行微调,具体地:
可获取预先采集的正例训练数据,采用正例训练数据对初始模型进行初步训练,其中,初始模型也即预先设置的待训练的模型,此处为了区分后面的待训练模型,采用初始模型的描述。采用正例训练数据对初始模型进行初步训练的过程与现有的模型训练过程类似,也即,不进行损失函数值的修正。初步训练后,初始模型的模型参数得到调整,将调整了模型参数的初始模型称为待训练模型。
所述步骤S30中的根据修正后的损失函数值调整所述待训练模型的模型参数的步骤包括:
步骤S301,根据所述正例训练数据对应的损失函数值和修正后的所述负例训练数据对应的损失函数值,调整所述待训练模型的模型参数。
然后采用负例训练数据和该正例训练数据一起训练待训练模型,此时训练的过程如上述第一实施例中步骤S10~步骤S30的训练过程。其中,在根据损失函数值进行调整待训练模型的模型参数时,是根据正例训练数据对应的损失函数值和修正后的负例训练数据对应的损失函数值一起调整待训练模型的模型参数的,也即,根据正例训练数据对应的损失函数值和修正后的负例训练数据对应的损失函数值一起计算各个模型参数的梯度,然后基于梯度来更新各个模型参数。而正例训练数据对应的损失函数值类似于负例训练数据的损失函数值的计算过程,也即是正例训练数据输入待训练模型得到预测结果,然后根据预测结果和正例训练数据的标注数据来计算正例训练数据对应的损失函数值的。
在本实施例中,通过先采用正例训练数据来对模型进行初步训练,然后采用正例训练数据和负例训练数据一起来对初步训练后的模型进行微调,也即通过负例进行纠偏,减少模型的误检。并且,通过将正例训练数据和负例训练数据一起来对模型进行微调,避免全部采用负例训练数据造成正例训练数据的训练效果被覆盖。
在一实施例中,所述步骤S30还可包括:
步骤S302,根据修正后的损失函数值调整所述待训练模型的模型参数;
步骤S303,检测调整模型参数后的待训练模型是否满足预设模型条件;
步骤S304,若检测到调整模型参数后的待训练模型不满足所述预设模型条件,则在按照预设规则调整所述预设阈值后,基于调整模型参数后的待训练模型,再执行所述步骤:将预设的负例训练数据输入待训练模型得到预测结果;
步骤S305,若检测到调整模型参数后的待训练模型满足预设模型条件,则将调整模型参数后的待训练模型作为目标模型。
在一实施例中,在一种实施方式中,在根据修正后的损失函数值调整待训练模型的模型参数后,可检测调整模型参数后的待训练模型是否满足预设模型条件。其中,预设模型条件可以是预先根据对模型的性能需求设置的条件,如可以将模型的损失函数收敛作为一个条件,还可以是将常用的检测模型性能的客观指标作为条件,如准确率、召回率和IOU(Intersection over Union,交并比)等客观指标。若检测到待训练模型满足预设模型条件,则可将调整模型参数后的待训练模型作为最终的目标模型,也即停止训练。若检测到待训练模型不满足预设模型条件,则按照预设规则调整预设阈值,在调整了预设阈值后,再将负例训练数据输入调整模型参数后的待训练模型得到预测结果,当预测结果表征负例训练数据大于调整后的预设阈值时,对负例训练数据对应的损失函数值进行修正,再根据修正后的损失函数值调整待训练模型的模型参数,再次进行待训练模型是否满足预设模型条件的判断。也即,循环进行多次的训练,直到检测到待训练模型满足预设模型条件为止。
其中,调整预设阈值的预设规则可以是预先设置的,例如,先采用一个较大的概率值作为预设阈值,在训练过程中,逐渐减小预设阈值。
在本实施例中,由于负例训练数据中实际上是正例的训练数据所占比例是未知的,所以初次采用的预设阈值的取值可能是不合适的,通过不断训练,不断对预设阈值不断地调整,使得模型的损失函数能够收敛,并且能够找到一个最合适的预设阈值,也即找到一个与实际上是正例的负例训练数据占所有负例训练数据的比例正合适的预设阈值,从而使得对错误标记的负例对模型训练的影响减小的操作更加准确。
此外,此外本申请实施例还提出一种模型性能优化装置,参照图4,所述模型性能优化装置包括:
输入模块10,用于将预设的负例训练数据输入待训练模型得到预测结果;
修正模块20,用于当所述预测结果表征所述负例训练数据被预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值;
调整模块30,用于根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型。
在一实施例中,所述预测结果是所述负例训练数据被预测为负例的概率,所述修正模块20包括:
获取单元,用于当所述预测结果大于所述预设阈值时,获取预设的损失修正系数,其中,所述损失修正系数是小于1的正数;
修正单元,用于将所述损失修正系数乘以所述负例训练数据对应的损失函数值,以对所述损失函数值进行修正。
在一实施例中,所述获取单元包括:
计算单元,用于当所述预测结果大于所述预设阈值时,将所述预测结果 代入预设的平滑下降公式得到所述损失修正系数,其中,所述损失修正系数随着所述预测结果变大而变小。
在一实施例中,所述模型性能优化装置还包括:
初步训练模块,用于基于预设的正例训练数据对初始模型进行初步训练,得到所述待训练模型;
所述调整模块30包括:
第一调整单元,用于根据所述正例训练数据对应的损失函数值和修正后的所述负例训练数据对应的损失函数值,调整所述待训练模型的模型参数。
在一实施例中,所述调整模块30包括:
第二调整单元,用于根据修正后的损失函数值调整所述待训练模型的模型参数;
检测单元,用于检测调整模型参数后的待训练模型是否满足预设模型条件;
第三调整单元,用于若检测到调整模型参数后的待训练模型不满足所述预设模型条件,则在按照预设规则调整所述预设阈值后,基于调整模型参数后的待训练模型,再执行所述步骤:将预设的负例训练数据输入待训练模型得到预测结果;
确定单元,用于若检测到调整模型参数后的待训练模型满足预设模型条件,则将调整模型参数后的待训练模型作为目标模型。
在一实施例中,所述待训练模型是用于检测遥感卫星图像中养殖场的模型,所述模型性能优化装置还包括:
图像输入模块,用于将待检测卫星图像输入所述目标模型得到所述待检测卫星图像中各个像素点的分类结果,其中,所述分类结果用于表示对应的像素点是否属于养殖场;
检测模块,用于根据所述分类结果得到所述待检测卫星图像的养殖场检测结果。
在一实施例中,所述模型性能优化装置还包括:
增广模块,用于对采集到的遥感卫星图像进行数据增广操作得到所述负例训练数据,其中,所述遥感卫星图像对应的标注是负例标注,所述数据增广操作至少包括扭曲操作、翻转操作和加噪操作。
本申请模型性能优化装置的具体实施方式的拓展内容与上述模型性能优化方法各实施例基本相同,在此不做赘述。
此外,本申请实施例还提出一种计算机可读存储介质,所述存储介质上存储有模型性能优化程序,所述模型性能优化程序被处理器执行时实现如下所述的模型性能优化方法的步骤。
本申请模型性能优化设备和计算机可读存储介质的各实施例,均可参照本申请模型性能优化方法各个实施例,此处不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装 置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种模型性能优化方法,其中,所述模型性能优化方法包括以下步骤:
    将预设的负例训练数据输入待训练模型得到预测结果;
    当所述预测结果表征所述负例训练数据被预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值;以及
    根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型。
  2. 如权利要求1所述的模型性能优化方法,其中,所述预测结果是所述负例训练数据被预测为负例的概率,所述当所述预测结果表征所述负例训练数据预测为负例的概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正的步骤包括:
    当所述预测结果大于所述预设阈值时,获取预设的损失修正系数,其中,所述损失修正系数是小于1的正数;以及
    将所述损失修正系数乘以所述负例训练数据对应的损失函数值,以对所述损失函数值进行修正。
  3. 如权利要求2所述的模型性能优化方法,其中,所述当所述预测结果大于所述预设阈值时,获取预设的损失修正系数的步骤包括:
    当所述预测结果大于所述预设阈值时,将所述预测结果代入预设的平滑下降公式得到所述损失修正系数,其中,所述损失修正系数随着所述预测结果变大而变小。
  4. 如权利要求3所述的模型性能优化方法,其中,所述
    平滑下降公式为:
    Figure WO-DOC-FIGURE-5

    其中,α(p)为损失修正系数,α为预设阈值,p为预测结果。
  5. 如权利要求1所述的模型性能优化方法,其中,所述将预设的负例训练数据输入待训练模型得到预测结果的步骤之前,还包括:
    基于预设的正例训练数据对初始模型进行初步训练,得到所述待训练模型;
    所述根据修正后的损失函数值调整所述待训练模型的模型参数的步骤包括:
    根据所述正例训练数据对应的损失函数值和修正后的所述负例训练数据对应的损失函数值,调整所述待训练模型的模型参数。
  6. 如权利要求1所述的模型性能优化方法,其中,所述根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型的步骤包括:
    根据修正后的损失函数值调整所述待训练模型的模型参数;
    检测调整模型参数后的待训练模型是否满足预设模型条件;
    若检测到调整模型参数后的待训练模型不满足所述预设模型条件,则在按照预设规则调整所述预设阈值后,基于调整模型参数后的待训练模型,再执行所述步骤:将预设的负例训练数据输入待训练模型得到预测结果;以及
    若检测到调整模型参数后的待训练模型满足预设模型条件,则将调整模型参数后的待训练模型作为目标模型。
  7. 如权利要求1至6任一项所述的模型性能优化方法,其中,所述待训练模型是用于检测遥感卫星图像中养殖场的模型,所述根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型的步骤之后,还包括:
    将待检测卫星图像输入所述目标模型得到所述待检测卫星图像中各个像素点的分类结果,其中,所述分类结果用于表示对应的像素点是否属于养殖场;以及
    根据所述分类结果得到所述待检测卫星图像的养殖场检测结果。
  8. 如权利要求7所述的模型性能优化方法,其中,所述将预设的负例训练数据输入待训练模型得到预测结果的步骤之前,还包括:
    对采集到的遥感卫星图像进行数据增广操作得到所述负例训练数据,其中,所述遥感卫星图像对应的标注是负例标注,所述数据增广操作至少包括扭曲操作、翻转操作和加噪操作。
  9. 如权利要求8所述的模型性能优化方法,其中,损失函数为:
    Figure WO-DOC-FIGURE-6

    其中,DL 2为损失函数值,p为待训练模型输出的像素点的分类类别,n为像素点的编号,N为总像素点个数,r为像素点的标注类别,ε为预设的一个极小值。
  10. 如权利要求1所述的模型性能优化方法,其中,所述对负例训练数据对应的损失函数值进行修正,使得修正后的损失函数值小于修正前的损失函数值的步骤包括:
    将负例训练数据对应的损失函数值减少一个预设值,以及将负例训练数据对应的损失函数值乘以一个预设的小于1的正数。
  11. 如权利要求1所述的模型性能优化方法,其中,所述根据修正后的损失函数值调整所述待训练模型的模型参数包括:
    根据修正后的损失函数值计算模型参数对应的梯度,并根据各个模型参数的梯度来对应更新模型参数。
  12. 一种模型性能优化装置,其中,所述模型性能优化装置包括:
    输入模块,用于将预设的负例训练数据输入待训练模型得到预测结果;
    修正模块,用于当所述预测结果表征所述负例训练数据被预测为负例的 概率大于预设阈值时,对所述负例训练数据对应的损失函数值进行修正,其中,修正后的损失函数值小于修正前的损失函数值;以及
    调整模块,用于根据修正后的损失函数值调整所述待训练模型的模型参数,以对所述待训练模型进行训练得到目标模型。
  13. 如权利要求12所述的模型性能优化装置,其中,所述预测结果包括所述负例训练数据被预测为负例的概率,所述修正模块包括:
    获取单元,用于当所述预测结果大于所述预设阈值时,获取预设的损失修正系数,其中,所述损失修正系数是小于1的正数;以及
    修正单元,用于将所述损失修正系数乘以所述负例训练数据对应的损失函数值,以对所述损失函数值进行修正。
  14. 如权利要求13所述的模型性能优化装置,其中,所述获取单元包括:
    计算单元,用于当所述预测结果大于所述预设阈值时,将所述预测结果代入预设的平滑下降公式得到所述损失修正系数,其中,所述损失修正系数随着所述预测结果变大而变小。
  15. 如权利要求12所述的模型性能优化装置,其中,所述模型性能优化装置还包括:
    初步训练模块,用于基于预设的正例训练数据对初始模型进行初步训练,得到所述待训练模型;
    所述调整模块包括:
    第一调整单元,用于根据所述正例训练数据对应的损失函数值和修正后的所述负例训练数据对应的损失函数值,调整所述待训练模型的模型参数。
  16. 如权利要求15所述的模型性能优化装置,其中,所述调整模块包括:
    第二调整单元,用于根据修正后的损失函数值调整所述待训练模型的模型参数;
    检测单元,用于检测调整模型参数后的待训练模型是否满足预设模型条件;
    第三调整单元,用于若检测到调整模型参数后的待训练模型不满足所述预设模型条件,则在按照预设规则调整所述预设阈值后,基于调整模型参数后的待训练模型,再执行所述步骤:将预设的负例训练数据输入待训练模型得到预测结果;以及
    确定单元,用于若检测到调整模型参数后的待训练模型满足预设模型条件,则将调整模型参数后的待训练模型作为目标模型。
  17. 如权利要求12所述的模型性能优化装置,其中,所述待训练模型是用于检测遥感卫星图像中养殖场的模型,所述模型性能优化装置还包括:
    图像输入模块,用于将待检测卫星图像输入所述目标模型得到所述待检测卫星图像中各个像素点的分类结果,其中,所述分类结果用于表示对应的像素点是否属于养殖场;以及
    检测模块,用于根据所述分类结果得到所述待检测卫星图像的养殖场检测结果。
  18. 如权利要求12所述的模型性能优化装置,其中所述模型性能优化装置还包括:
    增广模块,用于对采集到的遥感卫星图像进行数据增广操作得到所述负例训练数据,其中,所述遥感卫星图像对应的标注是负例标注,所述数据增广操作至少包括扭曲操作、翻转操作和加噪操作。
  19. 一种模型性能优化设备,其中,所述模型性能优化设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的模型性能优化程序,所述模型性能优化程序被所述处理器执行时实现如权利要求1至11中任一项所述的模型性能优化方法的步骤。
  20. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有模型性能优化程序,所述模型性能优化程序被处理器执行时实现如权利要求1至11中任一项所述的模型性能优化方法的步骤。
PCT/CN2020/134671 2020-02-28 2020-12-30 模型性能优化方法、装置、设备及存储介质 WO2021169473A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010131522.0A CN111368903B (zh) 2020-02-28 2020-02-28 模型性能优化方法、装置、设备及存储介质
CN202010131522.0 2020-02-28

Publications (1)

Publication Number Publication Date
WO2021169473A1 true WO2021169473A1 (zh) 2021-09-02

Family

ID=71208338

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/134671 WO2021169473A1 (zh) 2020-02-28 2020-12-30 模型性能优化方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN111368903B (zh)
WO (1) WO2021169473A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114778339A (zh) * 2022-04-11 2022-07-22 江苏鼎盛检测中心有限公司 一种基于大数据的可降低误差的高低温耐久测试分析方法
CN115328242A (zh) * 2022-10-11 2022-11-11 山东华邦农牧机械股份有限公司 基于远程控制的养殖环境智能调节系统
CN115833843A (zh) * 2023-02-14 2023-03-21 临沂云斗电子科技有限公司 一种车辆运行监控数据存储优化方法及管理平台
CN116645618A (zh) * 2023-06-05 2023-08-25 广东省农业科学院设施农业研究所 农业数据处理方法、系统和存储介质
CN116911902A (zh) * 2023-09-12 2023-10-20 深圳须弥云图空间科技有限公司 目标推荐方法及装置

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111368903B (zh) * 2020-02-28 2021-08-27 深圳前海微众银行股份有限公司 模型性能优化方法、装置、设备及存储介质
CN112732913B (zh) * 2020-12-30 2023-08-22 平安科技(深圳)有限公司 一种非均衡样本的分类方法、装置、设备及存储介质
CN112765354B (zh) * 2021-01-26 2023-04-07 深圳追一科技有限公司 模型训练方法、模型训练装置、计算机设备和存储介质
CN112560825B (zh) * 2021-02-23 2021-05-18 北京澎思科技有限公司 人脸检测方法、装置、电子设备以及可读存储介质
CN113723616A (zh) * 2021-08-17 2021-11-30 上海智能网联汽车技术中心有限公司 一种多传感器信息半自动标注方法、系统及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815332A (zh) * 2019-01-07 2019-05-28 平安科技(深圳)有限公司 损失函数优化方法、装置、计算机设备及存储介质
CN109977875A (zh) * 2019-03-28 2019-07-05 北京易达图灵科技有限公司 基于深度学习的手势识别方法及设备
CN110362814A (zh) * 2018-04-10 2019-10-22 普天信息技术有限公司 一种基于改进损失函数的命名实体识别方法及装置
CN110490242A (zh) * 2019-08-12 2019-11-22 腾讯医疗健康(深圳)有限公司 图像分类网络的训练方法、眼底图像分类方法及相关设备
WO2019231105A1 (ko) * 2018-05-31 2019-12-05 한국과학기술원 트리플릿 기반의 손실함수를 활용한 순서가 있는 분류문제를 위한 딥러닝 모델 학습 방법 및 장치
CN111368903A (zh) * 2020-02-28 2020-07-03 深圳前海微众银行股份有限公司 模型性能优化方法、装置、设备及存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9704068B2 (en) * 2012-06-22 2017-07-11 Google Inc. System and method for labelling aerial images
US11531874B2 (en) * 2015-11-06 2022-12-20 Google Llc Regularizing machine learning models
CN110084271B (zh) * 2019-03-22 2021-08-20 同盾控股有限公司 一种图片类别的识别方法和装置
CN110019685B (zh) * 2019-04-10 2021-08-20 鼎富智能科技有限公司 基于排序学习的深度文本匹配方法及装置
CN110555465B (zh) * 2019-08-13 2022-03-11 成都信息工程大学 一种基于cnn与多特征融合的天气图像识别方法
CN110543898A (zh) * 2019-08-16 2019-12-06 上海数禾信息科技有限公司 用于噪声标签的监督学习方法、数据分类处理方法以及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110362814A (zh) * 2018-04-10 2019-10-22 普天信息技术有限公司 一种基于改进损失函数的命名实体识别方法及装置
WO2019231105A1 (ko) * 2018-05-31 2019-12-05 한국과학기술원 트리플릿 기반의 손실함수를 활용한 순서가 있는 분류문제를 위한 딥러닝 모델 학습 방법 및 장치
CN109815332A (zh) * 2019-01-07 2019-05-28 平安科技(深圳)有限公司 损失函数优化方法、装置、计算机设备及存储介质
CN109977875A (zh) * 2019-03-28 2019-07-05 北京易达图灵科技有限公司 基于深度学习的手势识别方法及设备
CN110490242A (zh) * 2019-08-12 2019-11-22 腾讯医疗健康(深圳)有限公司 图像分类网络的训练方法、眼底图像分类方法及相关设备
CN111368903A (zh) * 2020-02-28 2020-07-03 深圳前海微众银行股份有限公司 模型性能优化方法、装置、设备及存储介质

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114778339A (zh) * 2022-04-11 2022-07-22 江苏鼎盛检测中心有限公司 一种基于大数据的可降低误差的高低温耐久测试分析方法
CN115328242A (zh) * 2022-10-11 2022-11-11 山东华邦农牧机械股份有限公司 基于远程控制的养殖环境智能调节系统
CN115833843A (zh) * 2023-02-14 2023-03-21 临沂云斗电子科技有限公司 一种车辆运行监控数据存储优化方法及管理平台
CN115833843B (zh) * 2023-02-14 2023-05-09 临沂云斗电子科技有限公司 一种车辆运行监控数据存储优化方法及管理平台
CN116645618A (zh) * 2023-06-05 2023-08-25 广东省农业科学院设施农业研究所 农业数据处理方法、系统和存储介质
CN116645618B (zh) * 2023-06-05 2023-12-08 广东省农业科学院设施农业研究所 农业数据处理方法、系统和存储介质
CN116911902A (zh) * 2023-09-12 2023-10-20 深圳须弥云图空间科技有限公司 目标推荐方法及装置

Also Published As

Publication number Publication date
CN111368903A (zh) 2020-07-03
CN111368903B (zh) 2021-08-27

Similar Documents

Publication Publication Date Title
WO2021169473A1 (zh) 模型性能优化方法、装置、设备及存储介质
WO2020248957A1 (zh) 遮挡的目标物体的检测方法、系统、设备及存储介质
WO2021008328A1 (zh) 图像处理方法、装置、终端及存储介质
US10970097B2 (en) Adaptive web-based robotic process automation
US11961227B2 (en) Method and device for detecting and locating lesion in medical image, equipment and storage medium
WO2018108129A1 (zh) 用于识别物体类别的方法及装置、电子设备
JP2019520615A (ja) 損害賠償請求書類の文字認識方法、装置、サーバ及び記憶媒体
US20230119593A1 (en) Method and apparatus for training facial feature extraction model, method and apparatus for extracting facial features, device, and storage medium
US20220198773A1 (en) Systems and methods for enhancing real-time image recognition
US20220366677A1 (en) Method for inspecting labeling on bounding box by using deep learning model and apparatus using same
CN110889437A (zh) 一种图像处理方法、装置、电子设备及存储介质
WO2019091401A1 (zh) 深度神经网络的网络模型压缩方法、装置及计算机设备
CN113657202A (zh) 构件识别方法、构建训练集方法、装置、设备及存储介质
US20220358621A1 (en) Point cloud feature enhancement and apparatus, computer device and storage medium
WO2021174814A1 (zh) 众包任务的答案验证方法、装置、计算机设备及存储介质
WO2021174820A1 (zh) 难样本发现方法、装置及计算机设备
US20240012971A1 (en) Method and system for determining equivalence of design rule manual data and design rule checking data
WO2021000674A1 (zh) 细胞图片识别方法、系统、计算机设备及可读存储介质
TWI682332B (zh) 用於識別絕育狀態影像的深度學習方法及其識別裝置
CN113033431B (zh) 光学字符识别模型训练和识别方法、装置、设备及介质
CN113505763A (zh) 关键点检测方法、装置、电子设备及存储介质
CN113012189A (zh) 图像识别方法、装置、计算机设备和存储介质
CN116416513A (zh) 信息获取方法、装置、电子设备及计算机可读存储介质
CN111143643A (zh) 元素识别方法、装置、可读存储介质和电子设备
CN111612023A (zh) 一种分类模型构建方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20922356

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20922356

Country of ref document: EP

Kind code of ref document: A1