A target detection method, a model training method and a device
By using images that meet preset results for iterative training and supervised learning with multiple loss functions in the object detection model, the problems of high false detection and false negative rates are solved, the model can be updated quickly and its accuracy improved, and the dependence on storage and computing devices is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG DAHUA TECH CO LTD
- Filing Date
- 2022-07-12
- Publication Date
- 2026-07-31
AI Technical Summary
In target detection models, the false detection and false negative rates are high and they rely on a large amount of historical training data, which makes the training process time-consuming and labor-intensive, and places high demands on the performance of storage and computing devices, making it impossible to achieve 100% accuracy in real-world scenarios.
Without relying on historical training data, the model is iteratively trained using images corresponding to the detection results that match the preset results from the previous object detection model. Through supervised learning with multiple loss functions, the model is updated to reduce the false detection rate and false negative rate.
Without changing the model structure, the model can be rapidly iterated and updated, reducing the false positive and false negative rates, decreasing the performance requirements of storage and computing devices, maintaining historical knowledge and learning new knowledge.
Smart Images

Figure CN115272817B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, and in particular to a target detection method, model training method, and device. Background Technology
[0002] Object detection is one of the most fundamental problems in computer vision. Its purpose is to detect what objects are in an image and determine their specific locations, and it has extremely wide applications. It is used in a range of scenarios such as autonomous driving, smart cities, smart industry and agriculture, and smart logistics. The emergence of deep learning technology has accelerated research into object detection, leading to many practical applications. Therefore, training a robust and accurate object detection model using deep learning technology has become extremely important.
[0003] However, in many cases, training a good object detection model requires a large amount of labeled data, various experienced model training methods, and continuous data expansion and model iteration. In real-world scenarios, the trained object detection model cannot cover the entire open world's data, and the accuracy of object detection cannot be 100%. For some false positives and false negatives, it is usually necessary to add new training data and retrain the model by combining it with the old training data. This is not only time-consuming and labor-intensive, but also places high demands on the performance of various storage and computing devices. Summary of the Invention
[0004] This invention provides a method, model training method, and device for object detection, which can effectively reduce the false detection rate and false negative rate of object detection models without relying on historical training data.
[0005] In a first aspect, embodiments of the present invention provide a target detection method, the method comprising:
[0006] Acquire the image to be detected;
[0007] The image to be detected is input into the target detection model, and the detection result corresponding to the image is output. The target detection model is obtained by training the previous target detection model using a set of labeled target images. The set of labeled target images includes images that meet the preset results when the previous target detection model is used to detect the input image. The target detection model is not the initial target detection model.
[0008] As an optional implementation method, the target detection model is obtained in the following way:
[0009] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0010] As an optional implementation method, the target detection model is obtained in the following way:
[0011] If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined.
[0012] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0013] As an optional implementation method, the target detection model is obtained in the following way:
[0014] The previously identified target image set is used to train the target detection model.
[0015] Based on the current output, the corresponding image labels, and the detection results, the total loss function is determined; wherein, the detection results are obtained by detecting images in the unlabeled target image set using the previous target detection model.
[0016] When the total loss function value meets the preset conditions, training stops and the target detection model for this iteration is obtained.
[0017] As an optional implementation, determining the total loss function based on the current output result, the image annotation labels corresponding to the current output result, and the detection results includes:
[0018] Based on the current output and the corresponding image labels, determine the first loss function;
[0019] Based on the output results and the detection results, determine the second loss function;
[0020] The total loss function is determined based on the first loss function and the second loss function.
[0021] As an optional implementation, the total loss function further includes a third loss function, which is determined in the following manner:
[0022] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0023] As an optional implementation, determining the third loss function based on the importance of the model parameters in the previous target detection model includes:
[0024] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0025] As an optional implementation method,
[0026] When the target detection model is the initial target detection model, it is trained using labeled training sample images.
[0027] Secondly, an embodiment of the present invention provides a method for training a target detection model, comprising:
[0028] When using the previous target detection model to detect the input image, the set of labeled target images is determined based on the images corresponding to the detection results that meet the preset results;
[0029] The target detection model from the previous test is trained using a set of labeled target images to obtain the target detection model for the current test; wherein the target detection model for the current test is a non-initial target detection model.
[0030] As an optional implementation method, the target detection model is obtained in the following way:
[0031] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0032] As an optional implementation method, the target detection model is obtained in the following way:
[0033] If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined.
[0034] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0035] As an optional implementation method, the target detection model is obtained in the following way:
[0036] The previously identified target image set is used to train the target detection model.
[0037] Based on the current output, the corresponding image labels, and the detection results, the total loss function is determined; wherein, the detection results are obtained by detecting images in the unlabeled target image set using the previous target detection model.
[0038] When the total loss function value meets the preset conditions, training stops and the target detection model for this iteration is obtained.
[0039] As an optional implementation, determining the total loss function based on the current output result, the image annotation labels corresponding to the current output result, and the detection results includes:
[0040] Based on the current output and the corresponding image labels, determine the first loss function;
[0041] Based on the output results and the detection results, determine the second loss function;
[0042] The total loss function is determined based on the first loss function and the second loss function.
[0043] As an optional implementation, the total loss function further includes a third loss function, which is determined in the following manner:
[0044] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0045] As an optional implementation, determining the third loss function based on the importance of the model parameters in the previous target detection model includes:
[0046] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0047] As an optional implementation method,
[0048] When the target detection model is the initial target detection model, it is trained using labeled training sample images.
[0049] Thirdly, embodiments of the present invention also provide a target detection device, the device including a processor and a memory, the memory being used to store a program executable by the processor, and the processor being used to read the program in the memory and perform the following steps:
[0050] Acquire the image to be detected;
[0051] The image to be detected is input into the target detection model, and the detection result corresponding to the image is output. The target detection model is obtained by training the previous target detection model using a set of labeled target images. The set of labeled target images includes images that meet the preset results when the previous target detection model is used to detect the input image. The target detection model is not the initial target detection model.
[0052] As an optional implementation, the processor is specifically configured to obtain the target detection model in the following manner:
[0053] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0054] As an optional implementation, the processor is specifically configured to obtain the target detection model in the following manner:
[0055] If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined.
[0056] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0057] As an optional implementation, the processor is specifically configured to obtain the target detection model in the following manner:
[0058] The previously identified target image set is used to train the target detection model.
[0059] Based on the current output, the corresponding image labels, and the detection results, the total loss function is determined; wherein, the detection results are obtained by detecting images in the unlabeled target image set using the previous target detection model.
[0060] When the total loss function value meets the preset conditions, training stops and the target detection model for this iteration is obtained.
[0061] As an optional implementation, the processor is specifically configured to execute:
[0062] Based on the current output and the corresponding image labels, determine the first loss function;
[0063] Based on the output results and the detection results, determine the second loss function;
[0064] The total loss function is determined based on the first loss function and the second loss function.
[0065] As an optional implementation, the total loss function further includes a third loss function, and the processor is specifically configured to determine the third loss function in the following manner:
[0066] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0067] As an optional implementation, the processor is specifically configured to execute:
[0068] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0069] As an optional implementation method,
[0070] When the target detection model is the initial target detection model, it is trained using labeled training sample images.
[0071] Fourthly, embodiments of the present invention also provide a target detection apparatus, the apparatus comprising:
[0072] Image acquisition unit, used to acquire the image to be detected;
[0073] An image detection unit is used to input the image to be detected into the current target detection model and output the detection result corresponding to the image; wherein, the current target detection model is obtained by training the previous target detection model using a set of labeled target images, and the set of labeled target images includes images that meet the preset results when the previous target detection model is used to detect the input image; wherein the current target detection model is a non-initial target detection model.
[0074] As an optional implementation, the image detection unit is specifically used to obtain the target detection model in the current context in the following manner:
[0075] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0076] As an optional implementation, the image detection unit is specifically used to obtain the target detection model in the current context in the following manner:
[0077] If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined.
[0078] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0079] As an optional implementation, the image detection unit is specifically used to obtain the target detection model in the current context in the following manner:
[0080] The previously identified target image set is used to train the target detection model.
[0081] Based on the current output, the corresponding image labels, and the detection results, the total loss function is determined; wherein, the detection results are obtained by detecting images in the unlabeled target image set using the previous target detection model.
[0082] When the total loss function value meets the preset conditions, training stops and the target detection model for this iteration is obtained.
[0083] As an optional implementation, the image detection unit is specifically used for:
[0084] Based on the current output and the corresponding image labels, determine the first loss function;
[0085] Based on the output results and the detection results, determine the second loss function;
[0086] The total loss function is determined based on the first loss function and the second loss function.
[0087] As an optional implementation, the total loss function further includes a third loss function, and the image detection unit is specifically used to determine the third loss function in the following manner:
[0088] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0089] As an optional implementation, the image detection unit is specifically used for:
[0090] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0091] As an optional implementation method,
[0092] When the target detection model is the initial target detection model, it is trained using labeled training sample images.
[0093] Fifthly, embodiments of the present invention also provide a computer storage medium having a computer program stored thereon, which, when executed by a processor, is used to implement the steps of the method described in the first aspect above.
[0094] These or other aspects of this application will become more apparent in the following description of embodiments. Attached Figure Description
[0095] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0096] Figure 1 The following is a flowchart illustrating the implementation of a target detection method according to an embodiment of the present invention;
[0097] Figure 2 This is a flowchart illustrating an implementation of a target detection method according to an embodiment of the present invention;
[0098] Figure 3 A flowchart illustrating the implementation of a training method for an object detection model provided in an embodiment of the present invention;
[0099] Figure 4 A schematic diagram of a target detection device provided in an embodiment of the present invention;
[0100] Figure 5This is a schematic diagram of a target detection device provided in an embodiment of the present invention. Detailed Implementation
[0101] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0102] In this embodiment of the invention, the term "and / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following associated objects have an "or" relationship.
[0103] The application scenarios described in the embodiments of this invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of this invention, and do not constitute a limitation on the technical solutions provided by the embodiments of this invention. Those skilled in the art will understand that with the emergence of new application scenarios, the technical solutions provided by the embodiments of this invention are also applicable to similar technical problems. In the description of this invention, unless otherwise stated, "multiple" means two or more.
[0104] Example 1: Object detection is one of the most fundamental problems in computer vision. Its purpose is to detect what objects are present in an image and determine their specific locations, with extremely wide applications. It has been applied in a range of scenarios such as intelligent driving, smart cities, smart industry and agriculture, and smart logistics. The emergence of deep learning technology has accelerated research into object detection, leading to many practical applications. Therefore, training a robust and accurate object detection model using deep learning technology has become extremely important. However, in many cases, training a good object detection model requires a large amount of labeled data, various experienced model training methods, and continuous data expansion and model iteration. In real-world scenarios, trained object detection models cannot cover the entire open-world dataset, and object detection accuracy cannot be 100%. For some false positives and false negatives, it is usually necessary to add new training data and retrain the model based on the old training data. This is not only time-consuming and labor-intensive, but also places high demands on the performance of various storage and computing devices. Therefore, how to quickly iterate a new model on the original detection model to effectively solve false positives and false negatives, without relying on or with minimal reliance on historical training data, has become an urgent technical problem to be solved. Furthermore, in real-world scenarios, due to the memory and speed requirements of devices, the size of the original model usually cannot be changed, that is, feature extraction or detection branches cannot be added to assist the original object network in detection. Therefore, it is of great significance to solve the problem of keeping the network model unchanged, effectively maintaining the knowledge learned in the past, and being able to iterate the model and learn new knowledge based on new training data.
[0105] It should be noted that the object detection method provided in this embodiment does not involve a specific object detection algorithm. That is, the object detection model includes, but is not limited to, YOLO series, SSD series, RCNN series, anchor-free series, etc. This embodiment does not impose too many limitations on it.
[0106] The object detection method provided in this embodiment is based on the original object detection model. Without relying on historical training data, it uses the images corresponding to the detection results that meet the preset results of the previous object detection model as training data to train the previous object detection model. The object detection model in this embodiment can continuously iterate and update during the object detection process without changing the network structure of the model and without relying on historical training data. When the image corresponding to the detection result that meets the preset results is an image that was missed or falsely detected by the previous object detection model, it can use the previously missed or falsely detected image to iteratively train the previous object detection model, so that the model can continuously learn new knowledge about missed and false detections, thereby reducing the missed detection rate and false detection rate of the model.
[0107] like Figure 1As shown in the figure, the implementation flow of the target detection method provided in this embodiment is as follows:
[0108] Step 100: Obtain the image to be detected;
[0109] Step 101: Input the image to be detected into the current target detection model and output the detection result corresponding to the image; wherein, the current target detection model is obtained by training the previous target detection model using a set of labeled target images, and the set of labeled target images includes images that meet the preset results when the input image is detected using the previous target detection model; wherein the current target detection model is a non-initial target detection model.
[0110] In some embodiments, when the target detection model is the initial target detection model, the target detection model is trained using labeled training sample images.
[0111] In some embodiments, the initial target detection model in this embodiment is trained using labeled training sample images. In practice, firstly, a target detection model is selected according to actual needs, training sample images are collected and image annotation and segmentation are performed according to actual needs, and the target detection model is trained to obtain the model parameters with the best performance in the validation set, which are used as the model parameters of the initial target detection model. The target detection model can also be identified as the initial version model, i.e., the initial target detection model.
[0112] In some embodiments, the detection results that meet the preset results in this embodiment include, but are not limited to, false detections and / or false negatives. In this embodiment, the number of images in the target image set is a threshold m that is greater than zero.
[0113] In implementation, the set of labeled target images in this embodiment is obtained in the following way:
[0114] First, the input image is detected using the previously mentioned target detection model. The input image is the actual image to be detected. When there are false positives and / or false negatives in the detection results, the false positives and / or false negatives are saved to obtain a target image set. Second, after obtaining the target image set, the false positives and / or false negatives in the target image set need to be labeled. For example, since the number of images in the target image set is small, manual labeling can be used to label the images, and finally, a labeled target detection image set is obtained.
[0115] In practice, when the number of saved false positives and / or false negatives reaches the threshold m, iterative training of the target detection model can be initiated.
[0116] In some embodiments, the target detection model is obtained in the following manner:
[0117] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0118] In some embodiments, the target detection model is obtained in the following manner:
[0119] If the previous object detection model was obtained by iteratively training the initial object detection model multiple times, then the number of iterations is determined. Here, iterative training refers to iterative training of the object detection model as a whole, rather than iterative training of the model parameters in a single object detection model. That is, iterative training here means that the object detection model as a whole has been trained once or multiple times, and each training can produce a well-trained object detection model for practical application.
[0120] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0121] In practice, when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model; or,
[0122] When the number of iterations is less than or equal to the threshold, the target detection model from the previous iteration is trained using the labeled target image set to obtain the target detection model for the current iteration.
[0123] When the number of iterations is greater than or equal to the threshold, it indicates that the target detection model has been increasingly forgetting the learned historical knowledge. Therefore, the iterative training of the target detection model should be terminated, and training samples should be collected again to train a new initial target detection model.
[0124] In some embodiments, the target detection model is obtained in the following manner:
[0125] (1) Train the target detection model from the previous step using the labeled set of target images;
[0126] When training the previous object detection model, the images in the labeled object image set are input into the previous object detection model. The output results of this time are compared with the labeled images, and the model parameters in the previous object detection model are trained to obtain the current object detection model.
[0127] Here, the target image set is set as X. d {x1,x2,x3,…,x m Set the image label to Y. d {y1,y2,y3,…,y m}, where X d and Y d It is a one-to-one correspondence, that is, the label of x1 is y1, the label of x2 is y2, and so on.
[0128] In implementation, X d Y d Input the target image set, and combine the current output with Y d A comparison is performed, and based on the comparison results, the model parameters in the previous target detection model are trained to obtain the target detection model for this time.
[0129] (2) Determine the total loss function based on the current output, the image labels corresponding to the current output, and the detection results;
[0130] The detection result is obtained by detecting images in the unlabeled target image set using the previous target detection model; for example, the unlabeled target image set is input into the previous target detection model for target detection to obtain the detection result corresponding to the unlabeled target image set, including the detection results of false detections or false misses, and the detection result is set as Y′. d {y′1,y′2,y′3,…,y′ m}, which is the set of unlabeled target images X d {x1,x2,x3,…,x m The input is fed into the previous object detection model for object detection, resulting in Y′. d {y′1,y′2,y′3,…,y′ m}
[0131] In some embodiments, the total loss function is determined as follows:
[0132] (2a) Determine the first loss function based on the current output result and the annotation label of the image corresponding to the current output result;
[0133] In practice, the output result for this instance will be set to 0. dThe image label corresponding to the output result is set to Y. d Then according to O d and Y d Determine the first loss function, where the first loss function is set to L. ori .
[0134] (2b) Determine the second loss function based on the output results and the detection results;
[0135] In practice, the output result for this instance will be set to 0. d Set the detection result as Y′ d Then according to O d and Y′ d A second loss function is determined, which is set to L1. This second loss function, acting as a penalty term for the network parameters under training on the training dataset, has different modes and is mainly used to supervise model parameters, preventing the forgetting of knowledge already learned by the original object detection model during training.
[0136] (2c) Determine the total loss function based on the first loss function and the second loss function.
[0137] In implementation, the total loss function can be determined using the following formula:
[0138] L=λ ori L ori +λ1L1 formula (1);
[0139] Among them, L ori Let L1 denote the first loss function, and L1 denote the second loss function, λ ori Both λ1 and λ2 represent weights, and λ3 represents weights. ori Both λ1 and λ2 are preset values, and L represents the total loss function.
[0140] In some embodiments, the total loss function further includes a third loss function, which is determined as follows:
[0141] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0142] In some embodiments, the total loss function is determined by the following formula:
[0143] L′=λ ori L ori +λ1L1+λ2L2 formula (2);
[0144] Among them, L ori Let L1 denote the first loss function, L2 denote the second loss function, and L3 denote the third loss function. λ oriλ1 and λ2 both represent weights, and λ ori λ1 and λ2 are preset values, and L′ represents the total loss function. The third loss function serves as a penalty term for the importance of the model parameters. It is used to minimize changes to highly important model parameters during iterative training, thus mitigating the catastrophic forgetting of important model parameters caused by excessive changes during backpropagation in the initial training phase.
[0145] In some embodiments, the third loss function is determined as follows:
[0146] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0147] In some embodiments, the third loss function is determined by the following formula:
[0148]
[0149] Where L2 represents the third loss function, θ i This refers to the i-th model parameter in the object detection model during the iterative training process. Let be the i-th model parameter in the previous object detection model, where d represents an integer not greater than the threshold of the number of iterations trained, and F... d,i Let be the i-th diagonal element of the Fisher information matrix corresponding to the model parameters in the previous object detection model to be trained, and n be the total number of model parameters of the object detection model. The total number of model parameters of the current object detection model is the same as that of the previous object detection model, that is, the total number of model parameters does not change during the iterative training process.
[0150] (3) When the total loss function value is determined to meet the preset conditions, training is stopped and the target detection model for this time is obtained.
[0151] like Figure 2 As shown in the figure, this embodiment also provides a target detection method, the specific implementation process of which is as follows:
[0152] Step 200: Select an initial version of the object detection model, and train the initial version of the object detection model using labeled training sample images to obtain the initial object detection model.
[0153] Step 201: Obtain the image to be detected, input the image to be detected into the target detection model, and output the detection result corresponding to the image;
[0154] The target detection model in this study includes the initial target detection model.
[0155] Step 202: Save the images corresponding to the false detection and / or missed detection results, and record the number of saved images;
[0156] Step 203: Determine whether the number of saved images is greater than or equal to the number threshold. If yes, proceed to step 204; otherwise, proceed to step 201.
[0157] Step 204: Determine the set of labeled target images based on the saved images;
[0158] The process involves manually annotating the saved images to obtain a set of annotated target images.
[0159] Step 205: Iteratively train the target detection model using the labeled target image set to obtain the target detection model for the next iteration;
[0160] Step 206: Determine whether the number of iterations is less than or equal to the threshold. If yes, proceed to step 201; otherwise, proceed to step 207.
[0161] Step 207: End the iterative training of the object detection model.
[0162] This embodiment provides a target detection method that uses incremental learning without changing the original target detection network structure. It uses little or no historical training data and combines the initial target detection model with newly added false positive and false negative images to quickly iteratively train a new target detection model that has less forgetting of historical knowledge and can learn new knowledge. Furthermore, it employs a multi-loss mutual supervision learning method to address the problem of catastrophic model forgetting caused by excessive changes in important model parameters during backpropagation training.
[0163] Based on the same inventive concept, this embodiment of the invention also provides a training method for an object detection model. This model is the object detection model used in the method of this embodiment, as shown in the figure. The specific implementation flow of this training method is as follows:
[0164] In some embodiments, this embodiment also provides a method for training an object detection model, such as... Figure 3 The specific implementation flow of this training method is as follows:
[0165] Step 300: When using the target detection model from the previous step to detect the input image, determine the set of labeled target images based on the images corresponding to the detection results that meet the preset results.
[0166] Step 301: Train the previous target detection model using the labeled target image set to obtain the current target detection model; wherein the current target detection model is a non-initial target detection model.
[0167] In some embodiments, the target detection model is obtained in the following manner:
[0168] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0169] In some embodiments, the target detection model is obtained in the following manner:
[0170] If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined.
[0171] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0172] In some embodiments, the target detection model is obtained in the following manner:
[0173] The previously identified target image set is used to train the target detection model.
[0174] Based on the current output, the corresponding image labels, and the detection results, the total loss function is determined; wherein, the detection results are obtained by detecting images in the unlabeled target image set using the previous target detection model.
[0175] When the total loss function value meets the preset conditions, training stops and the target detection model for this iteration is obtained.
[0176] In some embodiments, the total loss function is determined as follows:
[0177] Based on the current output and the corresponding image labels, determine the first loss function;
[0178] Based on the output results and the detection results, determine the second loss function;
[0179] The total loss function is determined based on the first loss function and the second loss function.
[0180] In some embodiments, the total loss function further includes a third loss function, which is determined as follows:
[0181] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0182] In some embodiments, the third loss function is determined as follows:
[0183] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0184] In some embodiments, when the target detection model is the initial target detection model, the target detection model is trained using labeled training sample images.
[0185] This embodiment provides a training method for an object detection model. It uses batch data for iterative training of the model, which effectively reduces data storage and accelerates model training. It adopts a combined incremental learning strategy and a multi-loss supervised learning method to effectively solve the problems of false detection and false negative detection. Based on the iterative scheme, and combining the advantages and disadvantages of incremental learning, the model stops iterating after the total number of iterations reaches a certain number. This helps to solve the problem of catastrophic forgetting of the model caused by excessive changes in important model parameters in the initial object detection model during backpropagation training.
[0186] Example 2: Based on the same inventive concept, this embodiment of the invention also provides a target detection device. Since this device is the same as the device in the method of this embodiment of the invention, and the principle of the device in solving the problem is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0187] like Figure 4 As shown, the device includes a processor 400 and a memory 401. The memory 401 stores programs executable by the processor 400. The processor 400 reads the programs from the memory 401 and performs the following steps:
[0188] Acquire the image to be detected;
[0189] The image to be detected is input into the target detection model, and the detection result corresponding to the image is output. The target detection model is obtained by training the previous target detection model using a set of labeled target images. The set of labeled target images includes images that meet the preset results when the previous target detection model is used to detect the input image. The target detection model is not the initial target detection model.
[0190] As an optional implementation, the processor 400 is specifically configured to obtain the target detection model in the following manner:
[0191] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0192] As an optional implementation, the processor 400 is specifically configured to obtain the target detection model in the following manner:
[0193] If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined.
[0194] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0195] As an optional implementation, the processor 400 is specifically configured to obtain the target detection model in the following manner:
[0196] The previously identified target image set is used to train the target detection model.
[0197] Based on the current output, the corresponding image labels, and the detection results, the total loss function is determined; wherein, the detection results are obtained by detecting images in the unlabeled target image set using the previous target detection model.
[0198] When the total loss function value meets the preset conditions, training stops and the target detection model for this iteration is obtained.
[0199] As an optional implementation, the processor 400 is specifically configured to perform:
[0200] Based on the current output and the corresponding image labels, determine the first loss function;
[0201] Based on the output results and the detection results, determine the second loss function;
[0202] The total loss function is determined based on the first loss function and the second loss function.
[0203] As an optional implementation, the total loss function further includes a third loss function, and the processor 400 is specifically configured to determine the third loss function in the following manner:
[0204] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0205] As an optional implementation, the processor 400 is specifically configured to perform:
[0206] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0207] As an optional implementation method,
[0208] When the target detection model is the initial target detection model, it is trained using labeled training sample images.
[0209] Example 3: Based on the same inventive concept, this embodiment of the invention also provides a target detection device. Since this device is the same as the device in the method of this embodiment of the invention, and the principle of the device in solving the problem is similar to that of the method, the implementation of this device can refer to the implementation of the method, and the repeated parts will not be described again.
[0210] like Figure 5 As shown, the device includes:
[0211] Image acquisition unit 500 is used to acquire the image to be detected;
[0212] Image detection unit 501 is used to input the image to be detected into the current target detection model and output the detection result corresponding to the image; wherein, the current target detection model is obtained by training the previous target detection model using a set of labeled target images, and the set of labeled target images includes images that meet the preset results when the input image is detected using the previous target detection model; wherein the current target detection model is a non-initial target detection model.
[0213] As an optional implementation, the image detection unit 501 is specifically used to obtain the target detection model in the current context in the following manner:
[0214] When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0215] As an optional implementation, the image detection unit 501 is specifically used to obtain the target detection model in the current context in the following manner:
[0216] If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined.
[0217] When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
[0218] As an optional implementation, the image detection unit 501 is specifically used to obtain the target detection model in the current context in the following manner:
[0219] The previously identified target image set is used to train the target detection model.
[0220] Based on the current output, the corresponding image labels, and the detection results, the total loss function is determined; wherein, the detection results are obtained by detecting images in the unlabeled target image set using the previous target detection model.
[0221] When the total loss function value meets the preset conditions, training stops and the target detection model for this iteration is obtained.
[0222] As an optional implementation, the image detection unit 501 is specifically used for:
[0223] Based on the current output and the corresponding image labels, determine the first loss function;
[0224] Based on the output results and the detection results, determine the second loss function;
[0225] The total loss function is determined based on the first loss function and the second loss function.
[0226] As an optional implementation, the total loss function further includes a third loss function, and the image detection unit is specifically used to determine the third loss function in the following manner:
[0227] The third loss function is determined based on the importance of the model parameters in the previous target detection model.
[0228] As an optional implementation, the image detection unit 501 is specifically used for:
[0229] The third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model.
[0230] As an optional implementation method,
[0231] When the target detection model is the initial target detection model, it is trained using labeled training sample images.
[0232] Based on the same inventive concept, embodiments of the present invention also provide a computer storage medium storing a computer program, which, when executed by a processor, performs the following steps:
[0233] Acquire the image to be detected;
[0234] The image to be detected is input into the target detection model, and the detection result corresponding to the image is output. The target detection model is obtained by training the previous target detection model using a set of labeled target images. The set of labeled target images includes images that meet the preset results when the previous target detection model is used to detect the input image. The target detection model is not the initial target detection model.
[0235] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0236] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 Devices that specify the functions in one or more boxes.
[0237] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction device, which is implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0238] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0239] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for target detection, characterized in that, The method includes: Acquire the image to be detected; The image to be detected is input into the current target detection model, and the detection result corresponding to the image to be detected is output. The current target detection model is obtained by training the previous target detection model using a set of labeled target images. The set of labeled target images includes images that meet the preset results when the previous target detection model is used to detect the input image. The set of labeled target images includes images obtained by manually labeling false positives and false negatives in the detection results. The current target detection model is not the initial target detection model. The current target detection model is obtained in the following way: The previously used target detection model is trained using the labeled target image set. A first loss function is determined based on the current output and the corresponding image labels. A second loss function is determined based on the current output and the detection results. A third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model. A total loss function is determined based on the first, second, and third loss functions. The second loss function serves as a penalty term to supervise the model parameters. The third loss function serves as a penalty term to minimize changes to highly important model parameters during iterative training. The total number of model parameters in the current and previous target detection models is the same. The detection results are obtained by detecting images from the unlabeled target image set using the previous target detection model. The detection results include false positives and false negatives. When the total loss function value meets a preset condition, training is stopped, and the current target detection model is obtained.
2. The method according to claim 1, characterized in that, The target detection model for this test was obtained in the following manner: When it is determined that the number of images in the labeled target image set is greater than or equal to the number threshold, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
3. The method according to claim 1, characterized in that, The target detection model for this test was obtained in the following manner: If the previous object detection model was obtained by iteratively training the initial object detection model, then the number of iterations is determined. When the number of iterations is less than or equal to the threshold, or when the previous target detection model is the initial target detection model, the previous target detection model is trained using the labeled target image set to obtain the current target detection model.
4. The method according to claim 1, characterized in that, When the target detection model is the initial target detection model, it is trained using labeled training sample images.
5. A training method for an object detection model, characterized in that, The method includes: When using the previous target detection model to detect the input image, a set of labeled target images is determined based on the images corresponding to the detection results that meet the preset results; the set of labeled target images includes images obtained by manually labeling the images that are falsely detected and missed in the detection results; The target detection model is trained using the labeled target image set to obtain the current target detection model; wherein, the previous target detection model is trained using the labeled target image set; a first loss function is determined based on the current output result and the labeled labels of the images corresponding to the current output result; a second loss function is determined based on the current output result and the detection result; a third loss function is determined based on the model parameters in the current target detection model, the model parameters in the previous target detection model, and the Fisher information matrix corresponding to the model parameters in the previous target detection model; a third loss function is determined based on the first loss function, the second loss function, and the... The third loss function determines the total loss function; wherein, the second loss function serves as a penalty term to supervise the model parameters; the third loss function serves as a penalty term to minimize changes to model parameters with higher importance during iterative training; the total number of model parameters in the current object detection model is the same as that in the previous object detection model; the detection results are obtained by detecting images in the unlabeled target image set using the previous object detection model; the detection results include false positives and false negatives; when the total loss function value meets a preset condition, training stops and the current object detection model is obtained; the current object detection model is not the initial object detection model.
6. A target detection device, characterized in that, The device includes a processor and a memory for storing a program executable by the processor, and the processor for reading the program in the memory and performing the steps of the method according to any one of claims 1 to 4 or 5.
7. A computer storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 4 or 5.