WO2023236044A1 - 对象检测模型训练方法、装置、计算机设备和存储介质 - Google Patents

对象检测模型训练方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2023236044A1
WO2023236044A1 PCT/CN2022/097399 CN2022097399W WO2023236044A1 WO 2023236044 A1 WO2023236044 A1 WO 2023236044A1 CN 2022097399 W CN2022097399 W CN 2022097399W WO 2023236044 A1 WO2023236044 A1 WO 2023236044A1
Authority
WO
WIPO (PCT)
Prior art keywords
detection model
object detection
loss value
score
detected
Prior art date
Application number
PCT/CN2022/097399
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 西门子股份公司
Priority to PCT/CN2022/097399 priority Critical patent/WO2023236044A1/zh
Publication of WO2023236044A1 publication Critical patent/WO2023236044A1/zh

Links

Images

Definitions

  • the present application relates to machine learning, and in particular, to an object detection model training method, device, computer equipment and storage medium.
  • GUI Graphical User Interface
  • the object detection model training method, device, computer equipment and storage medium provided by this application can improve the accuracy of detecting target objects.
  • an object detection model training method including: inputting a sample image into an object detection model to be trained, and obtaining the targetness of the object detection model output for the object to be detected in the sample image.
  • Score wherein the object detection model is used to detect the target object in the input image, and the targetness score is positively related to the probability that the object to be detected is the target object; if the object to be detected is a negative sample, Then, the loss value of the object detection model is determined according to the targetness score and the current iteration number of the object detection model, where as the number of iterations increases, the changing trend of the loss value of the object detection model for negative samples First increases and then decreases as the targetness score increases; the object detection model is iteratively updated according to the loss value.
  • an object detection model training device including: an input module for inputting a sample image into an object detection model to be trained, and obtaining the object detection model's response to the sample image Targetness score output by the object to be detected, wherein the object detection model is used to detect the target object in the input image, and the targetness score is positively related to the probability that the object to be detected is the target object; the calculation module, Used to determine the loss value of the object detection model according to the targetness score and the current iteration number of the object detection model when the object to be detected is a negative sample, wherein as the number of iterations increases, the The change trend of the loss value of the object detection model for negative samples is to first increase and then decrease as the targetness score increases; the update module is used to iteratively update the object detection model according to the loss value.
  • the object detection model is used to detect icons in a graphical user interface.
  • the method includes: inputting a sample image including a graphical user interface.
  • the object detection model to be trained obtains the targeting score output by the object detection model for the object to be detected in the graphical user interface, wherein the targeting score is positively related to the probability that the object to be detected is an icon; if If the object to be detected is a negative sample, the loss value of the object detection model is determined according to the targetness score and the current iteration number of the object detection model, where as the number of iterations increases, the object detection model
  • the changing trend of the loss value for negative samples is to first increase and then decrease as the targetness score increases; the object detection model is iteratively updated according to the loss value.
  • a computer device including: a processor, a communication interface, a memory, and a communication bus.
  • the processor, the memory, and the communication interface complete each other through the communication bus. communication between; the memory is used to store at least one executable instruction, the executable instruction causes the processor to perform operations corresponding to the object detection model training method provided in the first aspect or the third aspect.
  • a computer-readable storage medium is provided.
  • Computer instructions are stored on the computer-readable storage medium. When executed by a processor, the computer instructions cause the processor to execute Operations corresponding to the object detection model training method provided in the first aspect or the third aspect.
  • a computer program product is provided, the computer program product is tangibly stored on a computer-readable medium and includes computer-executable instructions, which when executed At least one processor is caused to execute the object detection model training method provided in the above first aspect or the third aspect.
  • the loss value of the object detection model is determined according to the target score corresponding to the object to be detected and the current iteration number of the object detection model. , and then update the object detection model based on the determined loss value. Since the change trend of the loss value of the object detection model for negative samples is to first increase and then decrease as the target score increases, as the number of iterations increases, the loss value of the object to be detected that is mistakenly labeled as a negative sample will decreases, thus the contribution to the object detection model decreases.
  • the object detection model is less affected by the objects to be detected that are mistakenly labeled as negative samples, so that the trained object detection model can detect the objects that are mistakenly labeled as negative samples. target object, thereby improving the accuracy of detecting the target object.
  • Figure 1 is a flow chart of an object detection model training method according to one embodiment of the present application.
  • Figure 2 is a schematic diagram of the relationship between loss value and targetness score according to an embodiment of the present application
  • Figure 3 is a schematic diagram of the relationship between loss value and target score according to another embodiment of the present application.
  • Figure 4 is a schematic diagram of an object detection model training device according to an embodiment of the present application.
  • Figure 5 is a flow chart of an object detection model training method according to another embodiment of the present application.
  • Figure 6 is a schematic diagram of a computer device according to an embodiment of the present application.
  • Object detection model training method 400 Object detection model training device 600: Electronic equipment
  • Update module 602 Processor 604: Communication interface
  • the graphical user interface is input into the object detection model.
  • the object detection model detects icons in the graphical user interface, and then determines whether the software is normal based on the detected icons.
  • the graphical user interface of the software will be updated regularly, and new icons will appear in the updated graphical user interface.
  • the object detection model needs to be updated so that the object detection model can detect the newly appearing icons.
  • the targetness score of the object to be detected in the sample image is obtained by the object detection model. If the object to be detected in the sample image is marked as a negative sample, then according to the object to be detected, The target score corresponding to the detection object and the current iteration number of the object detection model are used to determine the loss value of the object detection model, and then the object detection model is updated based on the determined loss value.
  • the change trend of the loss value of the object detection model for negative samples is to first increase and then decrease as the objectivity score increases.
  • the object to be detected belongs to the target object and is mistakenly labeled as a negative sample, the object to be detected will correspond to a larger target score, and the loss value of the object detection model for the object to be detected will be smaller. Based on the corresponding After the object detection model is updated with the loss value, the object detection model will determine the object to be detected as the target object, which can improve the accuracy of detecting the target object.
  • Figure 1 is a flow chart of an object detection model training method according to an embodiment of the present application. As shown in Figure 1, the object detection model training method 100 includes the following steps:
  • Step 101 Input the sample image into the object detection model to be trained, and obtain the targetness score output by the object detection model for the object to be detected in the sample image.
  • the object detection model to be trained is used to detect target objects in the input image.
  • the input image of the object detection model may include one or more objects to be detected, and the object detection model may separately detect whether each object to be detected is a target object.
  • the object detection model can output the confidence level for the object to be detected.
  • the value range of the confidence level is [0,1], indicating that the higher the probability that the object to be detected is the target object, Then it can be determined that the object to be detected whose confidence is greater than the confidence threshold is the target object, and the object to be detected whose confidence is less than or equal to the confidence threshold is not the target object.
  • the object detection model can obtain the objectness score (Objectness Score) of the object to be detected.
  • the targeting score can indicate the probability that the object to be detected is the target object, and the targeting score can be positively correlated with the probability that the object to be detected is the target object, that is, the higher the targeting score, the higher the probability that the object to be detected is the target object. high.
  • Step 102 If the object to be detected is a negative sample, determine the loss value of the object detection model based on the targetness score and the current iteration number of the object detection model.
  • the loss value of the object detection model is determined based on the targetness score of the object to be detected and the current iteration number of the object detection model. . Among them, as the number of iterations of the object detection model increases, the loss value of the object detection model for negative samples first increases and then decreases as the targetness score increases.
  • the loss value of the object detection model is used to indicate the degree to which the predicted value of the object detection model is different from the real value. Since the object detection model is used to detect whether the object to be detected is a target object, the loss value indicates whether the object to be detected is a target object. The difference between the prediction result of the target object and whether the object to be detected is actually the target object. The range of the loss value is [0,1]. The larger the loss value, the greater the difference between the predicted value of the object detection model and the real value, and the worse the prediction accuracy of the object detection model. Therefore, the goal of training the object detection model is Minimize the loss value.
  • FIGs 2 and 3 are schematic diagrams of the relationship between the loss value and the objective score according to an embodiment of the present application.
  • Figure 2 and Figure 3 are for negative samples, and Figure 2 corresponds to the relationship between the loss value and the objective score when the number of iterations is small.
  • Schematic diagram, Figure 3 corresponds to the schematic diagram of the relationship between the loss value and the target score when the training is completed (the number of iterations is large).
  • the abscissa y represents the target score
  • the ordinate L 1 represents the loss value.
  • the loss value is positively correlated with the target score.
  • the representation object detection model determines that the object to be detected is the target object, but the object to be detected is marked as negative.
  • the sample that is, the detection result of the object detection model does not match the actual situation, so it corresponds to a larger loss value, which has a greater impact on the adjustment of the model parameters, so that the object detection model can correctly detect the target object.
  • the object to be detected may be mistakenly labeled as a negative sample. Therefore, as the number of iterations increases, the correlation between the loss value and the targetness score gradually becomes the loss value. As the target score increases, it first increases and then decreases. After the object detection model training is completed, the relationship between the loss value and the target score is shown in Figure 3.
  • the loss value first increases and then decreases as the target score increases.
  • Smaller and larger target scores correspond to smaller loss values.
  • a smaller target score indicates that the object detection model determines that the object to be detected is not the target object, and the object to be detected itself is also marked as a negative sample. Therefore, the detection results of the object detection model are consistent with the actual situation, so it corresponds to a smaller loss value. , to have a small impact on model parameter adjustment.
  • a large target score indicates that the object detection model determines that the object to be detected is the target object, but the object to be detected itself is marked as a negative sample, so the detection results of the object detection model are not consistent with the actual situation, but the object to be detected may be the target object. Mislabeled as negative samples, so the corresponding smaller loss value will have less impact on the model parameter adjustment, so that the object detection model can detect target objects that are mislabeled as negative samples.
  • the object detection model is relatively likely to determine that the object to be detected is the target object, but the object to be detected itself is marked as a negative sample. This part of the objects to be detected is usually not the target object, so a larger loss value will have a greater impact on the adjustment of the model parameters, so that the object detection model does not determine this part of the object to be detected as the target object.
  • Step 103 Update and iterate the object detection model according to the loss value.
  • the object detection model is iteratively updated based on the obtained loss value until the number of iterative updates of the object detection model reaches the preset number, or the object detection model The loss value is less than the preset value, and the training of the object detection model is completed.
  • the object detection model is determined based on the target score corresponding to the object to be detected and the current iteration number of the object detection model. loss value, and then update the object detection model based on the determined loss value. Since the change trend of the loss value of the object detection model for negative samples is to first increase and then decrease as the target score increases, as the number of iterations increases, the loss value of the object to be detected that is mistakenly labeled as a negative sample will decreases, thus the contribution to the object detection model decreases.
  • the object detection model is less affected by the objects to be detected that are mistakenly labeled as negative samples, so that the trained object detection model can detect the objects that are mistakenly labeled as negative samples. target object, thereby improving the accuracy of detecting the target object.
  • the first calculation item and the second calculation item when determining the loss value based on the targeting score and the current iteration number of the object detection model, can be determined respectively based on the targeting score and the current iteration number, and then The loss value of the object detection model is determined based on the product of the first calculation term and the second calculation term.
  • the first calculation item is positively correlated with the target score and the current iteration number
  • the second calculation item is negatively correlated with the target score and the current iteration number.
  • the loss value of the object detection model is determined according to the product of the first calculation term and the second calculation term.
  • the first calculation term is positively related to both the objective score and the current iteration number.
  • the second calculation term is both positively related to the objective score and the current iteration number. Negative correlation. When the number of iterations is small, the first calculation item plays a dominant role in the loss value, and when the number of iterations is large, the second calculation item plays a dominant role in the loss value. When the target score is small, the first calculation item plays a dominant role in the loss value; when the target score is large, the second calculation item plays a dominant role in the loss value.
  • the first calculation item is positively correlated with the target score and the current number of iterations
  • the second calculation item is negatively correlated with both the target score and the current iteration number.
  • the product determines the loss value of the object detection model, so that as the number of iterations increases, the change trend of the loss value of the object detection model for negative samples is to first increase and then decrease as the target score increases, thus having larger and smaller values. Negative samples with objective scores all correspond to smaller loss values, while negative samples with moderately large objective scores correspond to larger loss values. As training progresses, the number of samples to be detected that are mistakenly labeled as negative samples is gradually reduced.
  • the contribution of objects to the object detection model ensures that the trained object detection model can detect target samples that are mistakenly labeled as negative samples. Negative samples with smaller targeting scores always contribute less to the object detection model, while negative samples with moderate targeting scores contribute more to the object detection model, ensuring that the trained object detection model can be accurate. Detect correctly labeled target samples.
  • the following formula (1 ) calculates the loss value of the object detection model for negative samples.
  • L 1 is used to characterize the loss value of the object detection model for the object to be detected when the object to be detected is a negative sample; y ⁇ (1- ⁇ ) is used to characterize the first calculation item; (1-y) ⁇ is used to characterize the second Calculation item; y is used to represent the target score corresponding to the object to be detected, 0 ⁇ y ⁇ 1; ⁇ is used to represent the ratio of the current iteration number to the total iteration number, 0 ⁇ ⁇ ⁇ 1; ⁇ is used to represent the number of positive samples based on A constant determined by the ratio to the number of negative samples.
  • is a constant determined based on the ratio of the number of positive samples to the number of negative samples, 0 ⁇ 1.
  • takes the larger value.
  • value when the ratio of the number of positive samples to the number of negative samples in the sample image is small, ⁇ is small.
  • the ratio of the number of positive samples to the number of negative samples is small, so the value of ⁇ is less than 0.5, for example ⁇ can take values 0.2, 0.3, etc.
  • the loss value of the object detection model is calculated through the above formula (1) according to the targetness score and the current number of iterations. As the number of iterations increases, the greater the targetness Negative samples with ratings will correspond to smaller loss values, while negative samples with larger target scores are target objects that are mistakenly labeled as negative samples. That is, as training progresses, pairs of target objects that are mistakenly labeled as negative samples will The contribution of model training is reduced, and the object detection model will be less affected by the target objects that are mistakenly labeled as negative samples. That is to say, it is no longer emphasized to the object detection model that the target objects that are mistakenly labeled as negative samples are negative samples. As a result, the object detection model after training can detect target objects that are mistakenly marked as negative samples in the input image, thereby improving the accuracy of the object detection model in detecting target objects.
  • the loss value of the object detection model is determined based on the targetness score.
  • the loss value of the object detection model for positive samples is negatively related to the objectivity score.
  • the positive sample belongs to the target object. If the target score corresponding to a positive sample is small, it means that the object detection model cannot correctly detect the positive sample, so it needs to correspond to a larger loss value to make a greater contribution to model training. If the objectivity score corresponding to a positive sample is large, it means that the object detection model can correctly detect the positive sample, so it needs to correspond to a smaller loss value to make a smaller contribution to model training.
  • a smaller targetness score of a positive sample indicates that the object detection model cannot correctly detect the positive sample
  • a larger targetness score of a positive sample indicates that the object detection model can correctly detect the positive sample.
  • the object detection model When the model cannot correctly detect positive samples, it should generate a larger loss value to make a greater contribution to model training. When the object detection model can correctly detect positive samples, it should generate a smaller loss value to make a greater contribution to model training. The contribution is small, so the loss value of the object detection model for positive samples is negatively correlated with the target score. Based on this, the loss value of the object detection model for positive samples can be determined based on the target score to ensure the accuracy of updating the object detection model through positive samples. .
  • the loss value of the object detection model for the positive samples can be calculated based on the targeting score using the following formula (2).
  • L 2 is used to represent the loss value of the object detection model for the object to be detected when the object to be detected is a positive sample; y is used to represent the target score corresponding to the object to be detected, 0 ⁇ y ⁇ 1; ⁇ is used to represent the target score based on the positive sample A constant determined by the ratio of the number to the number of negative samples.
  • is a constant determined based on the ratio of the number of positive samples to the number of negative samples, 0 ⁇ 1.
  • takes the larger value.
  • value when the ratio of the number of positive samples to the number of negative samples in the sample image is small, ⁇ is small.
  • the ratio of the number of positive samples to the number of negative samples is small, so the value of ⁇ is less than 0.5, for example ⁇ can take values 0.2, 0.3, etc.
  • the loss value of the object detection model is calculated through the above formula (2) according to the target score.
  • a larger target score corresponds to a larger loss value
  • the model training is Produce a larger contribution
  • a smaller target score corresponds to a larger loss value
  • produce a smaller contribution to model training ensure the accuracy of updating the object detection model through positive samples, and then ensure the updated object detection model Ability to correctly detect positive samples in input images.
  • the gradient of the object detection model can be determined through the backpropagation algorithm based on the loss value, and then the object detection model is iteratively updated based on the gradient.
  • the backpropagation (BP) algorithm is used to calculate the gradient of the object detection model.
  • the backpropagation algorithm can determine the object detection model based on the loss of the object detection model.
  • the gradient of the object detection model can then be iteratively updated with the gradient of the object detection model to ensure the accuracy of training the object detection model based on the loss value, thereby ensuring that the trained object detection model can accurately detect the target object in the input image.
  • Figure 4 is a schematic diagram of an object detection model training device according to an embodiment of the present application. As shown in Figure 4, the object detection model training device 400 includes:
  • the input module 401 is used to input the sample image into the object detection model to be trained, and obtain the target score output by the object detection model for the object to be detected in the sample image, where the object detection model is used to detect the target object in the input image, and the target The sex score is positively correlated with the probability that the object to be detected is the target object;
  • the calculation module 402 is used to determine the loss value of the object detection model according to the targetness score and the current iteration number of the object detection model when the object to be detected is a negative sample. As the number of iterations increases, the object detection model responds to the negative sample. The changing trend of the loss value is that it first increases and then decreases as the target score increases;
  • the update module 403 is used to iteratively update the object detection model according to the loss value.
  • the input module 401 can be used to perform step 101 in the above method embodiment
  • the calculation module 402 can be used to perform step 102 in the above method embodiment
  • the update module 403 can be used to perform the steps in the above method embodiment. 103.
  • the calculation module 402 can determine the first calculation item and the second calculation item respectively according to the targetness score and the current number of iterations, and determine the object according to the product of the first calculation item and the second calculation item. Detect the loss value of the model. Among them, the first calculation item is positively correlated with the target score and the current iteration number, and the second calculation item is negatively correlated with the target score and the current iteration number.
  • the calculation module 402 can also determine the loss value of the object detection model based on the targetness score when the object to be detected is a positive sample, where the loss value of the object detection model for the positive sample is consistent with the targetness score. Ratings are negatively correlated.
  • the update module 403 can determine the gradient of the object detection model through a backpropagation algorithm based on the loss value, and iteratively update the object detection model based on the gradient.
  • the object detection model is used to detect icons in the graphical user interface (Graphical User Interface, GUI), that is, in the graphical user interface
  • GUI graphical User Interface
  • the target is the target object
  • the graphical user interface is generated by the corresponding software program.
  • the object detection model detects the icons in the graphical user interface, and then determines whether the software program is running based on the number of detected icons. normal.
  • Figure 5 is a schematic diagram of an object detection model training method according to an embodiment of the present application. As shown in Figure 5, the object detection model training method includes the following steps:
  • Step 501 Input the sample image including the graphical user interface into the object detection model to be trained, and obtain the targetness score output by the object detection model for the object to be detected in the graphical user interface.
  • the sample image includes a graphical user interface.
  • the graphical user interface is generated by the software program to be tested.
  • the graphical user interface may include one or more icons.
  • the graphics are target objects to be detected by the object detection model to be trained.
  • Sample images can be screenshots of graphical user interfaces.
  • the targetness score output by the object detection model for the object to be detected in the sample image can be obtained.
  • the targetness score is positively related to the probability that the object to be detected is an icon.
  • the object to be detected can be an icon in the graphical user interface, or it can be text, blank area, etc. in the graphical user interface.
  • Step 502 If the object to be detected is a negative sample, determine the loss value of the object detection model based on the targetness score and the current iteration number of the object detection model.
  • the icons in the sample image need to be annotated, for example, through a rectangular annotation box to annotate the icons in the sample image.
  • the part of the sample image located within the annotation box is a positive sample, while the part of the image located outside the annotation box is a negative sample.
  • a sample image can include multiple positive samples and multiple negative samples.
  • the new icons generated by the software program update are not labeled as positive samples, and the unlabeled icons are considered negative samples by the object detection model.
  • the loss value of the object detection model is determined based on the objectivity score of the object to be detected and the current iteration number of the object detection model. Among them, as the number of iterations increases, the loss value of the object detection model for negative samples first increases and then decreases as the target score increases.
  • Step 503 Iteratively update the object detection model according to the loss value.
  • the object detection model is iteratively updated based on the obtained loss value until the number of iterative updates of the object detection model reaches the preset number, or the object detection model The loss value is less than the preset value, and the training of the object detection model is completed.
  • the object detection model is determined based on the target score corresponding to the object to be detected and the current iteration number of the object detection model. loss value, and then update the object detection model based on the determined loss value. Since the loss value of the object detection model for negative samples first increases and then decreases as the objectivity score increases, as the number of iterations increases, the loss value of icons that are mistakenly labeled as negative samples will decrease.
  • the contribution to the object detection model is reduced, and the object detection model is less affected by icons that are mistakenly labeled as negative samples, so that the trained object detection model can detect icons that are mistakenly labeled as negative samples, so that it can Improve the accuracy of detecting icons in graphical user interfaces, thereby ensuring the accuracy of testing software programs based on icon detection.
  • Figure 6 is a schematic diagram of a computer device according to an embodiment of the present application.
  • the specific embodiment of the present application does not limit the specific implementation of the computer device.
  • the computer device 600 provided by the embodiment of the present application includes: a processor 602, a communication interface 604, a memory 606, and a communication bus 608. in:
  • the processor 602, communication interface 604, and memory 606 communicate through a communication bus 608.
  • Communication interface 604 is used to communicate with other computer devices or servers.
  • the processor 602 is configured to execute the program 610. Specifically, it can execute the relevant steps in any of the foregoing object detection model training method embodiments.
  • program 610 may include program code including computer operating instructions.
  • the processor 602 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present application.
  • the one or more processors included in the smart device can be the same type of processor, such as one or more CPUs; or they can be different types of processors, such as one or more CPUs and one or more ASICs.
  • Memory 606 is used to store programs 610.
  • Memory 606 may include high-speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
  • the program 610 can be specifically used to cause the processor 602 to execute the object detection model training method in any of the foregoing embodiments.
  • each step in program 610 please refer to the corresponding steps and corresponding descriptions in the units in any of the foregoing object detection model training method embodiments, and will not be described again here.
  • Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described devices and modules can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be described again here.
  • the object detection is determined according to the target score corresponding to the object to be detected and the current iteration number of the object detection model.
  • the loss value of the model is then updated according to the determined loss value. Since the change trend of the loss value of the object detection model for negative samples is to first increase and then decrease as the target score increases, as the number of iterations increases, the loss value of the object to be detected that is mistakenly labeled as a negative sample will decreases, thus the contribution to the object detection model decreases.
  • the object detection model is less affected by the objects to be detected that are mistakenly labeled as negative samples, so that the trained object detection model can detect the objects that are mistakenly labeled as negative samples. target object, thereby improving the accuracy of detecting the target object.
  • the present application also provides a computer-readable storage medium storing instructions for causing a machine to execute the object detection model training method as described herein.
  • a system or device equipped with a storage medium may be provided, on which the software program code that implements the functions of any of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device ) reads and executes the program code stored in the storage medium.
  • Examples of storage media for providing program codes include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), Tapes, non-volatile memory cards and ROM.
  • the program code can be downloaded from the server computer via the communications network.
  • the program code read from the storage medium is written into the memory provided in the expansion board inserted into the computer or written into the memory provided in the expansion module connected to the computer, and then based on the program code
  • the instructions cause the CPU installed on the expansion board or expansion module to perform part or all of the actual operations, thereby realizing the functions of any of the above embodiments.
  • Embodiments of the present application also provide a computer program product, which is tangibly stored on a computer-readable medium and includes computer-executable instructions that, when executed, cause at least one processor to Execute the object detection model training method provided by the above embodiments. It should be understood that each solution in this embodiment has the corresponding technical effects in the above method embodiment, and will not be described again here.
  • the hardware module can be implemented mechanically or electrically.
  • a hardware module may include permanently dedicated circuitry or logic (such as a specialized processor, FPGA, or ASIC) to complete the corresponding operation.
  • Hardware modules may also include programmable logic or circuits (such as general-purpose processors or other programmable processors), which can be temporarily set by software to complete corresponding operations.
  • the specific implementation method mechanical method, or dedicated permanent circuit, or temporarily installed circuit

Landscapes

  • Image Analysis (AREA)

Abstract

本申请提供了对象检测模型训练方法、装置、计算机设备和存储介质,该对象检测模型训练方法包括:将样本图像输入待训练的对象检测模型,获得对象检测模型针对样本图像中待检测对象输出的目标性评分,其中,对象检测模型用于检测输入图像中的目标对象,目标性评分与待检测对象为目标对象的概率正相关;若待检测对象为负样本,则根据目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值,其中,随迭代次数的增加,对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小;根据损失值对对象检测模型进行迭代更新。本方案能够提高对象检测模型对目标对象进行检测的准确性。

Description

对象检测模型训练方法、装置、计算机设备和存储介质 技术领域
本申请涉及机器学习,尤其涉及一种对象检测模型训练方法、装置、计算机设备和存储介质。
背景技术
基于图形用户界面(Graphic User Interface,GUI)的软件测试在软件开发中扮演中重要的角色。获取待测试软件运行时所形成的图形用户界面,将图形用户界面输入预先训练的对象检测模型,通过对象检测模型检测图形用户界面中的图标,进而根据所检测到的图标确定待测试软件是否正常。由于图形用户界面会定期更新,而更新后的图形用户界面中会出现新的图标,由于对象检测模型无法检测出新出现的图标,为此需要更新对象检测模型。
目前,在更新对象检测模型时,需要人工标注样本图像中的图标,即将样本图像中的图标标注出来,进而通过标注后的样本图像更新对象检测模型。
然而,由于图形用户界面更新会产生较多数量的新图标,而人工无法对样本图像中的全部图标进行标注,进而在通过样本图像更新对象检测模型时,未标注的图标将作为负样本,在通过更新后的对象检测模型进行图标检测时,将无法检测出样本图像中未标注的图标,进而导致对象检测模型对目标对象进行检测的准确性较低。
发明内容
有鉴于此,本申请提供的对象检测模型训练方法、装置、计算机设备和存储介质,能够提高对目标对象进行检测的准确性。
根据本申请实施例的第一方面,提供了对象检测模型训练方法,包括:将样本图像输入待训练的对象检测模型,获得所述对象检测模型针对所述样本图像中待检测对象输出的目标性评分,其中,所述对象检测模型用于检测输入图像中的目标对象,所述目标性评分与所述待检测对象为所述目标对象的概率正相关;若所述待检测对象为负样本,则根据所述目标性评分和所述对象检测模型的当前迭代次数,确定所述对象检测模型的损失值,其中,随迭代次数的增加,所述对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小;根据所述损失值对所述对象检测模型进行迭代更新。
根据本申请实施例的第二方面,提供了一种对象检测模型训练装置,包括:输入模块, 用于将样本图像输入待训练的对象检测模型,获得所述对象检测模型针对所述样本图像中待检测对象输出的目标性评分,其中,所述对象检测模型用于检测输入图像中的目标对象,所述目标性评分与所述待检测对象为所述目标对象的概率正相关;计算模块,用于在所述待检测对象为负样本时,根据所述目标性评分和所述对象检测模型的当前迭代次数,确定所述对象检测模型的损失值,其中,随迭代次数的增加,所述对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小;更新模块,用于根据所述损失值对所述对象检测模型进行迭代更新。
根据本申请实施例的第三方面,提供了另一种对象检测模型训练方法,所述对象检测模型用于检测图形用户界面中的图标,所述方法包括:将包括图形用户界面的样本图像输入待训练的对象检测模型,获得所述对象检测模型针对所述图形用户界面中待检测对象输出的目标性评分,其中,所述目标性评分与所述待检测对象为图标的概率正相关;若所述待检测对象为负样本,则根据所述目标性评分和所述对象检测模型的当前迭代次数,确定所述对象检测模型的损失值,其中,随迭代次数的增加,所述对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小;根据所述损失值对所述对象检测模型进行迭代更新。
根据本申请实施例的第四方面,提供了一种计算机设备,包括:处理器、通信接口、存储器和通信总线,所述处理器、所述存储器和所述通信接口通过所述通信总线完成相互间的通信;所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行上述第一方面或第三方面所提供对象检测模型训练方法对应的操作。
根据本申请实施例的第五方面,提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机指令,所述计算机指令在被处理器执行时,使所述处理器执行上述第一方面或第三方面所提供对象检测模型训练方法对应的操作。
根据本申请实施例的第六方面,提供了一种计算机程序产品,所述计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行如上述第一方面或第三方面所提供对象检测模型训练方法。
由上述技术方案,训练对象检测模型的过程中,针对被标准为负样本的待检测对象,根据该待检测对象对应的目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值,进而根据确定出的损失值对对象检测模型进行更新。由于对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小,随着迭代次数的增加,被误标注为负样本的待检测对象的损失值会减小,从而对对象检测模型的贡献度减小,对象检测模型受到被误标注为负样本的待检测对象的影响较小,从而完成训练的对象检测模型能够检测到 被误标注为负样本的目标对象,从而可以提高对目标对象进行检测的准确性。
附图说明
图1是本申请一个实施例的对象检测模型训练方法的流程图;
图2是本申请一个实施例的损失值与目标性评分关系的示意图;
图3是本申请另一个实施例的损失值与目标性评分关系的示意图;
图4是本申请一个实施例的对象检测模型训练装置的示意图;
图5是本申请又一个实施例的对象检测模型训练方法的流程图;
图6是本申请一个实施例的计算机设备的示意图。
附图标记列表:
100:对象检测模型训练方法  400:对象检测模型训练装置   600:电子设备
500:对象检测模型训练方法  401:输入模块               402:计算模块
403:更新模块              602:处理器                 604:通信接口
606:存储器                608:通信总线               610:程序
101:获得对象检测模型针对样本图像中待检测对象输出的目标性评分
102:若待检测对象为负样本,根据目标性评分和当前迭代次数,确定损失值
103:根据损失值对对象检测模型进行更新迭代
501:获得对象检测模型针对样本图像中待检测对象输出的目标性评分
502:若待检测对象为负样本,根据目标性评分和当前迭代次数,确定损失值
503:根据损失值对对象检测模型进行更新迭代
具体实施方式
如前所述,在基于图形用户界面对软件进行测试时,将图形用户界面输入到对象检测模型中,对象检测模型检测图形用户界面中的图标,进而可以根据检测出的图标确定软件是否正常。软件的图形用户界面会定期更新,更新后的图形用户界面会出现新的图标,需要更新对象检测模型,以使对象检测模型能够检测新出现的图标。在更新对象检测模型时,需要对样本图像中的图标进行标注,然而由于图标的数量较多,在对图标进行标注时会出现遗漏的情况,而在更新对象检测模型时未标注的图标将作为负样本,通过更新完成的对象检测模型进行图标检测时,即使标注时被遗漏的图标出现在输入图像,对象检测模型也不会将其确定为图标,进而导致对象检测模型对目标对象进行检测的准确性较低。
在本申请实施例中,将样本图像输入对象检测模型后,获取对象检测模型对样本图像中 待检测对象的目标性评分,如果样本图像中该待检测对象被标注为负样本,则根据该待检测对象对应的目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值,进而根据确定出的损失值对对象检测模型进行更新。在根据目标性评分和当前迭代次数确定损失值时,对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小。如果待检测对象属于目标对象而被误标注为负样本,则该待检测对象对应较大的目标性评分,进而对象检测模型针对该待检测对象的损失值较小,在基于该待检测对象对应的损失值更新对象检测模型后,对象检测模型会将该待检测对象确定为目标对象,进而可以提高对目标对象进行检测的准确性。
下面结合附图对本申请实施例提供的对象检测模型训练方法、装置、计算机设备和存储介质进行详细说明。
对象检测模型训练方法
图1是本申请一个实施例的对象检测模型训练方法的流程图。如图1所示,对象检测模型训练方法100包括如下步骤:
步骤101、将样本图像输入待训练的对象检测模型,获得对象检测模型针对样本图像中待检测对象输出的目标性评分。
待训练的对象检测模型用于检测输入图像中的目标对象。对象检测模型的输入图像中可以包括一个或多个待检测对象,对象检测模型可以分别检测每个待检测对象是否为目标对象。针对输入图像中的每个待检测对象,对象检测模型可以输出针对该待检测对象的置信度,置信度的取值范围为[0,1],说明待检测对象为目标对象的概率越高,进而可以确定置信度大于置信度阈值的待检测对象为目标对象,而置信度小于或等于置信度阈值的待检测对象不是目标对象。
将样本图像输入对象检测模型后,在对象检测模型检测样本图像中目标对象的过程中,针对样本图像中的每个待检测对象,对象检测模型可以获得该待检测对象的目标性评分(Objectness Score),目标性评分可以指示待检测对象为目标对象的概率,而且目标性评分可以与待检测对象为目标对象的概率正相关,即目标性评分越高,则待检测对象为目标对象的概率越高。
步骤102、若待检测对象为负样本,则根据目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值。
如果待检测对象为负样本,即在样本图像中该待检测对象被标注为不是目标对象,则根据该待检测对象的目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值。其中,随着对象检测模型的迭代次数的增加,对象检测模型针对负样本的损失值的变化取值 为随目标性评分的增大而先增大后减小。
对象检测模型的损失值用于指示对象检测模型的预测值与真实值的不一样程度,由于对象检测模型用于检测待检测对象是否为目标对象,所以损失值指示对象检测模型对待检测对象是否为目标对象的预测结果,与待检测对象实际是否为目标对象的差异。损失值的取值范围为[0,1],损失值越大,对象检测模型的预测值与真实值的差异越大,对象检测模型的预测准确性越差,因此训练对象检测模型的目标是使损失值最小化。
针对负样本,对象检测模型的损失值与负样本的目标性评分相关,而且随着迭代次数的增加,损失值与目标性评分的相关性会发生变化。图2和图3是本申请一个实施例的损失值与目标性评分关系的示意图,其中,图2和图3对针对负样本,图2对应于迭代次数较小时损失值与目标性评分关系的示意图,图3对应于训练完成(迭代次数较大)时损失值与目标性评分关系的示意图。在图2和图3中,横坐标y表征目标性评分,纵坐标L 1表征损失值。
如图2所示,在迭代次数较少时,损失值与目标性评分呈正相关,当目标性评分较大时,表征对象检测模型判定待检测对象是目标对象,但待检测对象被标注为负样本,即对象检测模型的检测结果与实际情况不符,所以对应较大的损失值,以对模型参数调整产生较大影响,使得对象检测模型能够正确检测出目标对象。
对于目标性评分较大且为负样本的待检测对象,该待检测对象可能被误标注为负样本,所以随着迭代次数的增加,损失值与目标性评分的相关性逐步变成损失值随目标性评分的增大而先增大后减小,在对象检测模型训练完成后,损失值与目标性评分的关系如图3所示。
如图3所示,在对象检测模型训练完成后,损失值随目标性评分的增大而先增大后减小,较小和较大的目标性评分均对应较小的损失值。较小的目标性评分,表征对象检测模型判定待检测对象不是目标对象,而待检测对象本身也被标注为负样本,所以对象检测模型的检测结果与实际情况相符,所以对应较小的损失值,以对模型参数调整产生较小影响。较大的目标性评分,表征对象检测模型判定待检测对象是目标对象,但待检测对象本身被标注为负样本,所以对象检测模型的检测结果与实际情况不符,但该待检测对象可能是被误标注为负样本,所以对应较小的损失值,以对模型参数调整产生较小影响,使得对象检测模型能够检测出被误标注为负样本的目标对象。
对于适中的目标性评分,比如取值范围为[0.5,0.8]的目标性评分,对象检测模型判定待检测对象是目标对象的可能性相对较大,但待检测对象本身被标注为负样本,这部分待检测对象通常不是目标对象,所以对一个较大的损失值,以对模型参数调整产生较大影响,使得对象检测模型不将这部分待检测对象判定为目标对象。
应理解,在对样本图像中的待检测对象进行标注,由于样本图像中目标对象的数量通常 少于非目标对象的数量,即前景少于背景,所以仅需要将样本图像中的目标对象标注出来,而样本图像中未被标注的部分均是非目标对象。
步骤103、根据损失值对对象检测模型进行更新迭代。
每次将样本图像输入对象检测模型,并获得对象检测模型的损失值后,基于获得的损失值对对象检测模型进行迭代更新,直至对象检测模型的迭代更新次数达到预设次数,或者对象检测模型的损失值小于预设值,完成对象检测模型的训练。
在本申请实施例中,训练对象检测模型的过程中,针对被标准为负样本的待检测对象,根据该待检测对象对应的目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值,进而根据确定出的损失值对对象检测模型进行更新。由于对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小,随着迭代次数的增加,被误标注为负样本的待检测对象的损失值会减小,从而对对象检测模型的贡献度减小,对象检测模型受到被误标注为负样本的待检测对象的影响较小,从而完成训练的对象检测模型能够检测到被误标注为负样本的目标对象,从而可以提高对目标对象进行检测的准确性。
在一种可能的实现方式中,在根据目标性评分和对象检测模型的当前迭代次数确定损失值时,可以根据目标性评分和当前迭代次数,分别确定第一计算项和第二计算项,进而根据第一计算项和第二计算项的乘积,确定对象检测模型的损失值。其中,第一计算项与目标性评分和当前迭代次数均正相关,第二计算项与目标性评分和当前迭代次数均负相关。
对象检测模型的损失值根据第一计算项和第二计算项的乘积确定,而第一计算项与目标性评分和当前迭代次数均正相关,第二计算项与目标性评分和当前迭代次数均负相关。迭代次数较小时第一计算项对损失值起主导作用,迭代次数较大时第二计算项对损失值起主导作用。目标性评分较小时第一计算项对损失值起主导作用,目标性评分较大时第二计算项对损失值起主导作用。
在本申请实施例中,第一计算项与目标性评分和当前迭代次数均正相关,第二计算项与目标性评分和当前迭代次数均负相关,根据第一计算项和第二计算项的乘积确定对象检测模型的损失值,使得随着迭代次数的增加,对象检测模型针对负样本的损失值的变化趋势为随目标评分的增大而先增大后减小,从而具有较大和较小目标性评分的负样本均对应较小的损失值,而具有大小适中的目标性评分的负样本对应较大的损失值,随着训练的进行,逐渐减小被误标注为负样本的待检测对象对对象检测模型的贡献度,保证训练完成的对象检测模型能够检测到被误标注为负样本的目标样本。而具有较小目标性评分的负样本一直对对象检测模型的贡献度较小,具有大小适中的目标性评分的负样本对对象检测模型的贡献度较大,保证训练完成的对象检测模型能够准确检测被正确标注的目标样本。
在一种可能的实现方式中,在根据第一计算项和第二计算项的乘积确定对象检测模型的损失值时,可以根据第一计算项和第二计算项的乘积,通过如下公式(1)计算对象检测模型针对负样本的损失值。
L 1=-y γ(1-α)(1-y) γαlog(1-y)#(1)
L 1用于表征待检测对象为负样本时,对象检测模型针对待检测对象的损失值;y γ(1-α)用于表征第一计算项;(1-y) γα用于表征第二计算项;y用于表征待检测对象对应的目标性评分,0≤y≤1;α用于表征当前迭代次数与总迭代次数的比值,0<α≤1;γ用于表征根据正样本数量与负样本数量的比值确定的常数。
在上述公式(1)中,γ为根据正样本数量与负样本数量的比值确定的常数,0<γ<1,当样本图像中正样本数量与负样本数量的比值较大时,γ取较大值,当样本图像中正样本数量与负样本数量的比值较小时,γ取较小时。在检测图形用户界面中图标时,图标为正样本,除图标之外的背景、文字等均为负样本,因此正样本数量与负样本数量的比值较小,所以γ的取值小于0.5,比如γ可以取值0.2、0.3等。
在本申请实施例中,在待检测对象为负样本时,根据目标性评分和当前迭代次数,通过上述公式(1)计算对象检测模型的损失值,随着迭代次数的增加,较大目标性评分的负样本会对应较小的损失值,而具有较大目标性评分的负样本是被误标注为负样本的目标对象,即随着训练的进行,被误标注为负样本的目标对象对模型训练的贡献度减小,对象检测模型受到被误标注为负样本的目标对象的影响会更小,也就是说不再向对象检测模型强调被误标注为负样本的目标对象是负样本,从而训练完成后的对象检测模型能够检测到输入图像中被误标注为负样本的目标对象,提高了对象检测模型对目标对象进行检测的准确性。
在一种可能的实现方式中,在获取到对象检测模型针对待检测对象输出的目标性评分后,如果待检测对象为正样本,则根据目标性评分确定该对象检测模型的损失值。其中,对象检测模型针对正样本的损失值与目标性评分负相关。
正样本属于目标对象,如果一个正样本对应的目标性评分较小,说明对象检测模型不能正确检测到该正样本,所以需要对应较大的损失值,以对模型训练产生较大的贡献度。如果一个正样本对应的目标性评分较大,说明对象检测模型能够正确检测到该正样本,所以需要对应较小的损失值,以对模型训练产生较小的贡献度。
在本申请实施例中,正样本的目标性评分较小说明对象检测模型不能正确检测到该正样本,而正样本的目标性评分较大说明对象检测模型能够正确检测到该正样本,对象检测模型不能正确检测到正样本时应产生较大的损失值,以对模型训练产生较大贡献度,对象检测模 型能够正确检测到正样本时应产生较小的损失值,以对模型训练产生较小贡献度,所以对象检测模型针对正样本的损失值与目标性评分负相关,基于此可以根据目标性评分确定对象检测模型针对正样本的损失值,保证通过正样本更新对象检测模型的准确性。
在一种可能的实现方式中,在根据目标性评分确定对象检测模型针对正样本的损失值时,可以根据目标性评分,通过如下公式(2)计算对象检测模型针对正样本的损失值。
L 2=-(1-y) γlogy#(2)
L 2用于表征待检测对象为正样本时,对象检测模型针对待检测对象的损失值;y用于表征待检测对象对应的目标性评分,0≤y≤1;γ用于表征根据正样本数量与负样本数量的比值确定的常数。
在上述公式(2)中,γ为根据正样本数量与负样本数量的比值确定的常数,0<γ<1,当样本图像中正样本数量与负样本数量的比值较大时,γ取较大值,当样本图像中正样本数量与负样本数量的比值较小时,γ取较小时。在检测图形用户界面中图标时,图标为正样本,除图标之外的背景、文字等均为负样本,因此正样本数量与负样本数量的比值较小,所以γ的取值小于0.5,比如γ可以取值0.2、0.3等。
在本申请实施例中,在待检测对象为正样本时,根据目标性评分,通过上述公式(2)计算对象检测模型的损失值,较大的目标性评分对应较大损失值,对模型训练产生较大贡献度,较小的目标性评分对应较大的损失值,对模型训练产生较小贡献度,保证通过正样本对对象检测模型进行更新的准确性,进而保证更新后的对象检测模型能够正确检测输入图像中的正样本。
在一种可能的实现方式中,在根据损失值对对象检测模型进行迭代更新时,可以根据损失值,通过反向传播算法确定对象检测模型的梯度,进而根据梯度对对象检测模型进行迭代更新。
在本申请实施例中,在确定对象检测模型的损失值后,利用反向传播(BackPropagation,BP)算法计算对象检测模型的梯度,反向传播算法可以基于对象检测模型的损失,确定对象检测模型的梯度,进而可以对象检测模型的梯度迭代更新对象检测模型,保证根据损失值对对象检测模型进行训练的准确性,进而保证训练完成的对象检测模型能够准确对输入图像中的目标对象进行检测。
对象检测模型训练装置
图4是本申请一个实施例的对象检测模型训练装置的示意图。如图4所示,该对象检测模型训练装置400包括:
输入模块401,用于将样本图像输入待训练的对象检测模型,获得对象检测模型针对样 本图像中待检测对象输出的目标性评分,其中,对象检测模型用于检测输入图像中的目标对象,目标性评分与待检测对象为目标对象的概率正相关;
计算模块402,用于在待检测对象为负样本时,根据目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值,其中,随迭代次数的增加,对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小;
更新模块403,用于根据损失值对对象检测模型进行迭代更新。
在本申请实施例中,输入模块401可用于执行上述方法实施例中的步骤101,计算模块402可用于执行上述方法实施例中的步骤102,更新模块403可用于执行上述方法实施例中的步骤103。
在一种可能的实现方式中,计算模块402可以根据目标性评分和当前迭代次数,分别确定第一计算项和第二计算项,并根据第一计算项和第二计算项的乘积,确定对象检测模型的损失值。其中,第一计算项与目标性评分和当前迭代次数均正相关,第二计算项与目标性评分和当前迭代次数均负相关。
在一种可能的实现方式中,计算模块402可以根据第一计算项和第二计算项的乘积,通过如下第一公式计算对象检测模型的损失值;第一公式包括:L 1=-y γ(1-α)(1-y) γαlog(1-y);L 1用于表征待检测对象为负样本时,对象检测模型针对待检测对象的损失值;y γ(1-α)用于表征第一计算项;(1-y) γα用于表征第二计算项;y用于表征待检测对象对应的目标性评分,0≤y≤1;α用于表征当前迭代次数与总迭代次数的比值,0<α≤1;γ用于表征根据正样本数量与负样本数量的比值确定的常数。
在一种可能的实现方式中,计算模块402还可以在待检测对象为正样本时,根据目标性评分,确定对象检测模型的损失值,其中,对象检测模型针对正样本的损失值与目标性评分负相关。
在一种可能的实现方式中,计算模块402可以根据目标性评分,通过如下第二公式计算对象检测模型的损失值;第二公式包括:L 2=-(1-y) γlogy;L 2用于表征待检测对象为正样本时,对象检测模型针对待检测对象的损失值;y用于表征待检测对象对应的目标性评分,0≤y≤1;γ用于表征根据正样本数量与负样本数量的比值确定的常数。
在一种可能的实现方式中,更新模块403可以根据损失值,通过反向传播算法确定对象检测模型的梯度,并根据梯度对对象检测模型进行迭代更新。
需要说明的是,上述对象检测模型训练装置内的各模块之间的信息交互、执行过程等内容,由于与前对象检测模型训练方法实施例基于同一构思,具体内容可参见前述对象检测模 型训练方法实施例中的叙述,此处不再赘述。
本申请实施例的应用场景
下面给出上述实施例所提供对象检测模型训练方法的其中一个具体应用场景,在该应用场景下对象检测模型用于检测图形用户界面(Graphical User Interface,GUI)中的图标,即图形用户界面中的目标为目标对象,图形用户界面由相应的软件程序生成,将图像用户界面输入对象检测模型后,对象检测模型检测图形用户界面中的图标,进而可以根据检测到的图标数量确定软件程序运行是否正常。
图5是本申请一个实施例的对象检测模型训练方法的示意图。如图5所示,该对象检测模型训练方法包括如下步骤:
步骤501、将包括图形用户界面的样本图像输入待训练的对象检测模型,获得对象检测模型针对图形用户界面中待检测对象输出的目标性评分。
样本图像包括图形用户界面,图形用户界面由待测试软件程序生成,图形用户界面可以包括一个或多个图标,图形为待训练的对象检测模型所要检测的目标对象。样本图像可以是图形用户界面的截图。
将样本图像输入待训练的对象检测模型后,可以获得对象检测模型针对样本图像中待检测对象输出的目标性评分,目标性评分与待检测对象为图标的概率正相关。待检测对象可以是图形用户界面中的图标,也可以是图形用户界面中的文字、空白区域等。
步骤502、若待检测对象为负样本,则根据目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值。
在获取样本图像中的过程中,需要对样本图像中的图标进行标注,比如通过矩形标注框将样本图像中的图标标注出来。样本图像中位于标注框内的部分图像为正样本,而位于标注框外的图像均为负样本。一个样本图像可以包括多个正样本和多个负样本。但是,在对样本图像中的图标进行标注时,软件程序更新所产生的新图标未被标注为正样本,进而该未被标注的图标会被对象检测模型认为是负样本。
如果待检测对象是负样本,则根据该待检测对象的目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值。其中,随迭代次数的增加,对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小。
步骤503、根据损失值对对象检测模型进行迭代更新。
每次将样本图像输入对象检测模型,并获得对象检测模型的损失值后,基于获得的损失值对对象检测模型进行迭代更新,直至对象检测模型的迭代更新次数达到预设次数,或者对象检测模型的损失值小于预设值,完成对象检测模型的训练。
在本申请实施例中,训练对象检测模型的过程中,针对被标准为负样本的待检测对象,根据该待检测对象对应的目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值,进而根据确定出的损失值对对象检测模型进行更新。由于对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小,随着迭代次数的增加,被误标注为负样本的图标的损失值会减小,从而对对象检测模型的贡献度减小,对象检测模型受到被误标注为负样本的图标的影响较小,从而完成训练的对象检测模型能够检测到被误标注为负样本的图标,从而可以提高对图形用户界面中图标进行检测的准确性,进而保证基于图标检测对软件程序进行测试的准确性。
需要说明的是,图5所示的实施例,为本申请实施例中对象检测模型训练方案的具体应用,具体的对象检测模型训练过程可参见前述实施例中的描述,在此不再进行赘述。
计算机设备
图6是本申请一个实施例的计算机设备的示意图,本申请具体实施例并不对计算机设备的具体实现做限定。参见图6,本申请实施例提供的计算机设备600包括:处理器602、通信接口604、存储器606、以及通信总线608。其中:
处理器602、通信接口604、以及存储器606通过通信总线608完成通信。
通信接口604,用于与其它计算机设备或服务器进行通信。
处理器602,用于执行程序610,具体可以执行前述任一对象检测模型训练方法实施例中的相关步骤。
具体地,程序610可以包括程序代码,该程序代码包括计算机操作指令。
处理器602可以是中央处理器CPU,或者是特定集成电路ASIC(Application Specific Integrated Circuit),或者是被配置成实施本申请实施例的一个或多个集成电路。智能设备包括的一个或多个处理器,可以是同一类型的处理器,如一个或多个CPU;也可以是不同类型的处理器,如一个或多个CPU以及一个或多个ASIC。
存储器606,用于存储程序610。存储器606可以包含高速RAM存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器。
程序610具体可以用于使得处理器602执行前述任一实施例中的对象检测模型训练方法。
程序610中各步骤的具体实现可以参见前述任一对象检测模型训练方法实施例中的相应步骤和单元中对应的描述,在此不赘述。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的设备和模块的具体工作过程,可以参考前述方法实施例中的对应过程描述,在此不再赘述。
通过本申请实施例的计算机设备,训练对象检测模型的过程中,针对被标准为负样本的 待检测对象,根据该待检测对象对应的目标性评分和对象检测模型的当前迭代次数,确定对象检测模型的损失值,进而根据确定出的损失值对对象检测模型进行更新。由于对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小,随着迭代次数的增加,被误标注为负样本的待检测对象的损失值会减小,从而对对象检测模型的贡献度减小,对象检测模型受到被误标注为负样本的待检测对象的影响较小,从而完成训练的对象检测模型能够检测到被误标注为负样本的目标对象,从而可以提高对目标对象进行检测的准确性。
计算机可读存储介质
本申请还提供了一种计算机可读存储介质,存储用于使一机器执行如本文所述的对象检测模型训练方法的指令。具体地,可以提供配有存储介质的系统或者装置,在该存储介质上存储着实现上述实施例中任一实施例的功能的软件程序代码,且使该系统或者装置的计算机(或CPU或MPU)读出并执行存储在存储介质中的程序代码。
在这种情况下,从存储介质读取的程序代码本身可实现上述实施例中任何一项实施例的功能,因此程序代码和存储程序代码的存储介质构成了本申请的一部分。
用于提供程序代码的存储介质实施例包括软盘、硬盘、磁光盘、光盘(如CD-ROM、CD-R、CD-RW、DVD-ROM、DVD-RAM、DVD-RW、DVD+RW)、磁带、非易失性存储卡和ROM。可选择地,可以由通信网络从服务器计算机上下载程序代码。
此外,应该清楚的是,不仅可以通过执行计算机所读出的程序代码,而且可以通过基于程序代码的指令使计算机上操作的操作系统等来完成部分或者全部的实际操作,从而实现上述实施例中任意一项实施例的功能。
此外,可以理解的是,将由存储介质读出的程序代码写到插入计算机内的扩展板中所设置的存储器中或者写到与计算机相连接的扩展模块中设置的存储器中,随后基于程序代码的指令使安装在扩展板或者扩展模块上的CPU等来执行部分和全部实际操作,从而实现上述实施例中任一实施例的功能。
计算机程序产品
本申请实施例还提供了一种计算机程序产品,所述计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行上述各实施例提供的对象检测模型训练方法。应理解,本实施例中的各方案具有上述方法实施例中对应的技术效果,此处不再赘述。
需要说明的是,上述各流程和各系统结构图中不是所有的步骤和模块都是必须的,可以根据实际的需要忽略某些步骤或模块。各步骤的执行顺序不是固定的,可以根据需要进行调整。上述各实施例中描述的系统结构可以是物理结构,也可以是逻辑结构,即,有些模块可 能由同一物理实体实现,或者,有些模块可能分由多个物理实体实现,或者,可以由多个独立设备中的某些部件共同实现。
以上各实施例中,硬件模块可以通过机械方式或电气方式实现。例如,一个硬件模块可以包括永久性专用的电路或逻辑(如专门的处理器,FPGA或ASIC)来完成相应操作。硬件模块还可以包括可编程逻辑或电路(如通用处理器或其它可编程处理器),可以由软件进行临时的设置以完成相应操作。具体的实现方式(机械方式、或专用的永久性电路、或者临时设置的电路)可以基于成本和时间上的考虑来确定。
上文通过附图和优选实施例对本申请进行了详细展示和说明,然而本申请不限于这些已揭示的实施例,基与上述多个实施例本领域技术人员可以知晓,可以组合上述不同实施例中的代码审核手段得到本申请更多的实施例,这些实施例也在本申请的保护范围之内。

Claims (11)

  1. 一种对象检测模型训练方法(100),包括:
    将样本图像输入待训练的对象检测模型,获得所述对象检测模型针对所述样本图像中待检测对象输出的目标性评分,其中,所述对象检测模型用于检测输入图像中的目标对象,所述目标性评分与所述待检测对象为所述目标对象的概率正相关;
    若所述待检测对象为负样本,则根据所述目标性评分和所述对象检测模型的当前迭代次数,确定所述对象检测模型的损失值,其中,随迭代次数的增加,所述对象检测模型针对负样本的损失值的变化趋势为随所述目标性评分的增大而先增大后减小;
    根据所述损失值对所述对象检测模型进行迭代更新。
  2. 根据权利要求1所述的方法,其中,所述根据所述目标性评分和所述对象检测模型的当前迭代次数,确定所述对象检测模型的损失值,包括:
    根据所述目标性评分和所述当前迭代次数,分别确定第一计算项和第二计算项,其中,所述第一计算项与所述目标性评分和所述当前迭代次数均正相关,所述第二计算项与所述目标性评分和所述当前迭代次数均负相关;
    根据所述第一计算项和所述第二计算项的乘积,确定所述对象检测模型的损失值。
  3. 根据权利要求2所述的方法,其中,所述根据所述第一计算项和所述第二计算项的乘积,确定所述对象检测模型的损失值,包括:
    根据所述第一计算项和所述第二计算项的乘积,通过如下第一公式计算所述对象检测模型的损失值;
    所述第一公式包括:
    L 1=-y γ(1-α)(1-y) γαlog(1-y)
    L 1用于表征所述待检测对象为负样本时,所述对象检测模型针对所述待检测对象的损失值;y γ(1-α)用于表征所述第一计算项;(1-y) γα用于表征所述第二计算项;y用于表征所述待检测对象对应的目标性评分,0≤y≤1;α用于表征所述当前迭代次数与总迭代次数的比值,0<α≤1;γ用于表征根据正样本数量与负样本数量的比值确定的常数。
  4. 根据权利要求1所述的方法,其中,所述方法还包括:若所述待检测对象为正样本,则根据所述目标性评分,确定所述对象检测模型的损失值,其中,所述对象检测模型针对正样本的损失值与所述目标性评分负相关。
  5. 根据权利要求4所述的方法,其中,所述根据所述目标性评分确定所述对象检测模型的损失值,包括:
    根据所述目标性评分,通过如下第二公式计算所述对象检测模型的损失值;
    所述第二公式包括:
    L 2=-(1-y) γlogy
    L 2用于表征所述待检测对象为正样本时,所述对象检测模型针对所述待检测对象的损失值;y用于表征所述待检测对象对应的目标性评分,0≤y≤1;γ用于表征根据正样本数量与负样本数量的比值确定的常数。
  6. 根据权利要求1-5中任一所述的方法,其中,所述根据所述损失值对所述对象检测模型进行迭代更新,包括:
    根据所述损失值,通过反向传播算法确定所述对象检测模型的梯度;
    根据所述梯度对所述对象检测模型进行迭代更新。
  7. 一种对象检测模型训练装置(400),包括:
    输入模块(401),用于将样本图像输入待训练的对象检测模型,获得所述对象检测模型针对所述样本图像中待检测对象输出的目标性评分,其中,所述对象检测模型用于检测输入图像中的目标对象,所述目标性评分与所述待检测对象为所述目标对象的概率正相关;
    计算模块(402),用于在所述待检测对象为负样本时,根据所述目标性评分和所述对象检测模型的当前迭代次数,确定所述对象检测模型的损失值,其中,随迭代次数的增加,所述对象检测模型针对负样本的损失值的变化趋势为随所述目标性评分的增大而先增大后减小;
    更新模块(403),用于根据所述损失值对所述对象检测模型进行迭代更新。
  8. 一种对象检测模型训练方法(500),所述对象检测模型用于检测图形用户界面中的图标,所述方法包括:
    将包括图形用户界面的样本图像输入待训练的对象检测模型,获得所述对象检测模型针对所述图形用户界面中待检测对象输出的目标性评分,其中,所述目标性评分与所述待检测对象为图标的概率正相关;
    若所述待检测对象为负样本,则根据所述目标性评分和所述对象检测模型的当前迭代次数,确定所述对象检测模型的损失值,其中,随迭代次数的增加,所述对象检测模型针对负样本的损失值的变化趋势为随目标性评分的增大而先增大后减小;
    根据所述损失值对所述对象检测模型进行迭代更新。
  9. 一种计算机设备(600),包括:处理器(602)、通信接口(604)、存储器(606)和通信总线(608),所述处理器(602)、所述存储器(606)和所述通信接口(604)通过所述通信总线(608)完成相互间的通信;
    所述存储器(606)用于存放至少一可执行指令,所述可执行指令使所述处理器(602)执行如权利要求1-6及权利要求8中任一项所述的对象检测模型训练方法对应的操作。
  10. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机指令,所述计算机指令在被处理器执行时,使所述处理器执行权利要求1-6及权利要求8中任一项所述的对象检测模型训练方法。
  11. 一种计算机程序产品,所述计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行根据权利要求1-6及权利要求8中任一项所述的对象检测模型训练方法。
PCT/CN2022/097399 2022-06-07 2022-06-07 对象检测模型训练方法、装置、计算机设备和存储介质 WO2023236044A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/097399 WO2023236044A1 (zh) 2022-06-07 2022-06-07 对象检测模型训练方法、装置、计算机设备和存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/097399 WO2023236044A1 (zh) 2022-06-07 2022-06-07 对象检测模型训练方法、装置、计算机设备和存储介质

Publications (1)

Publication Number Publication Date
WO2023236044A1 true WO2023236044A1 (zh) 2023-12-14

Family

ID=89117409

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/097399 WO2023236044A1 (zh) 2022-06-07 2022-06-07 对象检测模型训练方法、装置、计算机设备和存储介质

Country Status (1)

Country Link
WO (1) WO2023236044A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182695A (zh) * 2017-12-29 2018-06-19 纳恩博(北京)科技有限公司 目标跟踪模型训练方法及装置、电子设备和存储介质
CN109886282A (zh) * 2019-02-26 2019-06-14 腾讯科技(深圳)有限公司 对象检测方法、装置、计算机可读存储介质和计算机设备
US20190354817A1 (en) * 2018-05-18 2019-11-21 Google Llc Learning Data Augmentation Strategies for Object Detection
CN112906823A (zh) * 2021-03-29 2021-06-04 苏州科达科技股份有限公司 目标对象识别模型训练方法、识别方法及识别装置
CN113065607A (zh) * 2021-04-20 2021-07-02 平安国际智慧城市科技股份有限公司 图像检测方法、装置、电子设备及介质
CN113627298A (zh) * 2021-07-30 2021-11-09 北京百度网讯科技有限公司 目标检测模型的训练方法及检测目标对象的方法、装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182695A (zh) * 2017-12-29 2018-06-19 纳恩博(北京)科技有限公司 目标跟踪模型训练方法及装置、电子设备和存储介质
US20190354817A1 (en) * 2018-05-18 2019-11-21 Google Llc Learning Data Augmentation Strategies for Object Detection
CN109886282A (zh) * 2019-02-26 2019-06-14 腾讯科技(深圳)有限公司 对象检测方法、装置、计算机可读存储介质和计算机设备
CN112906823A (zh) * 2021-03-29 2021-06-04 苏州科达科技股份有限公司 目标对象识别模型训练方法、识别方法及识别装置
CN113065607A (zh) * 2021-04-20 2021-07-02 平安国际智慧城市科技股份有限公司 图像检测方法、装置、电子设备及介质
CN113627298A (zh) * 2021-07-30 2021-11-09 北京百度网讯科技有限公司 目标检测模型的训练方法及检测目标对象的方法、装置

Similar Documents

Publication Publication Date Title
CN109784391B (zh) 基于多模型的样本标注方法及装置
CN110020592B (zh) 物体检测模型训练方法、装置、计算机设备及存储介质
CN111931731B (zh) 判题方法、装置、电子设备及存储介质
CN108090043B (zh) 基于人工智能的纠错举报处理方法、装置及可读介质
CN110969200B (zh) 基于一致性负样本的图像目标检测模型训练方法及装置
CN112380981A (zh) 人脸关键点的检测方法、装置、存储介质及电子设备
CN111931864B (zh) 基于顶点距离与交并比多重优化目标检测器的方法与系统
WO2021082920A1 (zh) 电子设备边框外观瑕疵检测方法及设备
US9886546B2 (en) Methods and apparatus to label radiology images
CN110570390B (zh) 一种图像检测方法及装置
US20220130139A1 (en) Image processing method and apparatus, electronic device and storage medium
JP2019159836A (ja) 学習プログラム、学習方法および学習装置
JP7422548B2 (ja) ラベルノイズ検出プログラム、ラベルノイズ検出方法及びラベルノイズ検出装置
CN115359308B (zh) 模型训练、难例识别方法、装置、设备、存储介质及程序
US8201117B2 (en) Method for scalable derivation of an implication-based reachable state set overapproximation
CN116492634B (zh) 基于图像视觉定位的立定跳远测试方法
WO2023236044A1 (zh) 对象检测模型训练方法、装置、计算机设备和存储介质
CN117370767A (zh) 基于大数据的用户信息评估方法及系统
CN117218408A (zh) 基于因果纠偏学习的开放世界目标检测方法及装置
WO2020234977A1 (ja) 情報処理装置、作成方法および作成プログラム
US20220392107A1 (en) Image processing apparatus, image processing method, image capturing apparatus, and non-transitory computer-readable storage medium
US10552173B2 (en) Methods and apparatus to configure parameters of a high-speed input-output interface
CN115205619A (zh) 检测模型的训练方法、检测方法、装置和存储介质
CN114708286A (zh) 基于伪标注动态更新的细胞实例分割方法和装置
US9483818B2 (en) Bleed-through detection method and bleed-through detection apparatus