Single-target detection model training method, single-target detection method, device, and medium

By adding a classification branch and dynamically assigning labels to a single-class object detection model, the problem of high false detection rate is solved, the model performance and training efficiency are improved, and the negative impact of manual costs and dataset expansion is reduced.

CN116740503BActive Publication Date: 2026-04-28GUANGZHOU YUNCONG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGZHOU YUNCONG INFORMATION TECH CO LTD
Filing Date
2023-06-26
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing single-class object detection models are prone to false detections during training, and existing solutions suffer from high manual costs, large training dataset size, and long model iteration time, failing to fully utilize background information.

Method used

By adding a classification branch to the initial object detection model, dynamically assigning labels, and dynamically assigning classification labels based on the model's detection results during training, combined with dynamically generated negative samples, the false detection rate is reduced.

Benefits of technology

It effectively reduced the false detection rate of the model, improved model performance, reduced human and material costs, shortened model update time, and made full use of the background information in the training dataset.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116740503B_ABST
    Figure CN116740503B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of computer vision, and particularly provides a single-target detection model training method, a single-target detection method, equipment and a medium, aiming at solving the problem of high false detection rate of the existing single-class target detector. To this end, the single-target detection model training method comprises the following steps: obtaining a first training data set, training an initial target detection model based on the first training data set to obtain initial weight parameters, wherein the prediction module of the initial target detection model comprises a position branch and a confidence branch, adding a classification branch to the prediction module of the trained initial target detection model to obtain a single-target detection model, and training the single-target detection model based on the first training data set and the initial weight parameters. Through the above implementation, the original model is improved, and the classification branch is added to determine whether the detected object is a "target object" or a "non-target object", which can effectively reduce the false detection rate of the model and improve the performance of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, specifically to a single-object detection model training method, a single-object detection method, equipment, and medium. Background Technology

[0002] Object detection is one of the four fundamental tasks in computer vision, and it has mature applications in many fields. Typically, object detection tasks detect the location of objects and predict their corresponding categories; these tasks are called multi-class object detection. However, in real-world applications, sometimes it is only necessary to detect one specific type or class of objects, i.e., single-class object detection tasks.

[0003] Current object detection models are typically designed for detecting multiple object classes. In the commonly used object detection model YOLOv5, the detection task usually consists of three branches: a location branch, a confidence branch, and a classification branch. The location branch predicts the bounding box, the confidence branch indicates whether the predicted bounding box contains an object, and the classification branch indicates the category of the object within the bounding box. The final bounding box retained by the model is determined by both the confidence score and the category. However, in single-class object detection tasks, since there is no need to classify detected objects, the classification branch does not participate in model training. The final bounding box output by the model is determined solely by the confidence branch. This approach has a problem: during model training, supervised training is usually only performed on the confidence scores of positive samples. Negative samples, such as background samples, are not included in supervised training. Therefore, when making predictions, the model may assign high confidence values ​​to some negative background samples, leading to false positives.

[0004] The usual method to solve false detection is to add corresponding negative samples to the model for a specific false detection category and iterate again. However, this method has the following drawbacks: (1) Whenever a new false detection type appears, new training samples need to be collected and organized, which is labor-intensive; (2) The addition of more and more negative samples will cause the training dataset to expand continuously, and the model update iteration time will also be longer; (3) It is impossible to make full use of the background information in the training dataset.

[0005] Accordingly, a new technical solution is needed in this field to solve the above problems. Summary of the Invention

[0006] To overcome the above-mentioned shortcomings, this invention is proposed to provide a single-target detection model training method, single-target detection method, device and medium that solve or at least partially solve the technical problem of high false detection rate of existing single-class target detectors.

[0007] In a first aspect, a method for training a single-object detection model is provided, the method comprising:

[0008] Obtain the first training dataset;

[0009] The initial object detection model is trained based on the first training dataset to obtain initial weight parameters; the prediction module of the initial object detection model includes a location branch and a confidence branch.

[0010] The prediction module of the trained initial object detection model is given a classification branch to obtain the single object detection model.

[0011] The single-object detection model is trained based on the first training dataset and the initial weight parameters.

[0012] In one technical solution of the above-mentioned single-object detection model training method, training the single-object detection model based on the first training dataset and the initial weight parameters includes:

[0013] Input the first training dataset into the single-object detection model and load the initial weight parameters;

[0014] The loss function of the single-target detection model is obtained based on a dynamic allocation method;

[0015] Backpropagation is performed on the single-target detection model based on the loss function;

[0016] The training of the single-target detection model is completed when the single-target detection model converges to a first preset error or meets the first preset number of iterations.

[0017] In one technical solution of the above-mentioned single-object detection model training method, the first training dataset includes multiple samples and corresponding multiple labels, wherein the labels include the bounding box of the target object and its category; the loss function of the single-object detection model obtained based on dynamic allocation includes:

[0018] Obtain the detection result output by the single-target detection model;

[0019] Assign the labels to the location branch and the confidence branch, and dynamically assign the labels to the classification branch;

[0020] Based on the labels and the detection results, obtain the location loss function, confidence loss function, and classification loss function;

[0021] The loss function of the single-object detection model is obtained based on the location loss function, the confidence loss function, and the classification loss function.

[0022] In one technical solution of the above-mentioned single-object detection model training method, the label of dynamically assigning the classification branch includes:

[0023] Filter the anchor points in the detection results that meet the preset conditions;

[0024] Obtain the prediction box corresponding to the anchor point;

[0025] Obtain the intersection-union ratio (IUU) of the predicted bounding box and the labeled bounding box;

[0026] Determine whether the maximum crossover-union ratio among the crossover-union ratios is greater than a preset threshold;

[0027] If yes, then the anchor point is labeled as the target object; otherwise, the anchor point is labeled as a non-target object.

[0028] In one technical solution of the above-mentioned single-object detection model training method, after training the single-object detection model based on the first training dataset and the initial weight parameters, the method further includes:

[0029] Determine whether there are false detection types in the detection results output by the trained single-target detection model;

[0030] If so, then paste the false detection type onto the background of the first training dataset to obtain the second training dataset, and update the first training dataset with the second training dataset;

[0031] Repeat the process of training the single-object detection model based on the first training dataset and the initial weight parameters until no new false detection types appear in the detection results.

[0032] In one technical solution of the above-mentioned single-object detection model training method, training the initial object detection model based on the first training dataset includes:

[0033] Input the first training dataset into the initial object detection model;

[0034] Obtain the loss function of the initial target detection model;

[0035] Backpropagation is performed on the initial target detection model based on the loss function;

[0036] The initial target detection model training is completed when the initial target detection model converges to the second preset error or meets the second preset number of iterations.

[0037] In a second aspect, a single-target detection method is provided, the method comprising:

[0038] Obtain the sample to be tested;

[0039] The sample to be detected is input into the single-target detection model to obtain the detection result;

[0040] The single-target detection model is trained based on the single-target detection model training method according to any one of claims 1 to 6.

[0041] In one technical solution of the above-mentioned single-object detection method, the detection result includes the detection bounding box of the target object and the detection bounding box of non-target objects, and the method further includes:

[0042] Selectively retain the detection bounding boxes of the target object and / or the detection bounding boxes of the non-target object in the detection results.

[0043] In a third aspect, an electronic device is provided, comprising a processor and a storage device, the storage device being adapted to store a plurality of program codes, the program codes being adapted to be loaded and run by the processor to perform the single-object detection model training method described in any one of the above-described technical solutions of the single-object detection model training method or the single-object detection method described in any one of the above-described technical solutions of the single-object detection method.

[0044] In a third aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored therein, the program codes being adapted to be loaded and run by a processor to perform the single-object detection model training method described in any of the above-described technical solutions of the single-object detection model training method or the single-object detection method described in any of the above-described technical solutions of the single-object detection method.

[0045] The present invention comprises one or more of the following technical solutions:

[0046] Beneficial effects:

[0047] In implementing the technical solution of this invention, a first training dataset is first obtained. An initial detection model is then trained based on this dataset to obtain initial training model parameters. The prediction module of the initial detection model includes a location branch and a confidence branch. Then, a classification branch is added to the prediction module of the trained initial detection model to obtain a single-object detection model. Finally, the single-object detection model is trained based on the first training dataset and the initial training model parameters. Through this implementation method, improvements are made to the original model by adding a classification branch to determine whether the detected object is a "target object" or a "non-target object," effectively reducing the false detection rate and improving the model's performance.

[0048] Furthermore, this invention proposes a dynamic classification label allocation strategy, which can dynamically allocate classification labels based on the model's detection results during training. This allows the model to more effectively suppress false detections of negative background samples, further reducing the model's false detection rate. Moreover, this solution has weak correlation with application scenarios, strong versatility, and can be ported to various application scenarios. Attached Figure Description

[0049] The disclosure of this invention will become more readily understood with reference to the accompanying drawings. It will be readily understood by those skilled in the art that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. Wherein:

[0050] Figure 1 This is a schematic diagram of the main steps of a single-target detection model training method according to an embodiment of the present invention;

[0051] Figure 2 This is a schematic diagram of the main steps of training an initial object detection model based on a first training dataset according to an embodiment of the present invention;

[0052] Figure 3 This is a schematic diagram of the structure of a single-target detection model according to an embodiment of the present invention;

[0053] Figure 4 This is a schematic diagram of the main steps for training a single-object detection model based on a first training dataset and initial weight parameters according to an embodiment of the present invention.

[0054] Figure 5 This is a schematic diagram of the main steps of obtaining the loss function of a single-target detection model based on a dynamic allocation method according to an embodiment of the present invention;

[0055] Figure 6 This is a schematic diagram of the main steps of dynamically allocating labels for classification branches according to an embodiment of the present invention;

[0056] Figure 7 This is a schematic diagram of the main steps of a single-target detection model training method according to another embodiment of the present invention;

[0057] Figure 8 This is a schematic flowchart of the main steps of a single-target detection method according to an embodiment of the present invention;

[0058] Figure 9 This is a schematic diagram of the main structure of an electronic device according to an embodiment of the present invention.

[0059] List of reference numerals in the attached diagram:

[0060] 301: Input module; 302: Feature extraction module; 303: Feature fusion module; 304: Prediction module; 305: Output module; 901: Processor; 902: Storage device. Detailed Implementation

[0061] Some embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0062] In the description of this invention, "module" and "processor" can include hardware, software, or a combination of both. A module can include hardware circuitry, various suitable sensors, communication ports, memory, and may also include software components, such as program code, or a combination of software and hardware. A processor can be a central processing unit, microprocessor, image processor, digital signal processor, or any other suitable processor. The processor has data and / or signal processing capabilities. The processor can be implemented in software, in hardware, or a combination of both. Non-transitory computer-readable storage media includes any suitable medium capable of storing program code, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The terms "at least one A or B" or "at least one of A and B" have a similar meaning to "A and / or B" and can include only A, only B, or A and B. The singular terms "a" or "this" can also include plural forms.

[0063] Here we will first explain some of the terms involved in this invention.

[0064] Anchor point: In object detection tasks, the input image is processed by a backbone network to extract a feature map, and each pixel in this map is an anchor point.

[0065] Anchor box: In object detection tasks, the input image is processed by a backbone network to extract feature maps, and the pre-defined boxes on the feature maps are called anchor boxes.

[0066] Confidence score: This indicates the confidence level of the detection model in believing that the detection box contains a certain object. Its value is between 0 and 1.

[0067] Nonmaximum suppression: A method for eliminating overlapping prediction boxes on the same object based on the cross-union ratio of the prediction boxes.

[0068] As described in the background section, current object detection models are typically designed for detecting multiple object classes. In the commonly used object detection model YOLOv5, the detection task usually consists of three branches: a location branch, a confidence branch, and a classification branch. The location branch predicts the bounding box for the object, the confidence branch indicates whether the predicted bounding box contains an object, and the classification branch represents the category to which the object in the bounding box belongs. The final bounding box retained by the model is determined by both the confidence score and the category. However, in single-class object detection tasks, since there is no need to classify the detected object, the classification branch does not participate in model training. The final bounding box output by the model is determined solely by the confidence branch. This approach has a problem: during model training, supervised training is usually only performed on the confidence scores of positive samples. Negative samples, such as background samples, are not included in supervised training. Therefore, when making predictions, the model may assign high confidence values ​​to some negative background samples, leading to false detections.

[0069] The usual method to resolve false detections is to add corresponding negative samples to the model and iterate again for a specific false detection category. However, this approach has the following drawbacks:

[0070] (1) Whenever a new type of false detection occurs, new training samples need to be collected and organized, which is labor-intensive.

[0071] (2) The addition of more and more negative samples will cause the training dataset to expand continuously, and the model update iteration time will also become longer.

[0072] (3) It is impossible to make full use of the background information in the training dataset.

[0073] Therefore, to address the problem of high false detection rate in single-class target detectors, this invention provides a single-target detection model training method, a single-target detection method, equipment, and medium.

[0074] See appendix Figure 1 , Figure 1 This is a schematic flowchart illustrating the main steps of a single-object detection model training method according to an embodiment of the present invention. Figure 1 As shown, the single-target detection model training method in this embodiment of the invention mainly includes the following steps S101 to S104.

[0075] Step S101: Obtain the first training dataset

[0076] Step S102: Train the initial object detection model based on the first training dataset to obtain the initial weight parameters.

[0077] The prediction module of the initial target detection model includes a location branch and a confidence branch.

[0078] Step S103: Add a classification branch to the prediction module of the trained initial object detection model to obtain a single object detection model.

[0079] Step S104: Train the single-object detection model based on the first training dataset and the initial weight parameters.

[0080] Based on the methods described in steps S101 to S104 above, improvements are made to the original model by adding a classification branch to determine whether the detected object is a "target object" or a "non-target object," which can effectively reduce the false detection rate of the model and improve its performance.

[0081] The following provides a further explanation of steps S101 to S104.

[0082] In some implementations of step S101 above, existing object detection datasets can be collected and organized as the first training dataset as needed. The first training dataset includes multiple samples and corresponding labels, wherein the labels include the bounding box of the target object and its category.

[0083] In other implementations, data can be collected manually, such as collecting some image data as samples, or collecting video data, extracting frames from the video as samples, and then manually labeling the samples, labeling each sample with the target object's bounding box gt_boxes and the label of its category.

[0084] Among them, the annotation tool can be the open-source image annotation tool labelImg. labelImg is written in Python and uses the cross-platform C++ graphical user interface library Qt as its graphical interface. The labels annotated by labelImg can be used for tasks such as classification and object detection.

[0085] Furthermore, a first training dataset is composed of multiple samples and their corresponding labels, which is used for training subsequent models.

[0086] The multiple samples in the first training dataset should be stored in a specific format, and the corresponding labels should also be organized and stored in the same format, such as VOC, YOLO, CreateML, etc.

[0087] It should be noted that the examples above regarding obtaining the first training dataset, manually labeling the data, and the storage format are merely illustrative. In practical applications, those skilled in the art can make selections based on specific scenarios, and no limitations are imposed here.

[0088] The above is a further explanation of step S101. The following is a further explanation of step S102.

[0089] In some embodiments of step S102 above, see Appendix Figure 2 , Figure 2 This is a schematic diagram illustrating the main steps of training an initial object detection model based on a first training dataset according to an embodiment of the present invention. Figure 2 As shown, step S102 mainly includes the following steps S1021 to S1024.

[0090] Step S1021: Input the first training dataset into the initial object detection model.

[0091] In some implementations, before performing step S1021, the samples and labels in the first training dataset are first read. The labels include the bounding boxes of the target objects and their categories. Then, the samples are processed, such as by normalization and data augmentation. Finally, the first training dataset is input into the initial target detection model.

[0092] The initial object detection model can be a basic detection model, such as the YOLOv5 model. The initial object detection model includes a location branch reg_head and a confidence branch obj_head.

[0093] In this model, the location branch `reg_head` predicts the bounding box for the target object, while the confidence branch `obj_head` predicts whether the bounding box contains the target object. The final bounding box output by the model is determined solely by the confidence branch; therefore, the initial object detection model has the ability to detect "target objects" but lacks classification capabilities.

[0094] Step S1022: Obtain the loss function of the initial object detection model.

[0095] After inputting the first training dataset into the initial object detection model, the detection results of the model can be obtained, which include the target object detection boxes.

[0096] To obtain the loss function, labels for the position branch reg_head and the confidence branch obj_head can be assigned to each anchor point in the target object detection box based on the annotation information. The loss function between the label and the detection result is calculated, including the position loss function loss_reg and the confidence loss function loss_obj. Finally, loss_reg and loss_obj are summed according to their weights to obtain the loss function of the initial object detection model.

[0097] Step S1023: Perform backpropagation on the initial target detection model based on the loss function.

[0098] After obtaining the loss function, backpropagation can be used to pass the loss function to each layer of the initial object detection model, so that each layer adjusts its weights in reverse according to the loss function. Specifically, gradient descent can be used to update the weights of each layer in the direction of minimizing the loss.

[0099] Step S1024: When the initial target detection model converges to the second preset error or meets the second preset number of iterations, the initial target detection model training is completed.

[0100] In some implementations, a preset error (second preset error) can be set for the model. When the loss function of the initial object detection model converges to the preset error, the training of the model is completed.

[0101] In other implementations, a preset number of iterations (a second preset number of iterations) can be set for the model. When the number of iterations of the initial target detection model reaches the preset number of iterations, the training of the model is completed.

[0102] The second preset error and the second preset number of iterations can be set according to the actual application scenario, and are not limited here.

[0103] Furthermore, after completing the training of the initial object detection model, the weight parameters of the initial object detection model can be obtained.

[0104] The above is a further explanation of step S102. The following is a further explanation of step S103.

[0105] Since the initial object detection model only has the ability to detect "objects" but not the ability to classify them, we adjust its structure by adding a classification branch cls_head to the trained initial object detection model to obtain a single object detection model.

[0106] The classification branch cls_head is a binary classifier that can classify detected objects into two categories. If the detected object belongs to a specific category, it is classified as a "target object"; otherwise, it is classified as a "non-target object". By classifying each anchor point globally, the detection of "non-target objects" in the background can be reduced.

[0107] Further, see appendix. Figure 3 , Figure 3 This is a schematic diagram of the structure of a single-target detection model according to an embodiment of the present invention. Figure 3 As shown, the single-target detection model includes an input module (Input) 301, a feature extraction module (backbone) 302, a feature fusion module (neck) 303, a prediction module (head) 304, and an output module (Output) 305.

[0108] The input module 301 is used to perform preprocessing and data augmentation on the first training dataset.

[0109] The feature extraction module 302 can use common neural networks, such as ResNet and Darknet, to extract features from the first training dataset.

[0110] The feature fusion module 303 is used to fuse the positional information of the extracted low-level features and the semantic information of the high-level features, thereby improving the detection effect.

[0111] The prediction module 304 consists of three branches: the location branch reg_head, the confidence branch obj_head, and the classification branch cls_head.

[0112] The location branch reg_head is responsible for predicting the object's bounding box, the confidence branch obj_head is responsible for predicting whether each anchor point within the bounding box contains an object, and the classification branch cls_head is responsible for predicting the category to which the object within the bounding box belongs.

[0113] The output module 305 performs some post-processing on the output results of the three branches, such as non-maximum suppression, to obtain the final detection result.

[0114] Non-maximum suppression is a method that removes overlapping prediction boxes on the same object based on the intersection-union ratio of the prediction boxes. Specifically, it sorts all overlapping prediction boxes from high to low scores, retains the prediction box with the highest score, and removes the rest.

[0115] The above is a further explanation of step S103. The following is a further explanation of step S104.

[0116] In some embodiments of step S104 above, see Appendix Figure 4 , Figure 4 This is a schematic diagram illustrating the main steps of training a single-object detection model based on a first training dataset and initial weight parameters according to an embodiment of the present invention. Figure 4 As shown, step S104 mainly includes the following steps S1041 to S1044.

[0117] Step S1041: Input the first training dataset into the single-object detection model and load the initial weight parameters.

[0118] In some implementations, before performing step S1041, the samples and labels in the first training dataset are first read. The labels include the bounding boxes of the target objects and their categories. Then, the samples are processed, such as by normalization and data augmentation. Finally, the first training dataset is input into the single-object detection model.

[0119] Furthermore, the initial weight parameters are loaded to train the single-object detection model. These initial weight parameters are the weight parameters of the initial object detection model.

[0120] Step S1042: Obtain the loss function of the single-target detection model based on the dynamic allocation method.

[0121] In some implementations, see Appendix Figure 5 , Figure 5 This is a schematic diagram illustrating the main steps of obtaining the loss function of a single-target detection model based on a dynamic allocation method according to an embodiment of the present invention. Figure 5 As shown, it mainly includes the following steps S501 to S504.

[0122] Step S501: Obtain the detection results of the single-target detection model.

[0123] After inputting the first training dataset into the single-object detection model, the detection results output by the model can be obtained.

[0124] Step S502: Assign labels to the position branch reg_head and the confidence branch obj_head, and dynamically assign labels to the classification branch cls_head.

[0125] Specifically, labels for the location branch reg_head, the confidence branch obj_head, and the classification branch cls_head can be dynamically assigned to each anchor point in the detection box of the target object based on the annotation information.

[0126] See appendix Figure 6 , Figure 6 This is a schematic flowchart illustrating the main steps of dynamically assigning labels to classification branches according to an embodiment of the present invention. Figure 6 As shown, step S502 mainly includes the following steps S5021 to S5026.

[0127] Step S5021: Select anchor points that meet the preset conditions from the detection results.

[0128] The detection results include detection boxes for both the target object and non-target objects.

[0129] The prediction result cls of the classification branch cls_head is two-dimensional data. cls_0 represents the probability that the anchor point is classified as "target object" and cls_1 represents the probability that the anchor point is classified as "non-target object".

[0130] In some implementations, the preset condition can be set to the probability of the target object being greater than 0.4. Then, based on the classification result cls_0, all anchor points with a probability greater than 0.4 of being the "target object" can be selected.

[0131] Step S5022: Obtain the predicted bounding box p_boxes corresponding to the anchor point.

[0132] After selecting the anchor points, we calculate the predicted bounding boxes p_boxes corresponding to the selected anchor points. This step is calculated based on the prediction result reg of the position branch reg_head.

[0133] reg is four-dimensional data (x, y, w, h), where x and y are offsets relative to the center point of the predefined anchor, and w and h are scaling factors relative to the width and height of the anchor. Based on reg and the size of the predefined anchor, the predicted bounding box p_boxes corresponding to the selected anchor point can be calculated.

[0134] Step S5023: Obtain the intersection-union ratio of the predicted bounding box p_boxes and the labeled bounding box gt_boxes.

[0135] After obtaining the predicted bounding boxes p_boxes, the intersection-union ratio (IoUs) between each predicted bounding box p_box and all labeled bounding boxes gt_boxes can be calculated.

[0136] Step S5024: Determine whether the maximum crossover-union ratio (CUIR) is greater than a preset threshold.

[0137] After calculating the Intersection over Union (IoUs), the largest IoU is selected, and then it is determined whether the largest IoU of each predicted box is greater than a preset threshold, such as 0.4.

[0138] Further, if so, proceed to step S5025; otherwise, proceed to step S5026.

[0139] Step S5025: Assign the anchor point label to the target object.

[0140] If the maximum intersection-union ratio (IoU) is greater than 0.4, then the anchor point corresponding to the prediction box is set as a positive sample, and the label assigned to the anchor point is the target object.

[0141] Step S5026: Assign the anchor point label to a non-target object.

[0142] If the maximum intersection-union ratio (IoU) is not greater than 0.4, then the anchor point corresponding to the prediction box is set as a negative sample, and the label assigned to the anchor point is non-target object.

[0143] It should be noted that the above examples of preset conditions for selecting anchor points and preset thresholds for judging the maximum intersection-union ratio (IoU) are only illustrative. In practical applications, those skilled in the art can set them according to specific scenarios, and no limitations are imposed here.

[0144] The above is a further explanation of step S502.

[0145] Step S503: Obtain the location loss function loss_reg, confidence loss function loss_obj, and classification loss function loss_cls based on the labels and detection results.

[0146] After the labels are assigned, the location loss function loss_reg, the confidence loss function loss_obj, and the classification loss function loss_cls can be calculated based on the labels and the detection results.

[0147] Step S504: Obtain the loss function of the single-object detection model based on the location loss function loss_reg, the confidence loss function loss_obj, and the classification loss function loss_cls.

[0148] The loss function of a single-object detection model is obtained by summing the location loss function (loss_reg), confidence loss function (loss_obj), and classification loss function (loss_cls) according to their weights.

[0149] The above is a further explanation of step S1042.

[0150] Step S1043: Perform backpropagation on the single-target detection model based on the loss function.

[0151] After obtaining the loss function, backpropagation can be used to pass the loss function to each layer of the single-object detection model, so that each layer adjusts its weights in reverse according to the loss function. Specifically, gradient descent can be used to update the weights of each layer in the direction of minimizing the loss.

[0152] Step S1044: When the single-target detection model converges to the first preset error or meets the first preset number of iterations, the training of the single-target detection model is completed.

[0153] In some implementations, a preset error (first preset error) can be set for the model. When the loss function of the single-target detection model converges to the preset error, the training of the model is completed.

[0154] In other implementations, a preset number of iterations (first preset number of iterations) can be set for the model. When the number of iterations of the single-target detection model reaches the preset number of iterations, the training of the model is completed.

[0155] The first preset error and the first preset number of iterations can be the same as or different from the second preset error and the second preset number of iterations. In practical applications, those skilled in the art can set them according to specific scenarios, and no limitation is made here.

[0156] The above is a further explanation of step S104.

[0157] By implementing the above methods, the original model is improved by adding a classification branch to determine whether the detected object is a "target object" or a "non-target object", which can effectively reduce the false detection rate of the model and improve the model's performance.

[0158] Furthermore, this invention employs a dynamic classification label allocation strategy, which dynamically allocates classification labels based on the model's detection performance during training. This allows the model to more effectively suppress false detections of negative background samples, further reducing the model's false detection rate. Additionally, it automatically generates negative sample labels, saving significant manpower and resources and shortening the time required for sample collection and processing.

[0159] In some implementations, after training the single-object detection model, we also need to observe and analyze the detection results output by the model. If a certain type of object is frequently falsely detected, then the model needs to be updated in a targeted manner to solve this type of false detection problem.

[0160] Specifically, see the appendix. Figure 7 , Figure 7 This is a schematic diagram illustrating the main steps of a single-object detection model training method according to another embodiment of the present invention. Figure 7 As shown, it mainly includes the following steps S701 to S703.

[0161] Step S701: Determine whether there are false detection types in the detection results output by the trained single-target detection model.

[0162] Further, if so, proceed to step S702; otherwise, continue with step S701.

[0163] Step S702: Paste the false detection type onto the background of the first training dataset to obtain the second training dataset, and update the first training dataset with the second training dataset.

[0164] First, data samples of this type of false detection are collected. Then, these false detection samples are randomly pasted into the background of the first training dataset to obtain the second training dataset. Finally, the first training dataset is updated with the second training dataset.

[0165] In this case, the number of samples in the updated first training dataset is the same as that in the original first training dataset.

[0166] Step S703: Repeat the training of the single-object detection model based on the first training dataset and initial weight parameters until no new false detection types appear in the detection results.

[0167] Based on the method described in steps S701 to S703 above, when a new false detection type appears, the corresponding negative samples can be pasted into the background of the first training dataset to train the model and reduce false detections. This avoids the continuous extension of model iteration time caused by the continuous expansion of the training dataset, reduces the false detection rate of the model without adding additional negative training samples, and realizes rapid update and iteration of the detection model.

[0168] Furthermore, the present invention also provides a single-target detection method.

[0169] See appendix Figure 8 , Figure 8 This is a schematic flowchart illustrating the main steps of a single-target detection method according to an embodiment of the present invention. Figure 8 As shown, the single-target detection method in this embodiment of the invention mainly includes the following steps S801 to S802.

[0170] Step S801: Obtain the sample to be tested.

[0171] In some implementations, the sample to be detected can be a frame extracted from an image or video.

[0172] Step S802: Input the sample to be detected into the single-target detection model to obtain the detection result.

[0173] The single-object detection model is trained based on the single-object detection model training method described in the above embodiments.

[0174] In some implementations, sample preprocessing is also included before performing the single-target detection method described above.

[0175] Specifically, the frames extracted from the image or video to be detected can be normalized and the sample size adjusted to 640*640.

[0176] Furthermore, the sample to be detected is input into the trained single-object detection model for detection.

[0177] In some implementations, the detection results output by the single-target detection model can also be post-processed.

[0178] Specifically, non-maximum suppression can be used to remove duplicate detection boxes in the detection results. Then, the width, height, and position of the remaining detection boxes can be adjusted according to the sample scaling ratio in the preprocessing stage to obtain the final detection results.

[0179] The detection results include the detection bounding boxes of the target object and the detection bounding boxes of non-target objects.

[0180] In practical applications, the detection bounding boxes of target objects and / or non-target objects in the detection results can be selectively retained.

[0181] For example, only the detection bounding boxes of the target object are retained, while the detection bounding boxes of non-target objects are discarded.

[0182] Furthermore, the detection results also include information such as the label, confidence level, and location of the detection box, which will be displayed in the original image and saved.

[0183] This solution has weak correlation with application scenarios and strong versatility, and can be easily ported to various other single-target detection scenarios.

[0184] It should be noted that although the steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effects of the present invention, different steps do not necessarily have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders, and these variations are all within the scope of protection of the present invention.

[0185] Those skilled in the art will understand that all or part of the processes in the method of the above embodiment of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable storage medium can include any entity or device capable of carrying the computer program code, a medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0186] Furthermore, the present invention also provides an electronic device. (See appendix.) Figure 9 , Figure 9 This is a schematic diagram of the main structure of an electronic device according to an embodiment of the present invention. Figure 9As shown, the electronic device in this embodiment of the invention mainly includes a processor 901 and a storage device 902. The storage device 902 can be configured to store a program for executing the single-target detection model training method or the single-target detection method of the above-described method embodiments. The processor 901 can be configured to execute the program in the storage device 902, which includes, but is not limited to, a program for executing the single-target detection model training method or the single-target detection method of the above-described method embodiments. For ease of explanation, only the parts related to the embodiments of the present invention are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of the present invention.

[0187] In some possible embodiments of the present invention, the electronic device may include multiple processors 901 and multiple storage devices 902. The program executing the single-target detection model training method or single-target detection method of the above method embodiments can be divided into multiple subroutines. Each subroutine can be loaded and run by a processor 901 to execute different steps of the single-target detection model training method or single-target detection method of the above method embodiments. Specifically, each subroutine can be stored in different storage devices 902, and each processor 901 can be configured to execute programs in one or more storage devices 902 to jointly implement the single-target detection model training method or single-target detection method of the above method embodiments. That is, each processor 901 executes different steps of the single-target detection model training method or single-target detection method of the above method embodiments to jointly implement the single-target detection model training method or single-target detection method of the above method embodiments.

[0188] The aforementioned multiple processors 901 can be processors deployed on the same device. For example, the aforementioned electronic device can be a high-performance device composed of multiple processors, and the aforementioned multiple processors 901 can be processors configured on that high-performance device. Alternatively, the aforementioned multiple processors 901 can also be processors deployed on different devices. For example, the aforementioned electronic device can be a server cluster, and the aforementioned multiple processors 901 can be processors on different servers within the server cluster.

[0189] Furthermore, the present invention also provides a computer-readable storage medium. In one embodiment of the computer-readable storage medium according to the present invention, the computer-readable storage medium can be configured to store a program for executing the single-object detection model training method or the single-object detection method of the above-described method embodiments. This program can be loaded and run by a processor to implement the above-described single-object detection model training method or the single-object detection method. For ease of explanation, only the parts related to the embodiments of the present invention are shown; for specific technical details not disclosed, please refer to the method section of the embodiments of the present invention. The computer-readable storage medium can be a storage device comprising various electronic devices. Optionally, in the embodiments of the present invention, the computer-readable storage medium is a non-transitory computer-readable storage medium.

[0190] It should be noted that the user information (including but not limited to user device information, user personal information, object information corresponding to washing device usage data, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, washing device usage data, etc.) involved in the embodiments of this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0191] The data acquisition and collection actions involved in the embodiments of this disclosure are all performed after authorization by the user or object, or after full authorization by all parties.

[0192] The relevant user personal information that may be involved in the various embodiments of this application is processed in strict accordance with the requirements of laws and regulations, following the principles of legality, legitimacy, and necessity, based on the reasonable purpose of the business scenario, and includes personal information that users actively provide or that is generated as a result of using the product / service, as well as personal information obtained with user authorization.

[0193] The technical solution of the present invention has been described above with reference to one embodiment shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions resulting from such changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. A method for training a single-object detection model, characterized in that, Applied to single-target detection, the method includes: Obtain a first training dataset, which includes multiple samples and corresponding labels. The labels include bounding boxes of target objects and their categories. The samples are frames extracted from images or videos. The initial object detection model is trained based on the first training dataset to obtain initial weight parameters; the prediction module of the initial object detection model includes a location branch and a confidence branch. The prediction module of the trained initial object detection model is given a classification branch to obtain the single object detection model. The single-object detection model is trained based on the first training dataset and the initial weight parameters, so as to use the trained single-object detection model to perform single-object detection on frames extracted from images or videos.

2. The single-target detection model training method according to claim 1, characterized in that, The step of training the single-object detection model based on the first training dataset and the initial weight parameters includes: Input the first training dataset into the single-object detection model and load the initial weight parameters; The loss function of the single-target detection model is obtained based on a dynamic allocation method; Backpropagation is performed on the single-target detection model based on the loss function; The training of the single-target detection model is completed when the single-target detection model converges to a first preset error or meets the first preset number of iterations.

3. The single-target detection model training method according to claim 2, characterized in that, The loss function for obtaining the single-object detection model based on dynamic allocation includes: Obtain the detection result output by the single-target detection model; Assign the labels to the location branch and the confidence branch, and dynamically assign the labels to the classification branch; Based on the labels and the detection results, obtain the location loss function, confidence loss function, and classification loss function; The loss function of the single-object detection model is obtained based on the location loss function, the confidence loss function, and the classification loss function.

4. The single-target detection model training method according to claim 3, characterized in that, The labels for dynamically assigning the classification branches include: Filter the anchor points in the detection results that meet the preset conditions; Obtain the prediction box corresponding to the anchor point; Obtain the intersection-union ratio (IUU) of the predicted bounding box and the labeled bounding box; Determine whether the maximum crossover-union ratio among the crossover-union ratios is greater than a preset threshold; If yes, then the anchor point is labeled as the target object; otherwise, the anchor point is labeled as a non-target object.

5. The single-target detection model training method according to claim 1, characterized in that, After training the single-object detection model based on the first training dataset and the initial weight parameters, the method further includes: Determine whether there are false detection types in the detection results output by the trained single-target detection model; If so, then paste the false detection type onto the background of the first training dataset to obtain the second training dataset, and update the first training dataset with the second training dataset; Repeat the process of training the single-object detection model based on the first training dataset and the initial weight parameters until no new false detection types appear in the detection results.

6. The single-target detection model training method according to claim 1, characterized in that, The step of training the initial object detection model based on the first training dataset includes: Input the first training dataset into the initial object detection model; Obtain the loss function of the initial target detection model; Backpropagation is performed on the initial target detection model based on the loss function; The initial target detection model training is completed when the initial target detection model converges to the second preset error or meets the second preset number of iterations.

7. A single-target detection method, characterized in that, The method includes: Obtain the sample to be detected, wherein the sample is a frame extracted from an image or video; The sample to be detected is input into the single-target detection model to obtain the detection result; The single-target detection model is trained based on the single-target detection model training method according to any one of claims 1 to 6.

8. The single-target detection method according to claim 7, characterized in that, The detection result includes detection boxes for the target object and detection boxes for non-target objects, and the method further includes: Selectively retain the detection bounding boxes of the target object and / or the detection bounding boxes of the non-target object in the detection results.

9. An electronic device comprising a processor and a storage device, said storage device being adapted to store a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by the processor to perform the single-object detection model training method of any one of claims 1 to 6 or the single-object detection method of any one of claims 7 to 8.

10. A computer-readable storage medium storing a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by a processor to perform the single-object detection model training method of any one of claims 1 to 6 or the single-object detection method of any one of claims 7 to 8.

Citation Information

Patent Citations

  • Training method and device of target detection model, electronic equipment and storage medium

    CN109961107A

  • Method and device for improving license plate recognition rate

    CN115601737A