A target detection model training method and device, computer equipment, and medium

By calculating the self-adjustment of the confidence ratio and confidence loss weight value of the target detection model, the problems of uncertainty in accuracy and performance consumption in small target detection are solved, and efficient target detection is achieved.

CN116051904BActive Publication Date: 2026-05-05JINAN BOGUAN INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN BOGUAN INTELLIGENT TECH CO LTD
Filing Date
2023-02-15
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing small target detection methods have uncertainties in improving accuracy, and feature weighted fusion methods are costly in terms of performance and storage space, making it difficult to accurately detect small targets.

Method used

By calculating the confidence ratio and confidence loss weight value of the target detection model based on the proportion of the detected target, it can self-regulate, improve detection accuracy and robustness, and avoid additional burden on the inference stage.

Benefits of technology

It improves the accuracy of object detection and the robustness of the model while maintaining the efficiency of the inference stage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116051904B_ABST
    Figure CN116051904B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, computer device, and medium for training an object detection model, relating to the field of computer technology. The method includes: dividing the image dataset to be trained into different model training sets; determining the proportion of detected objects in the model training sets based on the annotation information of the training sets; calculating the confidence ratio and confidence loss weight values ​​of the object detection model based on the proportion values, thereby completing the training of the object detection model. This invention can calculate the confidence ratio and confidence loss weight values ​​of the object detection model based on the proportion of detected objects, making the confidence ratio and confidence loss weight values ​​no longer fixed and allowing them to self-adjust based on the proportion of detected objects, thereby improving detection accuracy and increasing the robustness and accuracy 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 technology, and in particular to a method, apparatus, computer equipment, and medium for training a target detection model. Background Technology

[0002] Object detection is one of the most important research directions in the field of computer vision. Object detection is the process of determining the category and location of objects of interest in an image, and the detection of small objects, characterized by low detection rate and high false detection rate, has become a research hotspot in object detection.

[0003] Current methods for detecting small targets fall into two categories. One involves automatically adjusting the position loss by modifying the loss function to improve the accuracy of bounding box regression. However, the effectiveness of this method in improving the detection accuracy of small targets is uncertain; it may lead to either increased or decreased accuracy, ultimately resulting in the inability to accurately detect small targets. Another approach uses weighted feature fusion. This method extracts features from a single feature map using different network structures and then performs a weighted fusion operation. The weighted fused features can enhance features in specific regions, obtaining richer target information and improving the detection and recognition accuracy of small targets. However, this method consumes more storage space and is performance-intensive, impacting inference time. Furthermore, it suffers from significant uncertainty in practical applications, making it difficult to accurately extract weighted features for targets. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, computer device, and medium for training an object detection model. This invention can calculate the confidence ratio and confidence loss weight value of the object detection model based on the proportion of detected objects, so that the confidence ratio and confidence loss weight value are no longer fixed and can be self-adjusted according to the proportion of detected objects, thereby improving the detection accuracy, increasing the robustness and detection accuracy of the model. Furthermore, this invention operates in the training stage without changing the inference stage of the object detection model, and does not add any extra burden to the inference of the object detection model.

[0005] According to one aspect of the present invention, the present invention provides a method for training an object detection model, comprising:

[0006] Divide the image dataset to be trained to obtain different model training sets;

[0007] Based on the annotation information of the model training set, determine the proportion of targets detected in the model training set;

[0008] Based on the stated ratio, the confidence ratio and confidence loss weight of the target detection model are calculated, thus completing the training of the target detection model.

[0009] Optionally, the step of calculating the confidence ratio and confidence loss weight value of the target detection model based on the ratio value, and completing the training of the target detection model, includes:

[0010] Based on the stated ratio, the confidence ratio and confidence loss weight values ​​for training the target detection model using the model training set are obtained.

[0011] The confidence ratio and the confidence loss weight value are statistically analyzed to obtain the confidence ratio and confidence loss weight value of the target detection model, thus completing the training of the target detection model.

[0012] Optionally, the step of statistically analyzing the confidence ratio and the confidence loss weight value to obtain the confidence ratio and confidence loss weight value of the target detection model, thereby completing the training of the target detection model, includes:

[0013] Calculate all the confidence ratios and confidence loss weights to obtain the mean and variance of the confidence ratios and confidence loss weights;

[0014] Based on the mean and the variance, the confidence ratio and confidence loss weight values ​​for training the target detection model using the image dataset are obtained.

[0015] Optionally, the step of statistically analyzing the confidence ratio and the confidence loss weight value to obtain the calculated confidence ratio and confidence loss weight value of the target detection model, thereby completing the training of the target detection model, further includes:

[0016] Using the exponential moving average method, the confidence ratio and confidence loss weight values ​​of the target detection model trained with the image dataset are statistically analyzed to obtain the confidence ratio and confidence loss weight values ​​of the target detection model, thus completing the training of the target detection model.

[0017] Optionally, determining the proportion of detected targets in the model training set based on the annotation information of the model training set includes:

[0018] Based on the annotation information of the model training set, determine the category attributes of the detected targets in the model training set;

[0019] Based on the category attribute, determine the proportion of the number of the detected target corresponding to the category attribute to the total number of all detected targets.

[0020] Optionally, determining the category attribute of the detected target in the model training set based on the annotation information of the model training set includes:

[0021] Based on the annotation information of the model training set, determine the area of ​​the detected target in the model training set;

[0022] Based on the area, each of the detected targets is classified into categories to obtain the corresponding category attributes.

[0023] Optionally, the step of classifying each of the detected targets into corresponding category attributes based on the area includes:

[0024] Determine the proportion of the area of ​​the detected target to the area of ​​the image it occupies;

[0025] Based on the stated ratio, each of the detected targets is categorized to obtain the corresponding category attribute.

[0026] This invention provides a target detection model training device, comprising:

[0027] The dataset partitioning module is used to partition the image dataset to be trained into different model training sets;

[0028] The proportion calculation module is used to determine the proportion of the detected targets in the model training set based on the annotation information of the model training set.

[0029] The calculation module is used to calculate the confidence ratio and confidence loss weight value of the target detection model based on the ratio value, and to complete the training of the target detection model.

[0030] This invention provides a computer device, comprising:

[0031] Memory, used to store computer programs;

[0032] A processor is used to implement the target detection model training method as described above when executing the computer program.

[0033] The present invention provides a computer-readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the steps of the target detection model training method described above.

[0034] As can be seen, this invention can calculate the confidence ratio and confidence loss weight value of the target detection model based on the proportion of the detected target, so that the confidence ratio and confidence loss weight value are no longer fixed and can be self-adjusted according to the proportion of the detected target, thereby improving the detection accuracy, increasing the robustness and detection accuracy of the model. Furthermore, this invention operates only during the training phase and does not alter the inference phase of the target detection model, nor does it add any extra burden to the inference process. This application also provides a target detection model training device, a computer device, and a computer-readable storage medium, which have the above-mentioned beneficial effects. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0036] Figure 1 This is a flowchart of a target detection model training method provided in an embodiment of the present invention;

[0037] Figure 2 A flowchart of another object detection model training method provided in an embodiment of the present invention;

[0038] Figure 3 This is a structural block diagram of a target detection model training device provided in an embodiment of the present invention;

[0039] Figure 4 This is a structural block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0041] Object detection is one of the most important research directions in the field of computer vision. Object detection is the process of determining the category and location of objects of interest in an image, and the detection of small objects, characterized by low detection rate and high false detection rate, has become a research hotspot in object detection.

[0042] Current methods for detecting small targets fall into two categories. One involves automatically adjusting the position loss by modifying the loss function to improve bounding box regression accuracy. However, this approach has uncertain implications for improving small target detection accuracy; it may lead to either increased or decreased accuracy, ultimately failing to detect small targets accurately. Another method uses weighted feature fusion. This involves extracting features from a single feature map using different network structures and then performing a weighted fusion operation. The weighted fused features can enhance features in specific regions, obtaining richer target information and improving the detection and recognition accuracy of small targets. However, this method consumes more storage space and is performance-intensive, impacting inference time. Furthermore, it suffers from significant uncertainty in practical applications, making accurate weighted feature extraction of targets difficult.

[0043] In view of this, the present invention provides a target detection model training method, which can calculate the confidence ratio and confidence loss weight value of the target detection model based on the proportion of detected targets. This makes the confidence ratio and confidence loss weight value no longer fixed, but can be self-adjusted according to the proportion of detected targets, thereby improving the detection accuracy, increasing the robustness and detection accuracy of the model. Furthermore, the present invention operates in the training stage without changing the inference stage of the target detection model, and does not add any extra burden to the inference of the target detection model.

[0044] The following is a detailed introduction; please refer to it. Figure 1 , Figure 1 This is a flowchart of a target detection model training method provided in an embodiment of the present invention. The target detection model training method in an embodiment of the present invention may include:

[0045] Step S101: Divide the image dataset to be trained to obtain different model training sets.

[0046] In this embodiment of the invention, the image dataset is a dataset containing a large amount of image information. There is no limit to the number of datasets selected. Designers can select the number of image datasets according to their needs, such as selecting 10,000 images as the image training set, or they can select the number of image datasets according to the actual usage.

[0047] In this embodiment of the invention, the model training set is a collection of images containing the detection target. It can be obtained by dividing the image dataset. It should be noted that there is no limitation on the division method. The image dataset can be divided according to a preset interval or by using random sampling. There is no limitation on the number of images in the model training set. The model training set can contain multiple images. For example, if the number of images in the image dataset is 1000, the image dataset can be divided according to a preset interval of 100. For example, 1 to 100 images are one model training set, 200 to 300 images are another model training set, and so on.

[0048] Step S102: Determine the proportion of targets detected in the model training set based on the annotation information of the model training set.

[0049] In this embodiment of the invention, the annotation information can be used to annotate the detection targets in the model training set. After determining the detection targets, the proportion of detection targets in the model training set can be determined based on the annotation information. It should be noted that the category attributes of the detection targets in the model training set can be determined based on the annotation information, and then the proportion of the number of detection targets corresponding to the category attribute to the total number of detection targets can be determined based on the category attribute. The division of category attributes is not limited; it can be based on the size of the detection target or the area ratio of the detection target in the image.

[0050] It should be noted that in this embodiment of the invention, the area of ​​the detected targets in the model training set can be determined based on the annotation information of the model training set. Then, based on the area, each detected target is classified to obtain the corresponding category attribute. Specifically, the proportion of the detected target's area to the area of ​​its corresponding image can be determined, and the corresponding category attribute is obtained based on the proportion. It should be noted that when the proportion is less than a preset threshold, the detected target is defined as a small target; when the proportion is greater than the preset threshold, the detected target is defined as a large target. There is no limit to the number of preset thresholds; two preset thresholds can be set as a first threshold and a second threshold. When the proportion is less than the first threshold, the detected target is defined as a small target; when the proportion is greater than or equal to the first threshold and less than or equal to the second threshold, the detected target is defined as a medium target; and when the proportion is greater than the second threshold, the detected target is defined as a large target. For example, setting two preset thresholds of 10% and 30% respectively, the detected targets are divided into large, medium, and small targets using the preset thresholds. The number of large, medium, and small targets is recorded as s1, s2, and s3, respectively. The proportion is calculated using the following formula:

[0051] o1 = s1 / (s1 + s2 + s3)

[0052] o2 = s2 / (s1 + s2 + s3)

[0053] o3 = s3 / (s1 + s2 + s3)

[0054] Among them, o1, o2, and o3 represent the proportions of large, medium, and small targets to the total number of detected targets, respectively. In this embodiment of the invention, there are no restrictions on the setting of the preset threshold; it can be set by the designer according to requirements or based on actual usage.

[0055] In this embodiment of the invention, the proportion of targets detected in the model training set is determined based on the annotation information of the model training set. The confidence ratio and confidence loss weight value in the subsequent target detection model can be calculated according to the magnitude of the proportion, thereby achieving self-adjustment and improving the accuracy of target detection.

[0056] Step S103: Calculate the confidence ratio and confidence loss weight of the target detection model based on the ratio values, and complete the training of the target detection model.

[0057] In this embodiment of the invention, the confidence ratio and the confidence loss weight value are respectively the confidence ratio of the feature map in the object detection model and the confidence loss weight value of the loss function in the object detection model. It should be noted that the loss function includes confidence loss, class loss, and regression loss, which can be obtained by summing the confidence loss, class loss, and regression loss. Specifically, the confidence loss, class loss, and regression loss are multiplied by their respective weight values ​​and then added together to obtain the loss function. The confidence loss can be obtained by calculating the confidence ratio of the feature map in the object detection model. The feature map can be obtained through feature extraction. There is no limit to the number of feature maps; there can be one or more. For example, the model training set can be downsampled by 8, 16, and 32 times to obtain three feature maps: large, medium, and small.

[0058] In this embodiment of the invention, the confidence ratio and confidence loss weight value of the object detection model can be calculated based on the ratio values ​​to complete the training of the object detection model. It should be noted that the ratio values ​​can be set as the confidence ratio of the feature maps in the object detection model, and the sum of the ratio values ​​can be calculated to obtain the confidence loss weight value of the loss function when training the object detection model based on the model training set. Then, all confidence ratios and confidence loss weight values ​​can be calculated to obtain the confidence ratio and confidence loss weight values ​​for training the object detection model based on the image dataset.

[0059] In this embodiment of the invention, the confidence ratio and confidence loss weight value of the target detection model are calculated based on the ratio value, thereby realizing self-adjusting of the confidence ratio and confidence loss weight value, and further realizing a self-adjusting loss function, which improves the detection accuracy, increases the robustness of the model and the accuracy of detection.

[0060] Based on the above embodiments, in this embodiment of the invention, the confidence ratio and confidence loss weight value of the target detection model can be calculated according to the proportion value of the detected target, so that the confidence ratio and confidence loss weight value are no longer fixed and can be self-adjusted according to the proportion value of the detected target, thereby improving the detection accuracy, increasing the robustness and detection accuracy of the model, and this invention operates in the training stage without changing the inference stage of the target detection model, and does not add any extra burden to the inference of the target detection model.

[0061] Please refer to Figure 2 , Figure 2 Another object detection model training method according to an embodiment of the present invention is disclosed. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.

[0062] Step S201: Divide the image dataset to be trained to obtain different model training sets.

[0063] For details regarding step S201, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0064] Step S202: Determine the proportion of targets detected in the model training set based on the annotation information of the model training set.

[0065] For details regarding step S202, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0066] Step S203: Based on the ratio values, obtain the confidence ratio and confidence loss weight values ​​for training the object detection model using the model training set.

[0067] In this embodiment of the invention, the confidence ratio and confidence loss weight value of the target detection model trained using the model training set can be obtained based on the proportional values. Specifically, the proportional values ​​can be set as the confidence ratio of the feature maps in the target detection model calculated based on the model training set, and the confidence loss weight value of the loss function in the target detection model can be calculated based on the proportional values. For example, if the model training set is downsampled by 8, 16, and 32 times to obtain three feature maps: large, medium, and small, there are o1, o2, and o3, which are the proportions of the number of large, medium, and small targets to the total number of detected targets, respectively. The proportion of o1 can be set as the confidence ratio of the small feature map, the proportion of o2 as the confidence ratio of the medium feature map, and the proportion of o3 as the confidence ratio of the large feature map. The confidence loss weight value of the loss function in the target detection model can be obtained by calculating o1, o2, and o3 using the following formula:

[0068] lw=m+t1*o1+t2*o2+t3*o3

[0069] Where lw is the confidence loss weight value, m is the initial value, t1, t2, and t3 are three training parameters, and o1, o2, and o3 are the proportions of the number of large, medium, and small targets to the total number of detected targets.

[0070] In this embodiment of the invention, the confidence ratio and confidence loss weight can be adaptively adjusted according to the proportion of the detected targets, which increases the robustness and detection accuracy of the target detection model. Furthermore, by adaptively adjusting the confidence loss weight and confidence ratio, the confidence weight and confidence ratio are no longer fixed and can be self-adjusted according to the number of detected targets, thereby improving the detection accuracy.

[0071] Step S204: Calculate the confidence ratio and confidence loss weight value to obtain the confidence ratio and confidence loss weight value of the object detection model, and complete the training of the object detection model.

[0072] In this embodiment of the invention, the confidence ratio and confidence loss weight values ​​can be statistically analyzed to obtain the confidence ratio and confidence loss weight values ​​of the target detection model. It should be noted that in this embodiment, the image dataset can be divided into multiple model training sets. Based on the proportion of various detection targets in each model training set, the corresponding confidence ratio and confidence loss weight values ​​for training the target detection model using each model training set can be obtained. Then, all confidence ratios and confidence loss weight values ​​are calculated, and their mean and variance are obtained respectively. Based on the mean and variance, the confidence ratio and confidence loss weight values ​​for training the target detection model using the image dataset are obtained. Specifically, the mean and variance of all confidence ratios can be calculated using the following formula to obtain the confidence ratio of the feature maps during the training of the target detection model based on the image dataset:

[0073] O1=ua*aa

[0074] O2 = ub * ab

[0075] O3=uc*ac

[0076] Where O1, O2, and O3 are the confidence ratios of the three types of feature maps in the object detection model calculated based on the image dataset, ua, ub, and uc represent the mean confidence ratios of the three types of feature maps in all training of the object detection model based on the model training set, and aa, ab, and ac represent the variances of the confidence ratios of the three types of feature maps in training the object detection model based on the model training set.

[0077] Specifically, the confidence loss weight values ​​for training the object detection model based on the image dataset can be obtained using the formula based on the mean and variance of the confidence loss weight values. The formula is as follows:

[0078] Lw=uw*aw

[0079] Where Lw is the confidence loss weight value for training the object detection model based on the image dataset, and uw and aw represent the mean and variance of the confidence loss weight values ​​for training the object detection model based on the model training set, respectively.

[0080] Furthermore, in this embodiment of the invention, the object detection model can be trained multiple times using an image dataset. Since the image dataset is divided differently in each training round, different confidence ratios and confidence loss weights can be obtained for training the object detection model based on the image dataset. To improve accuracy, all confidence ratios and confidence loss weights for training the object detection model based on the image dataset can be statistically analyzed to obtain the confidence ratio and confidence loss weights of the object detection model, thus completing the training of the object detection model. Specifically, the exponential moving average method can be used to statistically analyze the confidence ratio and confidence loss weights for training the object detection model multiple times using the image dataset, thus obtaining the confidence ratio and confidence loss weights of the object detection model, and completing the training of the object detection model. The exponential moving average method uses the predicted values ​​from previous training rounds, applies different weights, and calculates an exponential moving average, which is then used as the predicted value for the next training round. This method can enhance the correlation of data in each training round. For example, using the formula for exponential moving average, the confidence ratio and confidence loss weight values ​​for all image datasets can be calculated as follows:

[0081] vt=βnvt-n+(1-β)(βn-1γ n -n+1+….β0γ n )

[0082] Where vt represents the confidence loss weight and confidence ratio for multiple rounds of training of the object detection model based on the nth image dataset, β is the exponential moving average coefficient, and γ is the weight of the confidence loss. n Let n be the confidence loss weights and confidence ratios used to train the object detection model based on n image datasets, where n is the number of all image datasets. Starting from n+1 image datasets, the values ​​of the confidence loss weights and confidence ratios in the object detection model begin to stabilize and remain unchanged, thus completing the training of the object detection model.

[0083] In this embodiment of the invention, the exponential moving average method is used to determine the final confidence loss weight value and confidence ratio to complete the training of the target detection model. This method can improve the training speed of the model while ensuring the detection accuracy of the model after training.

[0084] Based on the above embodiments, this invention provides a target detection model training method. The method calculates the confidence ratio and confidence loss weight value of the target detection model based on the proportion of detected targets, making the confidence ratio and confidence loss weight value no longer fixed. These values ​​can self-adjust based on the proportion of detected targets, thereby improving detection accuracy, increasing the model's robustness and detection precision. Furthermore, this invention operates during the training phase without altering the inference phase of the target detection model, and does not add any extra burden to the inference process.

[0085] The above process is illustrated with a specific example below.

[0086] 1. Calculate the area of ​​all targets within the current batch, and then calculate the number of large, medium, and small targets (s1, s2, s3) based on their areas. The definitions for large, medium, and small targets are as follows: small targets have an area value less than a first threshold in the proportion of their area in the entire image; large targets have an area value greater than a second threshold; and medium targets have an area value between the first and second thresholds. The confidence ratios (o1, o2, o3) of the three feature maps within the current batch are obtained using o1 = s1 / (s1+s2+s3), o2 = s2 / (s1+s2+s3), and o3 = s3 / (s1+s2+s3). It should be noted that a batch is a small, randomly selected training set for the model during the training process.

[0087] 2. Based on the confidence ratios o1, o2, and o3, the weight value lw of the confidence loss for the current batch is calculated using lw = m + t1*o1 + t2*o2 + t3*o3, where m is the initial value and t1, t2, and t3 are three training parameters.

[0088] 3. After one epoch of training is completed, there are n batches. Let the confidence ratios of each batch calculated previously be o1i, o2i, o3i, (i = 1, 2, 3…n). Then, the confidence weight ratios of the three feature maps in the current epoch can be calculated using O1 = ua * aa, O2 = ub * ab, and O3 = uc * ac, denoted as O1, O2, and O3, respectively. Here, ua, ub, and uc represent the mean confidence ratios of the feature maps in all batches of the current epoch, and aa, ab, and ac represent the variances of the confidence ratios of all batches of the current epoch. The confidence loss weights of the three feature maps in the current epoch can be calculated using Lw = uw * aw, denoted as Lw, where uw and aw represent the mean and variance of the confidence loss weights of all batches in the current epoch, respectively. It should be noted that an epoch can be used to represent the training process of traversing all the training sets of the model once. An epoch can contain all the training sets, which are image datasets consisting of n batches.

[0089] 4. Starting from the second epoch, an exponential moving average is used to perform statistical analysis to obtain the confidence loss weight value and confidence ratio of the nth epoch. Starting from the (n+1)th epoch, the confidence loss weight and confidence ratio of the nth epoch are used to filter targets based on the confidence loss weight and confidence ratio, thus completing the training of the target detection model.

[0090] In this embodiment of the invention, the confidence ratio and confidence loss weight value of the target detection model can be calculated based on the proportion of the detected target. This makes the confidence ratio and confidence loss weight value no longer fixed and can be self-adjusted according to the proportion of the detected target, thereby improving the detection accuracy, increasing the robustness and detection accuracy of the model. Furthermore, this invention operates in the training phase and does not change the inference phase of the target detection model, nor does it add any extra burden to the inference of the target detection model.

[0091] The following describes a target detection model training device and computer equipment provided by an embodiment of the present invention. The target detection model training device and computer equipment described below can be referred to in correspondence with the target detection model training method described above.

[0092] Please refer to Figure 3 , Figure 3 This is a structural block diagram of a target detection model training device provided in an embodiment of the present invention. The device may include:

[0093] The dataset partitioning module 10 is used to partition the image dataset to be trained to obtain different model training sets;

[0094] The ratio calculation module 11 is used to determine the ratio of the detected targets in the model training set based on the annotation information of the model training set.

[0095] The calculation module 12 is used to calculate the confidence ratio and confidence loss weight value of the target detection model based on the ratio value, and to complete the training of the target detection model.

[0096] Based on the above embodiments, the ratio calculation module 11 may include:

[0097] The category unit is used to determine the category attribute of the detected target in the model training set based on the annotation information of the model training set;

[0098] The proportion calculation unit is used to determine, based on the category attribute, the proportion of the number of the detected target corresponding to the category attribute to the total number of all detected targets.

[0099] Based on any of the above embodiments, the category unit may include:

[0100] The judgment sub-unit is used to determine the area of ​​the detected target in the model training set based on the annotation information of the model training set;

[0101] The sub-unit is used to classify each of the detected targets according to the area to obtain the corresponding category attribute.

[0102] In this embodiment of the invention, the proportion of the area of ​​the detected target to the area of ​​its corresponding image can be determined first. Then, based on the proportion, each detected target is classified to obtain its corresponding category attribute. It should be noted that when the proportion is less than a preset threshold, the detected target can be defined as a small target; when the proportion is greater than the preset threshold, the detected target can be defined as a large target. There is no limit to the number of preset thresholds; two preset thresholds can be set as a first threshold and a second threshold. When the proportion is less than the first threshold, the detected target is defined as a small target; when the proportion is greater than or equal to the first threshold and less than or equal to the second threshold, the detected target is defined as a medium target; and when the proportion of the area is greater than the second threshold, the detected target is defined as a large target.

[0103] Based on any of the above embodiments, the computing module 12 may include:

[0104] The calculation unit is used to obtain the confidence ratio and confidence loss weight value of training the target detection model using the model training set, based on the ratio value.

[0105] The statistical unit is used to calculate the confidence ratio and the confidence loss weight value to obtain the confidence ratio and confidence loss weight value of the target detection model, thereby completing the training of the target detection model.

[0106] Based on any of the above embodiments, the computing unit may include:

[0107] The first calculation subunit is used to calculate all the confidence ratios and confidence loss weights to obtain the mean and variance of the confidence ratios and confidence loss weights.

[0108] The second calculation subunit is used to obtain the confidence ratio and confidence loss weight value for training the target detection model using the image dataset, based on the mean and the variance.

[0109] Based on any of the above embodiments, the calculation module 12 may further include:

[0110] The statistical subunit is used to use the exponential moving average method to calculate the confidence ratio and confidence loss weight value of the target detection model trained on the image dataset, thereby obtaining the confidence ratio and confidence loss weight value of the target detection model and completing the training of the target detection model.

[0111] In this embodiment of the invention, the confidence ratio and confidence loss weight values ​​of the target detection model are calculated by the ratio calculation module 11 and the calculation module 12, so that the confidence ratio and confidence loss weight values ​​are no longer fixed and can be self-adjusted according to the ratio value of the detected target, thereby improving the detection accuracy, increasing the robustness and detection accuracy of the model. Furthermore, this invention operates in the training stage and does not change the inference stage of the target detection model, nor does it add any extra burden to the inference of the target detection model.

[0112] Please refer to Figure 4 , Figure 4 This is a structural block diagram of a computer device provided in an embodiment of the present invention. The computer device includes:

[0113] Memory 10 is used to store computer programs;

[0114] The processor 20 is used to execute the computer program to implement the above-described target detection model training method.

[0115] like Figure 4 The diagram shown is a structural schematic of a computer device, which may include: a memory 10, a processor 20, a communication interface 31, an input / output interface 32, and a communication bus 33.

[0116] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the memory 10 may store programs for implementing the following functions:

[0117] Divide the image dataset to be trained to obtain different model training sets;

[0118] Based on the annotation information of the model training set, determine the proportion of targets detected in the model training set;

[0119] Based on the proportional values, the confidence ratio and confidence loss weight values ​​of the object detection model are calculated, thus completing the training of the object detection model.

[0120] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.

[0121] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.

[0122] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.

[0123] The communication interface 31 can be an interface for connecting with other devices or systems.

[0124] The input / output interface 32 can be an interface used to acquire external input data or output data to the outside world.

[0125] Of course, it should be noted that, Figure 4 The structure shown does not constitute a limitation on the computer device in the embodiments of this application. In practical applications, the computer device may include more than Figure 4 More or fewer components as shown, or combinations of certain components.

[0126] In this embodiment of the invention, the confidence ratio and confidence loss weight value of the target detection model can be calculated based on the proportion of the detected target. This makes the confidence ratio and confidence loss weight value no longer fixed and can be self-adjusted according to the proportion of the detected target, thereby improving the detection accuracy, increasing the robustness and detection accuracy of the model. Furthermore, this invention operates in the training phase and does not change the inference phase of the target detection model, nor does it add any extra burden to the inference of the target detection model.

[0127] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these instructions are loaded and executed by a processor, they divide the image dataset to be trained into different model training sets; determine the proportion of detected targets in the model training sets based on the annotation information of the training sets; and calculate the confidence ratio and confidence loss weight of the target detection model based on the proportion, thus completing the training of the target detection model. In this invention, the confidence ratio and confidence loss weight of the target detection model can be calculated based on the proportion of detected targets, making these values ​​no longer fixed. They can self-adjust based on the proportion of detected targets, thereby improving detection accuracy, increasing model robustness and detection accuracy. Furthermore, this invention operates only during the training phase and does not alter the inference phase of the target detection model, thus not adding any extra burden to the inference process.

[0128] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0129] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0130] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0131] The above provides a detailed description of the target detection model training method, apparatus, computer equipment, and medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

Claims

1. A method for training an object detection model, characterized in that, include: Divide the image dataset to be trained to obtain different model training sets; Based on the annotation information of the model training set, determine the proportion of targets detected in the model training set; Based on the stated proportion, the confidence ratio and confidence loss weight value of the target detection model are calculated, thus completing the training of the target detection model; the confidence ratio is the confidence ratio of the feature map in the target detection model; the confidence loss weight value is the confidence loss weight value of the loss function in the target detection model; the confidence loss is obtained by calculating the confidence ratio of the feature map in the target detection model. Determining the proportion of detected targets in the model training set based on the annotation information of the model training set includes: Based on the annotation information of the model training set, determine the category attributes of the detected targets in the model training set; Based on the category attribute, determine the proportion of the number of the detected targets corresponding to the category attribute to the total number of all detected targets; Determining the category attributes of the detected targets in the model training set based on the annotation information of the model training set includes: Based on the annotation information of the model training set, determine the area of ​​the detected target in the model training set; Based on the area, each of the detected targets is classified into categories to obtain the corresponding category attributes; The step of classifying each detected target according to its area to obtain the corresponding category attribute includes: Determine the proportion of the area of ​​the detected target to the area of ​​the image it occupies; Based on the stated ratio, each of the detected targets is categorized to obtain the corresponding category attribute; The formula for calculating the confidence loss weight value is as follows: ; in, t1 represents the confidence loss weight value, m is the initial value, t1, t2, and t3 are three training parameters, o1 represents the confidence ratio of the small feature map, o2 represents the confidence ratio of the medium feature map, and o3 represents the confidence ratio of the large feature map.

2. The target detection model training method as described in claim 1, characterized in that, The step of calculating the confidence ratio and confidence loss weight value of the target detection model based on the ratio value, and completing the training of the target detection model, includes: Based on the stated ratio, the confidence ratio and confidence loss weight values ​​for training the target detection model using the model training set are obtained. The confidence ratio and the confidence loss weight value are statistically analyzed to obtain the confidence ratio and confidence loss weight value of the target detection model, thus completing the training of the target detection model.

3. The target detection model training method as described in claim 2, characterized in that, The process of statistically analyzing the confidence ratio and the confidence loss weight value to obtain the confidence ratio and confidence loss weight value of the target detection model, thereby completing the training of the target detection model, includes: Calculate all the confidence ratios and confidence loss weights to obtain the mean and variance of the confidence ratios and confidence loss weights; Based on the mean and the variance, the confidence ratio and confidence loss weight values ​​for training the target detection model using the image dataset are obtained.

4. The target detection model training method as described in claim 1, characterized in that, The calculation of the confidence ratio and confidence loss weight values ​​of the target detection model to complete the training of the target detection model also includes: Using the exponential moving average method, the confidence ratio and confidence loss weight values ​​of the target detection model trained on the image dataset are statistically analyzed to obtain the confidence ratio and confidence loss weight values ​​of the target detection model, thus completing the training of the target detection model.

5. A target detection model training device, characterized in that, include: The dataset partitioning module is used to partition the image dataset to be trained into different model training sets; The proportion calculation module is used to determine the proportion of the detected targets in the model training set based on the annotation information of the model training set. The calculation module is used to calculate the confidence ratio and confidence loss weight value of the target detection model based on the ratio value, and to complete the training of the target detection model; the confidence ratio is the confidence ratio of the feature map in the target detection model; the confidence loss weight value is the confidence loss weight value of the loss function in the target detection model; the confidence loss is obtained by calculating the confidence ratio of the feature map in the target detection model. The ratio calculation module specifically includes: The category unit is used to determine the category attribute of the detected target in the model training set based on the annotation information of the model training set; A ratio calculation unit is used to determine, based on the category attribute, the ratio of the number of the detected target corresponding to the category attribute to the total number of all detected targets; The category units specifically include: The judgment sub-unit is used to determine the area of ​​the detected target in the model training set based on the annotation information of the model training set; The sub-unit is used to classify each of the detected targets according to the area to obtain the corresponding category attribute; The segmentation subunit is specifically used to determine the proportion of the area of ​​the detected target to the area of ​​the image in which it is located, and to classify each detected target according to the proportion to obtain the corresponding category attribute. The formula for calculating the confidence loss weight value is as follows: ; in, t1 represents the confidence loss weight value, m is the initial value, t1, t2, and t3 are three training parameters, o1 represents the confidence ratio of the small feature map, o2 represents the confidence ratio of the medium feature map, and o3 represents the confidence ratio of the large feature map.

6. A computer device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the target detection model training method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the steps of the target detection model training method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Data training method and device, terminal equipment and computer readable storage medium

    CN111310775A