Model generation method, target detection method, device, electronic device and medium
By using the detection results of the teacher network as supervision information, the student network is trained and the number of training samples is increased, the problem of poor generalization performance of existing object detection models is solved, and better generalization performance and accuracy and speed balance are achieved.
Patent Information
- Application Number
- CN202011391459.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-03
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2040-12-03
AI Technical Summary
The existing object detection model has poor generalization performance and is difficult to perform well in untrained application scenarios.
Through the teacher network obtained by training based on multiple groups of teacher training samples, the student network is trained, and the detection results of the teacher network are used as supervision information to increase the number of training samples of the student network during the training process to improve generalization performance.
Without the need for additional manual annotation costs, the generalization performance of the object detection model is significantly improved and a good balance of accuracy and speed is achieved.
Smart Images

Figure CN112257815B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer application technology, and in particular to a model generation method, a target detection method, a device, an electronic device, and a medium. Background Art
[0002] With the popularization of artificial intelligence technology, computer vision technology based on deep learning is becoming more and more popular. Among them, target detection, as the basic research of computer vision technology, is of self-evident importance.
[0003] Specifically, object detection is a pre-step for visual analysis. For example, face recognition, pedestrian re-identification and other applications require the detection of faces or bodies before subsequent recognition of the detected faces or bodies. Obviously, object detection is an extremely important part of the implementation of artificial intelligence in the industrial sector.
[0004] However, the existing technology has the following technical problems: the generalization performance of the existing target detection model is poor. Summary of the invention
[0005] Embodiments of the present invention provide a model generation method, a model generation method, an apparatus, an electronic device, and a medium to achieve the effect of improving the generalization performance of a target detection model.
[0006] In a first aspect, an embodiment of the present invention provides a model generation method, which may include:
[0007] The original detection model is trained based on multiple groups of teacher training samples including the first sample image and sample annotation results of known targets in the first sample image to obtain a teacher network;
[0008] Using the first sample image and a first detection result obtained after the first sample image is input into the teacher network as a first training sample, and using the second sample image and a second detection result obtained after the second sample image is input into the teacher network as a second training sample;
[0009] A student network having the same network type as the teacher network is trained based on multiple groups of first training samples and multiple groups of second training samples to generate a target detection model.
[0010] In a second aspect, an embodiment of the present invention further provides a target detection method, which may include:
[0011] Acquire an image to be detected and a target detection model generated by the model generation method provided by any embodiment of the present invention;
[0012] The image to be detected is input into the target detection model, and the target detection result of the target to be detected in the image to be detected is obtained according to the output result of the target detection model.
[0013] In a third aspect, an embodiment of the present invention further provides a model generation device, which may include:
[0014] A network training module, used for training the original detection model based on multiple groups of teacher training samples including the first sample image and sample annotation results of known targets in the first sample image to obtain a teacher network;
[0015] a sample acquisition module, configured to use a first sample image and a first detection result obtained after the first sample image is input into the teacher network as a first training sample, and use a second sample image and a second detection result obtained after the second sample image is input into the teacher network as a second training sample;
[0016] The model generation module is used to train a student network having the same network type as the teacher network based on multiple groups of first training samples and multiple groups of second training samples to generate a target detection model.
[0017] In a fourth aspect, an embodiment of the present invention further provides a target detection device, which may include:
[0018] A model acquisition module, used to acquire a target detection model generated by the image to be detected according to the model generation method provided by any embodiment of the present invention;
[0019] The target detection module is used to input the image to be detected into the target detection model, and obtain the target detection result of the target to be detected in the image to be detected according to the output result of the target detection model.
[0020] In a fifth aspect, an embodiment of the present invention further provides an electronic device, which may include:
[0021] one or more processors;
[0022] A memory for storing one or more programs;
[0023] When one or more programs are executed by one or more processors, the one or more processors implement the model generation method or target detection method provided by any embodiment of the present invention.
[0024] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the model generation method or target detection method provided by any embodiment of the present invention.
[0025] The technical solution of the embodiment of the present invention is to obtain a teacher network after training the original detection model based on multiple groups of teacher training samples, each group of teacher training samples includes a first sample image and sample annotation results of known targets in the first sample image. Since the teacher network is usually a large and deep neural network, it can obtain good detection results on both the trained first sample image and the untrained second sample image, and the detection result can be used as supervision information for the subsequent student network in the training process; accordingly, the first detection result obtained after the first sample image is input into the teacher network and the first sample image are used as the first training sample, and the second detection result obtained after the second sample image is input into the teacher network and the second sample image are used as the second training sample, and based on the multiple groups of first training samples and the multiple groups of second training samples, the student network with the same network type as the teacher network is trained to generate a target detection model. The above technical solution uses the detection results detected by the teacher network from sample images in different application scenarios as supervision information to supervise the training process of the student network. It achieves the effect of improving the generalization performance of the target detection model generated after the training is completed by increasing the number of training samples involved in the training process of the student network without increasing the cost of manual labeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a flow chart of a model generation method in Embodiment 1 of the present invention;
[0027] Figure 2 is a flow chart of a model generation method in Embodiment 2 of the present invention;
[0028] Figure 3 is a flow chart of a model generation method in Embodiment 3 of the present invention;
[0029] Figure 4a It is a structural diagram of CenterNet in a model generation method in Embodiment 3 of the present invention;
[0030] Figure 4b is a flowchart of an optional example of a model generation method in Embodiment 3 of the present invention;
[0031] Figure 5 is a flow chart of a target detection method in Embodiment 4 of the present invention;
[0032] Figure 6 is a structural block diagram of a model generation device in Embodiment 5 of the present invention;
[0033] Figure 7 is a structural block diagram of a target detection device in Embodiment 6 of the present invention;
[0034] Figure 8 It is a structural schematic diagram of an electronic device in Embodiment 7 of the present invention. DETAILED DESCRIPTION
[0035] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It is also necessary to explain that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0036] Before introducing the embodiment of the present invention, the application scenario of the embodiment of the present invention is first exemplified: the existing target detection models (i.e., detectors) are mainly divided into three categories: two-stage detectors (such as the Faster RCNN series), one-stage detectors (such as the SSD, YOLO series), and anchor-free detectors (such as Centernet, Fcos, etc.). In particular, accuracy, speed, and generalization performance are three indicators for evaluating the detection effect of the detector, among which accuracy represents the accuracy of the detector on the test set, and the higher the accuracy, the better the customer satisfaction; speed represents the reasoning time of the detector, and the faster the speed, the better the machine cost can be saved; and generalization performance represents the accuracy performance of the detector in untrained application scenarios.
[0037] It should be noted that the current detectors are all target detection models obtained after training on training samples containing sample annotation results. This results in the detector having good detection performance only in the application scenarios for which it has been trained, but poor detection performance in other application scenarios. Therefore, in order to improve the generalization performance of the detector, one option is to manually annotate sample images of multiple application scenarios and train the model based on such sample images. Obviously, this solution will bring about the problem of high annotation costs due to the consumption of a large amount of human resources.
[0038] In order to generate a target detection model with strong generalization performance and without significantly increasing the cost of manual labeling during the model training process, the inventors have conducted a thorough study of the generation process of existing target detection models, analyzed and summarized the shortcomings therein, and on this basis proposed the model generation method described in the following embodiments. The specific implementation process of the method is described as follows.
[0039] Embodiment 1
[0040] Figure 1It is a flow chart of a model generation method provided in the first embodiment of the present invention. This embodiment can be applied to the case of improving the generalization performance of the target detection model, and is particularly applicable to the case of improving the generalization performance of the target detection model without increasing the cost of manual annotation. The method can be executed by the model generation device provided in the embodiment of the present invention, and the device can be implemented by software and / or hardware. The device can be integrated in an electronic device, and the electronic device can be various user terminals or servers.
[0041] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:
[0042] S110 , training the original detection model based on multiple groups of teacher training samples including the first sample image and sample annotation results of known targets in the first sample image to obtain a teacher network.
[0043] Among them, the original detection model can be an untrained deep learning model that can be used for visual detection. As mentioned above, it can be divided into three categories: one-stage, two-stage and anchor-free. The teacher training sample is a training sample including a first sample image and a sample annotation result of a known target in the first sample image. The sample annotation result can be the category probability and position information of the known target. The category probability can represent the probability that the known target is an object of a certain category, and the position information can represent the position coordinates of the known target in the first sample image. On this basis, the original detection model can be trained based on multiple groups of teacher training samples to obtain a teacher network that can be used for visual detection.
[0044] It should be noted that, usually, the teacher network can be a large and deep neural network, that is, the original detection model can be a large and deep neural network. Compared with the small and shallow student network, the teacher network has higher detection accuracy when performing visual detection, but its detection speed is unsatisfactory; of course, the student network's performance in detection accuracy is relatively ordinary, but its detection speed is better.
[0045] S120, using the first sample image and the first detection result obtained after the first sample image is input into the teacher network as the first training sample, and using the second sample image and the second detection result obtained after the second sample image is input into the teacher network as the second training sample.
[0046] The first sample image is input into the teacher network, and the first detection result is obtained according to the output result of the teacher network. Since the teacher network is a neural network trained in the application scenario where the first sample image is located, it can obtain a first detection result that is very similar to the sample annotation result. Therefore, the first sample image and the first detection result can be used as a set of first training samples.
[0047] In addition, the second sample image can be input into the teacher network, and the second detection result can be obtained according to the output result of the teacher network, and the second sample image and the second detection result can be used as a set of second training samples. It should be noted that although the teacher network is not trained in the application scenario where the second sample image is located, since the teacher network is usually a large and deep neural network, its performance in generalization performance is relatively good, so it is also possible to obtain a better second detection result in the application scenario where the second sample image is located. The second detection result is the detection result directly output by the teacher network, not the manually labeled sample annotation result. However, from the perspective of practical applications, the generalization performance of the teacher network still needs to be improved.
[0048] S130 , training a student network having the same network type as the teacher network based on the multiple groups of first training samples and the multiple groups of second training samples to generate a target detection model.
[0049] Among them, in order to obtain a target detection model with better generalization performance than the teacher network without increasing the cost of manual labeling, an embodiment of the present invention proposes a solution for training a student network with the same network type as the teacher network based on multiple groups of first training samples and multiple groups of second training samples, that is, using the detection results actually output by the teacher network to replace the manual labeling results often used in the model training process, and because the teacher network and the student network are neural networks with the same network type, this means that the detection results actually output by the teacher network and the prediction results actually output by the student network can correspond one to one, and at this time, the training process of the student network can be supervised by the actual output of the teacher network. Moreover, compared with the teacher network, the student network involves more training samples in application scenarios during the training process, which can significantly improve the generalization performance of the target detection model obtained after training.
[0050] On this basis, optionally, since the student network is a neural network of the same network type as the teacher network, both can be a certain type of neural network, for example, both can be a type of neural network under an anchor-free detector, such as centernet, Fcos, etc.; of course, both can also be a type of neural network under a one-stage detector or a two-stage detector, such as SSD, faster RCNN, etc. Under normal circumstances, the amount of computation of the student network can be less than that of the teacher network, which can be reflected in the fact that the number of convolution kernels of the student network is less than the number of convolution kernels of the teacher network, and the number of convolution kernels can also be understood as the number of layers of the convolution layer in the neural network; it can also be reflected in the fact that the number of channels of each convolution kernel of the student network is less than the number of channels of the corresponding convolution kernel of the teacher network (that is, the number of channels of the Nth convolution kernel in the student network is less than the number of channels of the convolution kernel corresponding to the Nth convolution kernel in the teacher network), and the number of channels of the convolution kernel can also be understood as the number of channels in the corresponding convolution layer, because each convolution layer has a multi-channel convolution kernel; etc., which are not specifically limited here.
[0051] The technical solution of the embodiment of the present invention is to obtain a teacher network after training the original detection model based on multiple groups of teacher training samples, each group of teacher training samples includes a first sample image and sample annotation results of known targets in the first sample image. Since the teacher network is usually a large and deep neural network, it can obtain good detection results on both the trained first sample image and the untrained second sample image, and the detection result can be used as supervision information for the subsequent student network in the training process; accordingly, the first detection result obtained after the first sample image is input into the teacher network and the first sample image are used as the first training sample, and the second detection result obtained after the second sample image is input into the teacher network and the second sample image are used as the second training sample, and based on the multiple groups of first training samples and the multiple groups of second training samples, the student network with the same network type as the teacher network is trained to generate a target detection model. The above technical solution uses the detection results detected by the teacher network from sample images in different application scenarios as supervision information to supervise the training process of the student network. It achieves the effect of improving the generalization performance of the target detection model generated after the training is completed by increasing the number of training samples involved in the training process of the student network without increasing the cost of manual labeling.
[0052] It should be noted that the target detection model generated by the model generation method described in the embodiment of the present invention, in addition to having a significant improvement in generalization performance, can also take into account both accuracy and speed. Specifically, on the one hand, because the student network is usually a small and shallow neural network, it has a strong advantage in detection speed. On the other hand, compared with the conventional training process, the student network involves more training samples in application scenarios during the training process, which can significantly improve the detection accuracy of the target detection model obtained after training; moreover, compared with the conventional training process using manually labeled sample annotation results as supervision information, because the teacher network and the student network are neural networks with the same network type, the two have a relatively similar network structure, which means that the actual output of the teacher network and the actual output of the student network are relatively similar. Then, when the model training is performed based on the detection results actually output by the teacher network as supervision information, the training process of the student network can be better guided, thereby further improving the detection accuracy of the target detection model obtained after training. Specifically,
[0053] In order to prove the effectiveness of the above technical solution, we will verify it with specific examples. Here, we take CenterNet, where the student network and the teacher network have different computational loads, as an example. Compared with other detectors, CenterNet has the advantages of simple output, fast speed, and accuracy that can meet business needs. As shown in Table 1, mAP is used to judge the experimental results. It should be noted that the higher the mAP on crowd human, the higher the accuracy of the network, and the higher the mAP on coco_person, the stronger the generalization performance of the network.
[0054] 1. First, based on the multiple groups of teacher training samples mentioned above, a model_s1 (a student network) is trained as a comparison network, that is, the conventional manual annotation method (labeled method) is used for training. The teacher training samples come from the training set on crowd human, as shown in Table 1. The mAP of the obtained model_s1 on the crowd human test set is 31.2, and the mAP on the coco_person test set with different application scenarios is 31.2.
[0055] 2. Use the same method as step 1 to train another model_t (a teacher network), that is, model_t is a neural network trained in a conventional labeled way. As shown in Table 1, its mAP on the crowd human test set is 35.1, and its mAP on the coco_person test set with different application scenarios is 35.7. It can be seen that although the training process of model_s1 and model_t is exactly the same, because the depth of the teacher network is greater than that of the student network, it has better network accuracy and generalization performance.
[0056] 3. The actual output of model_t on the crowd human+coco person training set is used as the supervision information (i.e., no arbitrary label is required). A model_s2 (a student network) is obtained by training on the crowd human+coco person training set. As shown in Table 1, the mAP of model_s2 on the crowd human test set is 34.1, which is improved in accuracy compared with the corresponding result of model_s1. Moreover, the mAP on the coco_person test set with a different application scenario is 36.3, which is improved in generalization performance compared with model_s1 and model_t. This proves that the target detection model generated by the model generation method according to the embodiment of the present invention has been significantly improved in generalization performance and accuracy.
[0057] Table 1 Comparison of experimental results
[0058] Neural Networks Crowd Human mAP coco_person mAP Training set Training Method Student network model_s1 31.2 31.2 Crowd Human With label Teacher network model_t 35.1 35.7 Crowd Human With label Student network model_s2 34.1 36.3 Crowd Human+coco_person No tags
[0059] Embodiment 2
[0060] Figure 2 It is a flow chart of a model generation method provided in the second embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, the student network with the same network type as the teacher network includes a target prediction module and a loss calculation module; for each group of first training samples, the student network with the same network type as the teacher network is trained based on multiple groups of first training samples, which may specifically include: inputting the first sample image into the target prediction module to obtain a first prediction result; inputting the first detection result and the first prediction result into the loss calculation module, and adjusting the network parameters in the target prediction module according to the output result of the loss calculation module. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0061] See also Figure 2 The method of this embodiment may specifically include the following steps:
[0062] S210 , training the original detection model based on multiple groups of teacher training samples including the first sample image and sample annotation results of known targets in the first sample image to obtain a teacher network.
[0063] S220, using the first sample image and the first detection result obtained after the first sample image is input into the teacher network as the first training sample, and using the second sample image and the second detection result obtained after the second sample image is input into the teacher network as the second training sample.
[0064] S230, obtaining a student network having the same network type as the teacher network, wherein the student network includes a target prediction module and a loss calculation module.
[0065] The target prediction module is used to predict the prediction result of the target to be predicted in the sample image according to the sample image input to the student network. In combination with the application scenarios that may be involved in the embodiments of the present invention, when the sample image is the first sample image, the prediction result is the first prediction result; when the sample image is the second sample image, the prediction result is the second prediction result.
[0066] The loss calculation module is used to input the prediction result and the detection result corresponding to the prediction result into a pre-constructed loss function, and output according to the output result of the loss function. In combination with the application scenarios that may be involved in the embodiments of the present invention, when the prediction result is the first prediction result, the corresponding detection result is the first detection result in the above step; when the prediction result is the second prediction result, the corresponding detection result is the second detection result described in the above step.
[0067] S240. For each group of first training samples, the first sample image is input into the target prediction module to obtain a first prediction result; the first detection result and the first prediction result are input into the loss calculation module, and the network parameters in the target prediction module are adjusted according to the output result of the loss calculation module.
[0068] S250. For each group of second training samples, the second sample image is input into the target prediction module to obtain a second prediction result; the second detection result and the second prediction result are input into the loss calculation module, and the network parameters in the target prediction module are adjusted according to the output result of the loss calculation module.
[0069] Among them, there is no specific limitation on the execution order of S240 and S250, and the two can be executed sequentially or simultaneously. That is, when the network parameters are adjusted based on the output results obtained according to S240 and the output results obtained according to S250, there is no specific limitation on the execution order of this adjustment process, and the two can be executed sequentially or simultaneously.
[0070] S260: Generate a target detection model according to the adjustment results of the network parameters.
[0071] According to the technical solution of the embodiment of the present invention, the student network includes a target prediction module and a loss calculation module. Taking the first training sample as an example, for each group of first training samples, the first sample image is first input into the target prediction module to obtain the first prediction result, and then the first detection result and the first prediction result are input into the loss calculation module, and the network parameters in the target prediction module are adjusted according to the output result of the loss calculation module, thereby achieving the effect of precise adjustment of the network parameters.
[0072] On this basis, an optional technical solution takes into account that in the target detection process, the center point, width, height and / or center point offset of the rectangular box can be made infinitely close to the center point, width, height and / or center point offset of the rectangular box where the actual target to be predicted is located by adjusting the network parameters. Accordingly, taking the first training sample as an example, the first detection result extracted based on the teacher network may include a center point detection feature map, a width and height detection feature map and / or a center point offset detection feature map; accordingly, the first prediction result extracted based on the target prediction module in the student network may include a center point prediction feature map, a width and height prediction feature map and / or a center point offset prediction feature map; accordingly, in order to perform targeted calculation of the loss values between the corresponding feature maps, the loss calculation module may include a center point loss calculation module, a width and height loss calculation module and / or a center point offset loss calculation module;
[0073] On this basis, the first detection result and the first prediction result are input into the loss calculation module, and the network parameters in the target prediction module are adjusted according to the output result of the loss calculation module, which may specifically include: inputting the center point detection feature map and the center point prediction feature map into the center point loss calculation module, inputting the width and height detection feature map and the width and height prediction feature map into the width and height loss calculation module, and / or inputting the center point offset detection feature map and the center point offset prediction feature map into the center point offset loss calculation module; determining the loss calculation result according to the output results of the center point loss calculation module, the width and height loss calculation module, and / or the center point offset loss calculation module, and the loss calculation result may be a calculation result obtained by processing the output results of each loss calculation module; adjusting the network parameters in the target prediction module according to the loss calculation result, that is, adjusting the network parameters through the loss calculation result calculated by multiple factors related to target detection, thereby further improving the adjustment accuracy of the network parameters.
[0074] On this basis, optionally, the above-mentioned center point loss calculation module may include a center point feature map activation unit for activating the center point detection feature map and the center point prediction feature map, and a center point loss calculation unit for calculating the loss value between the center point detection feature map and the center point prediction feature map after the activation process. In practical applications, optionally, in order to make the center point detection feature map and the center point prediction feature map as similar as possible, the root mean square error can be considered for loss calculation here.
[0075] For example, the center point detection feature map output by the teacher network (model_t) And the center point prediction feature map output by the student network (model_s) , where b is the number of sample images in one iteration, and c is the number of categories of the target to be predicted in the sample image. That is, the student network believes that each pixel in the sample image may represent the center point of an object, and the category prediction of the object can be achieved through the category prediction of the center point. Therefore, the probability value of the pixel belonging to each category can be expressed in the second dimension c. h and w are respectively (or ) in height and width. At this time, the ReLU function is used to and After activation, the following formula is used to calculate the activation and The loss value between , where n represents , which is the total number of pixels in the feature map. This formula can also be understood as a loss function constructed by calculating the loss value between the feature maps of two center points.
[0076]
[0077] Optionally, a width and height loss calculation module is used to calculate the loss value between the width and height detection feature map and the width and height prediction feature map based on the category probability feature map, wherein the category probability feature map is a feature map generated when the center point detection feature map takes the maximum value in the category probability dimension. According to the above description, there can be c values in the category probability dimension (i.e., the dimension represented by c), each of which can represent the possibility that the object where the center point is located belongs to a certain category. At this time, the maximum value in the category probability dimension can be retained and the remaining values can be deleted. The category probability feature map generated in this way can represent the probability corresponding to the most likely category of the center point.
[0078] For example, continue with the above example and detect the width and height feature map output by model_t And the width and height prediction feature map output by model_s , where 2 indicates that the width and height are predicted separately. According to the results of multiple experiments, the L1 norm is calculated. and The loss value between can adjust the network parameters with higher network accuracy. On this basis, the category probability feature map λ is also added As the coefficient of the loss function, λ is output in model_t The feature map obtained by taking the maximum value on the C dimension of (b, c, h, w) is converted to (b, 1, h, w) by taking the maximum value on the second dimension C. Then, the two identical feature maps of (b, 1, h, w) are concatenated into the feature map of (b, 2, h, w), thus obtaining the same It should be noted that "1" in (b, 1, h, w) means that there is only one value in the second dimension. In this case, the following formula can be used to calculate and The loss value between , where n represents , which is the total number of pixels in the feature map. This formula can also be understood as a loss function constructed by calculating the loss value between two width and height feature maps.
[0079]
[0080] Optionally, a center point offset loss calculation module is used to calculate the loss value between the center point offset detection feature map and the center point offset prediction feature map according to the category probability feature map. For each center point in the sample image, the center point offset is the offset data of the position information of the center point in the feature map after convolution and deconvolution relative to its position information in the sample image. For example, assuming that the size information (i.e., width*height) of the sample image is 500*500, and the size information of the feature map after convolution and deconvolution is 125*125, there is an offset when the pixel points on 125*125 are mapped back to 500*500, for example, 0 on 125*125 may be mapped back to 0, 1, 2, and 3 on 500*500.
[0081] For example, continuing with the above example, the calculation process of the loss value between two center point offset feature maps is similar to the calculation process of the loss value between two width and height feature maps. And the center point offset prediction feature map output by model_s , where b, h, and w have the same meanings as above, and 2 represents the offset of the predicted center point in the x and y directions respectively. At this time, the following formula can be used to calculate and The loss value between , where λ has the same meaning as above, and n represents , that is, the total number of pixels in the feature map. This formula can also be understood as a loss function constructed by calculating the loss value between the feature maps of the two center point offsets.
[0082]
[0083] Embodiment 3
[0084] Figure 3 It is a flow chart of a model generation method provided in the third embodiment of the present invention. This embodiment is optimized based on the technical solutions in the above-mentioned second embodiment. In this embodiment, optionally, adjusting the network parameters in the target prediction module according to the output result of the loss calculation module may specifically include: determining the loss coefficient according to the pre-output result and the loss value range, wherein the pre-output result is the output result of the loss calculation module after the student network is pre-trained for a preset number of times; adjusting the network parameters in the target prediction module according to the loss coefficient and the output result of the loss calculation module after the first detection result and the first prediction result are input into the loss calculation module. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0085] See also Figure 3 The method of this embodiment may specifically include the following steps:
[0086] S310 , training the original detection model based on multiple groups of teacher training samples including the first sample image and sample annotation results of known targets in the first sample image to obtain a teacher network.
[0087] S320, using the first sample image and the first detection result obtained after the first sample image is input into the teacher network as the first training sample, and using the second sample image and the second detection result obtained after the second sample image is input into the teacher network as the second training sample.
[0088] S330, obtaining a student network having the same network type as the teacher network, wherein the student network includes a target prediction module and a loss calculation module.
[0089] S340. For each group of first training samples, input the first sample image into the target prediction module to obtain a first prediction result; input the first detection result and the first prediction result into the loss calculation module.
[0090] S350, determining the loss coefficient according to the pre-output result and the loss value range, wherein the pre-output result is the output result of the loss calculation module after the student network is pre-trained for a preset number of times; adjusting the network parameters in the target prediction module according to the loss coefficient and the output result of the loss calculation module after the first detection result and the first prediction result are input into the loss calculation module.
[0091] Among them, considering that the conventional model training process uses manually annotated labels as supervision information, while the model training process in the embodiment of the present invention uses the detection results output by the teacher network as supervision information, such supervision information may make it difficult to control the output results of the loss calculation module in the student network within a reasonable range that allows the student network to converge quickly. To solve the above problem, the embodiment of the present invention proposes a technical solution to adjust the output results of the loss calculation module through the loss coefficient so that it is stabilized within a reasonable range. Specifically,
[0092] The loss value range is a value range of loss values that can make the student network converge quickly to achieve stable training. The loss value can be determined in a variety of ways. It can be directly set according to existing empirical values, or it can be determined according to the output results of the loss calculation module in the conventional model training process. Exemplarily, since the teacher training samples are training samples with manually annotated labels (i.e., sample annotation results), the student network can be trained based on multiple groups of teacher training samples, and the loss value range can be determined according to the output results of the loss calculation module at the end of the training.
[0093] The pre-output result is the output result of the loss calculation module after the student network is pre-trained for a preset number of times, which is the loss value actually output by the student network during the training process. It should be noted that the above-mentioned preset number of iterative training processes is not a training process for generating a target detection model, but a training process for determining the pre-output result, that is, the network parameters in the preset number of iterative training processes do not need to be retained, and the untrained student network can be retrained later. On this basis, optionally, the pre-output result can be pre-determined by the following steps: before training a student network with the same network type as the teacher network based on multiple groups of first training samples and multiple groups of second training samples, the student network is iteratively trained for a preset number of times based on multiple groups of first training samples and multiple groups of second training samples, and the output result of the loss calculation module at the end of the training is used as the pre-output result. That is, the formal training process and the pre-training process are both processes for training the student network based on multiple groups of first training samples and multiple groups of second training samples, and the pre-output result obtained thereby is also of reference significance in the formal training process.
[0094] Furthermore, after obtaining the pre-output result and the loss value range, the loss coefficient can be determined based on the two. The loss coefficient is a coefficient used to adjust the output result of the loss calculation module in the formal training process so that it can be summarized into the loss value range. Therefore, the network parameters in the target prediction module can be adjusted based on the loss coefficient and the output result of the loss calculation module after the first detection result and the first prediction result are input into the loss calculation module.
[0095] For example, continue with the second embodiment of the present invention. , and For example, if the student network is trained based on the teacher training sample, The loss value range is 0.5~2, then the loss calculation module can output the value of Sure , so that at this time falls within 0.5~2. Similarly, The loss coefficient and The loss coefficient The determination process of is similar and will not be repeated here. It should be noted that after the loss coefficient is determined, there is no need to retain the network parameters obtained in the pre-training process. At this time, the student network can be trained based on the calculation method of the re-determined loss value, such as the loss value of the entire student network. It can be calculated by the following formula:
[0096] .
[0097] S360. For each group of second training samples, the second sample image is input into the target prediction module to obtain a second prediction result; according to the loss coefficient and the output result of the loss calculation module after the second detection result and the second prediction result are input into the loss calculation module, the network parameters in the target prediction module are adjusted.
[0098] Among them, for each group of second training samples, the implementation process of adjusting the network parameters by means of the loss coefficient is similar to that of the first training samples, and will not be repeated here.
[0099] S370: Generate a target detection model according to the adjustment results of the network parameters.
[0100] The technical solution of the embodiment of the present invention, taking the first training sample as an example, adjusts the output result of the loss calculation module during the formal training process by determining the loss coefficient based on the pre-output result and the loss value range, so as to control the regulated output result within a reasonable range (i.e., the loss value range). Then, the network parameters in the target prediction module are adjusted based on the regulated output result, thereby achieving the effect of rapid convergence of the student network during the training process.
[0101] In order to better understand the specific implementation process of the above steps, the model generation method of this embodiment is exemplarily described below with reference to specific examples. Figure 4a The Centernet network shown has certain advantages in speed. Although its accuracy will be slightly reduced, it can achieve a good balance between accuracy and speed. Moreover, because its output is simple, it is very suitable for direct reuse of distillation technology. Among them, guiding the training process of the student network through the teacher network is an application of distillation technology. However, the distillation technology involved in the embodiment of the present invention is closely integrated with the application scenarios that may be involved in the embodiment of the present invention and is essentially different from the existing distillation technology. Its implementation process is described as follows.
[0102] To simplify the description, A is used to represent the first training sample and B is used to represent the second training sample. Figure 4b As shown, the untrained Centernet is trained based on the teacher training sample to obtain model_t, the detection results detected by model_t from the first sample image and the second sample image constitute A and B, and the model_s whose network structure is Centernet is trained based on A and B. It should be noted that a loss function needs to be constructed during the model training process. In the embodiment of the present invention, a loss function is constructed based on the detection results output by model_t and the prediction results output by model_s. Figure 4a It can be seen that the target prediction module in model_s can output the following three parts: the center point prediction feature map of the rectangular box where the target to be detected is located, the width and height prediction feature map, and the center point offset prediction feature map. For this reason, the following three loss functions can be constructed accordingly in combination with the detection feature map output by model_t. Their specific meanings have been introduced in detail above and will not be repeated here:
[0103]
[0104]
[0105]
[0106] At this point, the loss function of the entire model_s can be , where the loss coefficient = = = 1. Furthermore, in order to ensure the stability of the model_s training process, model_s is first trained based on the teacher training network, and then , and The calculation results of A and B are used to determine the respective loss value ranges; then, after 200 iterations of training of the untrained model_s based on A and B, , and The calculation results of are used as their respective pre-output results, and then the respective loss coefficients are re-determined according to the pre-output results, and the re-determined results are updated ; Finally, the untrained model_s is iteratively trained again based on A and B to generate a target detection model.
[0107] Embodiment 4
[0108] Figure 5 It is a flow chart of a target detection method provided in Embodiment 4 of the present invention. This embodiment can be applied to the case where a target detection model generated based on the method described in any of the above embodiments is used to detect a target to be detected in a detected image. The method can be executed by a target detection device provided in an embodiment of the present invention, which can be implemented by software and / or hardware, and the device can be integrated on an electronic device, which can be various user terminals or servers.
[0109] See also Figure 5 The method of this embodiment may specifically include the following steps:
[0110] S410, obtaining an image to be detected and a target detection model generated by the model generation method provided by any embodiment of the present invention.
[0111] Among them, the image to be detected can be an image in any application scenario, and the application scenario in which it is located can be the same as the application scenario in which the first sample image or the second sample image is located, or it can be different from the application scenario in which the two are located. This is because the target detection model generated based on any of the above embodiments has good generalization performance, and can still obtain good detection effects even in those untrained application scenarios. The target detection model can be a deep learning model that can be used for detection generated according to the method described in any of the above embodiments. For example, the target detection model can be an anchor-free detector, such as Centernet.
[0112] S420: input the image to be detected into the target detection model, and obtain the target detection result of the target to be detected in the image to be detected according to the output result of the target detection model.
[0113] Among them, the target detection result can be the category probability and position information of the target to be detected. Specifically, the category probability can indicate the probability that the target to be detected is an object of a certain category, and the position information can indicate the position coordinates of the target to be detected in the image to be detected.
[0114] According to the technical solution of the embodiment of the present invention, after the image to be detected is input into the generated target detection model, target detection can be performed on the image to be detected based on the target detection model. Since the target detection model is a deep learning model with good generalization performance, this means that regardless of whether the application scenario of the image to be detected is a trained application scenario, the target detection model can have good detection accuracy on the image to be detected.
[0115] Embodiment 5
[0116] Figure 6 This is a structural block diagram of a model generation device provided in Embodiment 5 of the present invention, and the device is used to execute the model generation method provided in any of the above embodiments. The device and the model generation method of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiment of the model generation device can refer to the embodiment of the above model generation method. Figure 6 The device may specifically include: a network training module 510, a sample acquisition module 520 and a model generation module 530. Among them,
[0117] A network training module 510 is used to train the original detection model based on multiple groups of teacher training samples including the first sample image and sample annotation results of known targets in the first sample image to obtain a teacher network;
[0118] a sample acquisition module 520, configured to use the first sample image and the first detection result obtained after the first sample image is input into the teacher network as the first training sample, and use the second sample image and the second detection result obtained after the second sample image is input into the teacher network as the second training sample;
[0119] The model generation module 530 is used to train a student network having the same network type as the teacher network based on multiple groups of first training samples and multiple groups of second training samples to generate a target detection model.
[0120] Optionally, the student network having the same network type as the teacher network may include a target prediction module and a loss calculation module; the model generation module 530 may specifically include:
[0121] A prediction result obtaining submodule, used for inputting the first sample image into the target prediction module to obtain a first prediction result;
[0122] The network parameter adjustment submodule is used to input the first detection result and the first prediction result into the loss calculation module, and adjust the network parameters in the target prediction module according to the output result of the loss calculation module.
[0123] On this basis, optionally, the first detection result includes a center point detection feature map, a width and height detection feature map and / or a center point offset detection feature map; correspondingly, the first prediction result includes a center point prediction feature map, a width and height prediction feature map and / or a center point offset prediction feature map; correspondingly, the loss calculation module includes a center point loss calculation module, a width and height loss calculation module and / or a center point offset loss calculation module;
[0124] The network parameter adjustment submodule can be used for:
[0125] Inputting the center point detection feature map and the center point prediction feature map into the center point loss calculation module, inputting the width and height detection feature map and the width and height prediction feature map into the width and height loss calculation module, and / or inputting the center point offset detection feature map and the center point offset prediction feature map into the center point offset loss calculation module;
[0126] Determine the loss calculation result according to the output results of the center point loss calculation module, the width and height loss calculation module, and / or the center point offset loss calculation module;
[0127] The network parameters in the target prediction module are adjusted according to the loss calculation results.
[0128] On this basis, optionally, the center point loss calculation module includes a center point feature map activation unit for activating the center point detection feature map and the center point prediction feature map, and a center point loss calculation unit for calculating the loss value between the center point detection feature map and the center point prediction feature map after the activation process; and / or,
[0129] A width and height loss calculation module, used to calculate the loss value between the width and height detection feature map and the width and height prediction feature map according to the category probability feature map, wherein the category probability feature map is a feature map generated when the center point detection feature map takes the maximum value in the category probability dimension; and / or,
[0130] The center point offset loss calculation module is used to calculate the loss value between the center point offset detection feature map and the center point offset prediction feature map according to the category probability feature map.
[0131] Optionally, the network parameter adjustment submodule may specifically include:
[0132] A loss coefficient determination unit, used to determine the loss coefficient according to a pre-output result and a loss value range, wherein the pre-output result is an output result of the loss calculation module after pre-training the student network for a preset number of times;
[0133] The network parameter adjustment unit is used to adjust the network parameters in the target prediction module according to the loss coefficient and the output result of the loss calculation module after the first detection result and the first prediction result are input into the loss calculation module.
[0134] Optionally, based on the above device, the device may further include:
[0135] The pre-output result determination module is used to perform a preset number of iterative training on the student network based on the multiple groups of first training samples and the multiple groups of second training samples before training the student network having the same network type as the teacher network based on the multiple groups of first training samples and the multiple groups of second training samples, and use the output result of the loss calculation module at the end of the training as the pre-output result.
[0136] Optionally, based on the above device, the device may further include:
[0137] The loss value range determination module is used to train the student network based on multiple groups of teacher training samples, and determine the loss value range according to the output result of the loss calculation module at the end of training.
[0138] Optionally, based on any of the above devices, the number of convolution kernels of the student network is less than the number of convolution kernels of the teacher network, and / or the number of channels of each convolution kernel of the student network is less than the number of channels of the corresponding convolution kernel of the teacher network; and / or, the student network includes an anchor-free detector.
[0139] The model generation device provided in the fifth embodiment of the present invention obtains a teacher network obtained by training the original detection model based on multiple groups of teacher training samples through a network training module. Each group of teacher training samples includes a first sample image and a sample annotation result of a known target in the first sample image. Since the teacher network is usually a large and deep neural network, it can obtain good detection results on both the trained first sample image and the untrained second sample image. The detection result can be used as supervision information for the subsequent student network in the training process; accordingly, the sample acquisition module and the model generation module cooperate with each other, and the first detection result obtained after the first sample image is input into the teacher network and the first sample image are used as the first training sample, and the second detection result obtained after the second sample image is input into the teacher network and the second sample image are used as the second training sample, and the student network with the same network type as the teacher network is trained based on the multiple groups of first training samples and the multiple groups of second training samples to generate a target detection model. The above-mentioned device uses the detection results detected by the teacher network from sample images in different application scenarios as supervision information to supervise the training process of the student network. It achieves the effect of improving the generalization performance of the target detection model generated after the training is completed by increasing the number of training samples involved in the training process of the student network without increasing the cost of manual labeling.
[0140] The model generation device provided in the embodiment of the present invention can execute the model generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0141] It is worth noting that in the embodiment of the above-mentioned model generation device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0142] Embodiment 6
[0143] Figure 7 This is a block diagram of the structure of the target detection device provided in the sixth embodiment of the present invention. The device is used to execute the target detection method provided in any of the above embodiments. The device and the target detection method of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the target detection device, please refer to the embodiment of the above target detection method. Figure 7 , the device may specifically include: a model acquisition module 610 and a target detection module 620.
[0144] The model acquisition module 610 is used to acquire the target detection model generated by the model generation method provided by any embodiment of the present invention according to the image to be detected;
[0145] The target detection module 620 is used to input the image to be detected into the target detection model, and obtain the target detection result of the target to be detected in the image to be detected according to the output result of the target detection model.
[0146] The target detection device provided in Example 6 of the present invention, through the cooperation of the model acquisition module and the target detection module, can perform target detection on the image to be detected based on the target detection model after the image to be detected is input into the generated target detection model. Since the target detection model is a deep learning model with good generalization performance, this means that regardless of whether the application scenario of the image to be detected is a trained application scenario, the target detection model can have good detection accuracy on the image to be detected.
[0147] The target detection device provided in the embodiment of the present invention can execute the target detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0148] It is worth noting that in the embodiment of the above-mentioned target detection device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0149] Embodiment 7
[0150] Figure 8 A schematic diagram of the structure of an electronic device provided in Embodiment 7 of the present invention is shown in FIG. Figure 8 As shown, the electronic device includes a memory 710, a processor 720, an input device 730, and an output device 740. The number of processors 720 in the electronic device can be one or more. Figure 8 A processor 720 is taken as an example; the memory 710, the processor 720, the input device 730 and the output device 740 in the electronic device can be connected via a bus or other means. Figure 8 The connection via bus 750 is taken as an example.
[0151] The memory 710, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the model generation method in the embodiment of the present invention (for example, the network training module 510, the sample acquisition module 520 and the model generation module 530 in the model generation device), or the program instructions / modules corresponding to the target detection method in the embodiment of the present invention (for example, the model acquisition module 610 and the target detection module 620 in the target detection device). The processor 720 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 710, that is, realizes the above-mentioned model generation method or target detection method.
[0152] The memory 710 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 710 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 710 may further include a memory remotely arranged relative to the processor 720, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0153] The input device 730 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 740 may include a display device such as a display screen.
[0154] Embodiment 8
[0155] Embodiment 8 of the present invention provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute a model generation method when executed by a computer processor, the method comprising:
[0156] The original detection model is trained based on multiple groups of teacher training samples including the first sample image and sample annotation results of known targets in the first sample image to obtain a teacher network;
[0157] Using the first sample image and a first detection result obtained after the first sample image is input into the teacher network as a first training sample, and using the second sample image and a second detection result obtained after the second sample image is input into the teacher network as a second training sample;
[0158] A student network having the same network type as the teacher network is trained based on multiple groups of first training samples and multiple groups of second training samples to generate a target detection model.
[0159] Of course, the computer executable instructions of a storage medium including computer executable instructions provided in an embodiment of the present invention are not limited to the operations of the method described above, but can also execute related operations in the model generation method provided in any embodiment of the present invention.
[0160] Embodiment 9
[0161] Embodiment 9 of the present invention provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to perform a target detection method when executed by a computer processor, the method comprising:
[0162] Acquire an image to be detected and a target detection model generated by the model generation method provided by any embodiment of the present invention;
[0163] The image to be detected is input into the target detection model, and the target detection result of the target to be detected in the image to be detected is obtained according to the output result of the target detection model.
[0164] Of course, the computer executable instructions of a storage medium including computer executable instructions provided by an embodiment of the present invention are not limited to the method operations described above, and can also execute related operations in the target detection method provided by any embodiment of the present invention.
[0165] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0166] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A model generation method, characterized in that: include: Training the original detection model based on multiple groups of teacher training samples including first sample images and sample annotation results of known targets in the first sample images to obtain a teacher network; Using the first sample image and a first detection result obtained after the first sample image is input into the teacher network as a first training sample, and using the second sample image and a second detection result obtained after the second sample image is input into the teacher network as a second training sample; Based on multiple groups of the second training samples, a student network having the same network type as the teacher network is trained, and for each group of the first training samples, the first sample image is input into a target prediction module in the student network to obtain a first prediction result, the first detection result and the first prediction result are input into a loss calculation module in the student network, and the network parameters in the target prediction module are adjusted according to the output result of the loss calculation module to generate a target detection model; Wherein, adjusting the network parameters in the target prediction module according to the output result of the loss calculation module includes: Determine the loss coefficient according to the pre-output result and the loss value range, wherein the pre-output result includes the output result of the loss calculation module after the student network is pre-trained for a preset number of times; According to the loss coefficient, the output result of the loss calculation module for the first detection result and the first prediction result is regulated, and the network parameters in the target prediction module are adjusted according to the regulation result.
2. The method according to claim 1, characterized in that The first detection result includes a center point detection feature map, a width and height detection feature map and / or a center point offset detection feature map; correspondingly, the first prediction result includes a center point prediction feature map, a width and height prediction feature map and / or a center point offset prediction feature map; correspondingly, the loss calculation module includes a center point loss calculation module, a width and height loss calculation module and / or a center point offset loss calculation module; The step of inputting the first detection result and the first prediction result into the loss calculation module in the student network, and adjusting the network parameters in the target prediction module according to the output result of the loss calculation module, further includes: Inputting the center point detection feature map and the center point prediction feature map into the center point loss calculation module, inputting the width and height detection feature map and the width and height prediction feature map into the width and height loss calculation module, and / or inputting the center point offset detection feature map and the center point offset prediction feature map into the center point offset loss calculation module; Determine a loss calculation result according to output results of the center point loss calculation module, the width and height loss calculation module, and / or the center point offset loss calculation module; The network parameters in the target prediction module are adjusted according to the loss calculation result.
3. The method according to claim 2, characterized in that The center point loss calculation module includes a center point feature map activation unit for activating the center point detection feature map and the center point prediction feature map, and a center point loss calculation unit for calculating the loss value between the center point detection feature map and the center point prediction feature map after activation; and / or, The width and height loss calculation module is used to calculate the loss value between the width and height detection feature map and the width and height prediction feature map according to the category probability feature map, wherein the category probability feature map is a feature map generated when the center point detection feature map takes the maximum value in the category probability dimension; and / or, The center point offset loss calculation module is used to calculate the loss value between the center point offset detection feature map and the center point offset prediction feature map according to the category probability feature map.
4. The method according to claim 1, characterized in that The pre-output result is pre-determined by the following steps: Before training the student network having the same network type as the teacher network based on the multiple groups of the first training samples and the multiple groups of the second training samples, the student network is iteratively trained for the preset number of times based on the multiple groups of the first training samples and the multiple groups of the second training samples, and the output result of the loss calculation module at the end of the training is used as the pre-output result.
5. The method according to claim 1, characterized in that The loss value range is predetermined by the following steps: The student network is trained based on multiple groups of teacher training samples, and the loss value range is determined according to the output result of the loss calculation module at the end of the training.
6. The method according to any one of claims 1 to 5, characterized in that The number of convolution kernels of the student network is less than the number of convolution kernels of the teacher network, and / or the number of channels of each convolution kernel of the student network is less than the number of channels of the corresponding convolution kernel of the teacher network; And / or, the student network comprises an anchor-free detector.
7. A target detection method, characterized in that: include: Acquire an image to be detected and a target detection model generated according to the method of any one of claims 1 to 6; The image to be detected is input into the target detection model, and the target detection result of the target to be detected in the image to be detected is obtained according to the output result of the target detection model.
8. A model generation device, characterized in that: include: A network training module, used for training the original detection model based on multiple groups of teacher training samples including first sample images and sample annotation results of known targets in the first sample images to obtain a teacher network; a sample acquisition module, configured to use the first sample image and a first detection result obtained after the first sample image is input into the teacher network as a first training sample, and use the second sample image and a second detection result obtained after the second sample image is input into the teacher network as a second training sample; A model generation module, used for training a student network having the same network type as the teacher network based on multiple groups of the first training samples and multiple groups of the second training samples to generate a target detection model; Wherein, the student network includes a target prediction module and a loss calculation module; For each group of the first training samples, the model generation module includes: A prediction result obtaining submodule, used for inputting the first sample image into the target prediction module to obtain a first prediction result; A network parameter adjustment submodule, used for inputting the first detection result and the first prediction result into the loss calculation module, and adjusting the network parameters in the target prediction module according to the output result of the loss calculation module; The network parameter adjustment submodule includes: A loss coefficient determination unit, used to determine the loss coefficient according to a pre-output result and a loss value range, wherein the pre-output result includes an output result of the loss calculation module after the student network is pre-trained for a preset number of times; A network parameter adjustment unit is used to adjust the output result of the loss calculation module after the first detection result and the first prediction result are input into the loss calculation module according to the loss coefficient, and adjust the network parameters in the target prediction module according to the adjustment result.
9. A target detection device, characterized in that: include: A model acquisition module, used to acquire an image to be detected and a target detection model generated according to any one of the methods of claims 1 to 6; The target detection module is used to input the image to be detected into the target detection model, and obtain the target detection result of the target to be detected in the image to be detected according to the output result of the target detection model.
10. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the model generation method as described in any one of claims 1 to 6, or the target detection method as described in claim 7.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the model generation method as described in any one of claims 1 to 6 or the target detection method as described in claim 7 is implemented.
Citation Information
Patent Citations
Image recognition model training method, device and equipment and storage medium
CN111639710A