Target detection method, apparatus, device, and storage medium
By reparameterizing and training the CenterNet network and fusing multiple models, the problem of unstable prediction results in the detection of small targets by deep learning algorithms is solved, the accuracy and stability of detection are improved, and the robustness and generalization performance of the model are enhanced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MERCHANTS BANK
- Filing Date
- 2023-08-11
- Publication Date
- 2026-04-17
AI Technical Summary
Existing deep learning algorithms have unstable prediction results in the detection of small targets, are easily affected by noise, leading to false detections or false negatives, and have low accuracy.
By reparameterizing and training multiple CenterNet network structures, and combining them with multi-model fusion techniques, the training images are processed by proportionally slicing, copying and pasting, and scaling and stitching to enhance the model's generalization ability. Finally, the prediction results of multiple models are combined through a weighted bounding box fusion algorithm.
It improves the accuracy and stability of small target detection, enhances the robustness and generalization performance of the model, and reduces the impact of individual model errors on the final prediction results.
Smart Images

Figure CN117011645B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision technology, and in particular to a target detection method, apparatus, device, and storage medium. Background Technology
[0002] Tiny target detection is a method for accurately detecting and locating small objects in images or videos. Tiny targets typically have characteristics such as low pixel size, low contrast, blurriness, and occlusion by surrounding backgrounds or other obstructions. Traditional algorithms for tiny target detection suffer from limitations in feature extraction and pattern recognition, making it difficult to accurately analyze and detect the details and complexity of tiny targets. Therefore, they are often susceptible to noise interference, leading to false positives or false negatives and resulting in low accuracy.
[0003] In contrast, deep learning-based micro-object detection offers a significant advantage in accuracy. Existing deep learning algorithms can effectively capture subtle differences in micro-objects through multi-level feature extraction and adaptive learning, and possess stronger pattern recognition capabilities. These algorithms can automatically learn and adjust model parameters, thus better adapting to complex micro-object detection tasks and improving detection accuracy. However, due to the characteristics of micro-objects, deep learning-based micro-object detection may exhibit fluctuations or over-reliance on certain features in some scenarios. This means that the algorithm may experience some degree of error or missed detections in different images or scenes, leading to unstable prediction results.
[0004] Therefore, it is necessary to propose a scheme to improve the stability of prediction results. Summary of the Invention
[0005] The main objective of this application is to provide a target detection method, apparatus, device, and storage medium, which aims to solve the problem of unstable target prediction results in the prior art.
[0006] To achieve the above objectives, this application provides a target detection method, the target detection method comprising:
[0007] Obtain the image to be predicted;
[0008] The image to be predicted is input into several pre-trained object detection models for prediction, resulting in several prediction results. The object prediction result is obtained by fusing the several prediction results. The object detection models are obtained by reparameterizing the training images.
[0009] Optionally, before the step of obtaining the image to be predicted, the method further includes:
[0010] The target detection model is obtained by reparameterizing the training images, wherein the training images are pre-processed by proportionally slicing them into blocks.
[0011] Optionally, the step of performing reparameterized training based on the training images to obtain the object detection model includes:
[0012] Obtain the training dataset, wherein the training dataset includes training images of a first preset data volume and test images of a second preset data volume;
[0013] Based on the training images and the test images, several CenterNet network structures to be trained are trained to obtain several trained CenterNet network structures, wherein a number of branch structures are pre-added to the main structure of the CenterNet network structure to be trained.
[0014] Based on the reparameterization technique, the branch structure is fused into the main structure of the trained CenterNet network structure, so that the fused CenterNet network structure is consistent with the CenterNet network structure before the branch structure is added, resulting in several trained object detection models.
[0015] Optionally, before the step of performing reparameterized training based on the training images to obtain the object detection model, the method further includes:
[0016] Based on the training images, proportional segmentation is performed, specifically including:
[0017] The targets in the training images are copied and pasted to obtain a set of copied and pasted images;
[0018] Select the copied and pasted training images from the set of copied and pasted images, scale and stitch them together to obtain scaled and stitched training images;
[0019] The scaled and stitched training image is sliced into blocks based on a preset slicing ratio to obtain the sliced training image.
[0020] Based on the size of the scaled and stitched training image, the segmented training image is enlarged proportionally to complete the proportional segmentation process of the training image.
[0021] Optionally, the step of copying and pasting the training images to obtain a set of copied and pasted images includes:
[0022] Select a first training image and a second training image, and randomly jitter the size of the first training image;
[0023] Select a target from the first training image that is shaking, and paste the selected target into the second training image;
[0024] Detect whether the pasted target in the second training image occludes the original target in the second training image;
[0025] If the pasted target does not obscure the original target, the second training image containing the pasted target is retained; this process is repeated for all training images to obtain a set of copy-paste images that includes several training images containing pasted targets.
[0026] Optionally, the step of selecting the copied and pasted training images from the copied and pasted image set, scaling and stitching them together to obtain the scaled and stitched training images includes:
[0027] Select several training images with pasting targets from the set of copied and pasted images, and reduce the size of the training images with pasting targets based on a preset reduction ratio to obtain several reduced training images;
[0028] Based on a preset number of stitching operations, the scaled-down training images are selected and stitched together to obtain several scaled and stitched training images.
[0029] Optionally, the prediction result includes the target location coordinates and confidence level, and the step of fusing the several prediction results to obtain the target prediction result includes:
[0030] Based on several target location coordinates and confidence levels, and combined with a weighted bounding box fusion algorithm, the target prediction result is calculated.
[0031] This application also proposes a target detection device, the target detection device comprising:
[0032] The acquisition module is used to acquire the image to be predicted;
[0033] The prediction module is used to input the image to be predicted into several pre-trained object detection models for prediction, obtain several prediction results, and fuse the several prediction results to obtain the target prediction result. The object detection model is obtained by reparameterizing training based on the training image.
[0034] This application also proposes a target detection device, which includes a memory, a processor, and a target detection program stored in the memory and executable on the processor. When the target detection program is executed by the processor, it implements the steps of the target detection method described above.
[0035] This application also proposes a computer-readable storage medium storing a target detection program, which, when executed by a processor, implements the steps of the target detection method described above.
[0036] The object detection method, apparatus, device, and storage medium proposed in this application involve acquiring an image to be predicted; inputting the image to be predicted into several pre-trained object detection models for prediction, resulting in several prediction results; and fusing these prediction results to obtain a target prediction result. The object detection models are obtained through reparameterized training based on training images. Based on this application's solution, by using training images to reparameterize the object detection model, the model can adapt to the characteristics of various scenarios and targets, enhancing its generalization ability. By fusing the prediction results of multiple models through multi-model fusion, the impact of errors or instabilities of individual models on the final prediction result can be reduced, further improving the robustness and generalization performance of the object detection model, making the target prediction result more stable and reliable. Attached Figure Description
[0037] Figure 1 This is a schematic diagram of the functional modules of the equipment to which the target detection device of this application belongs;
[0038] Figure 2 This is a flowchart illustrating a first exemplary embodiment of the target detection method of this application;
[0039] Figure 3 This is a flowchart illustrating a second exemplary embodiment of the target detection method of this application;
[0040] Figure 4 This is a schematic diagram of the process for training the target detection model according to a second exemplary embodiment of the target detection method of this application;
[0041] Figure 5 This is a flowchart illustrating a third exemplary embodiment of the target detection method of this application.
[0042] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0043] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0044] The main solution of this application includes: acquiring an image to be predicted; inputting the image to be predicted into several pre-trained object detection models for prediction, obtaining several prediction results, and fusing the several prediction results to obtain a target prediction result, wherein the object detection model is obtained by reparameterizing training based on training images. Based on this application's solution, by using training images to reparameterize the object detection model, the model can adapt to the characteristics of various scenarios and targets, enhancing the model's generalization ability. By using multi-model fusion, that is, fusing the prediction results of multiple models, the impact of the error or instability of a single model on the final prediction result can be reduced, further improving the robustness and generalization performance of the object detection model, making the target prediction result more stable and reliable.
[0045] Specifically, refer to Figure 1 , Figure 1 This is a functional module diagram of the device to which the target detection apparatus of this application belongs. The target detection apparatus can be a device independent of the equipment, capable of image processing and network model training, and can be implemented on the equipment in hardware or software form. The equipment can be a smart mobile terminal with data processing capabilities, such as a mobile phone or tablet computer, or it can be a fixed device or server with data processing capabilities.
[0046] In this embodiment, the target detection device includes at least an output module 110, a processor 120, a memory 130, and a communication module 140.
[0047] The memory 130 stores the operating system and the object detection program. The object detection device can store information such as the acquired image to be predicted, several pre-trained object detection models, the prediction results obtained by inputting the image to be predicted into the pre-trained object detection models, and the object prediction result obtained by fusing several prediction results in the memory 130. The output module 110 can be a display screen, etc. The communication module 140 can include a WIFI module, a mobile communication module, and a Bluetooth module, etc., and communicates with external devices or servers through the communication module 140.
[0048] When the target detection program in memory 130 is executed by the processor, it performs the following steps:
[0049] Obtain the image to be predicted;
[0050] The image to be predicted is input into several pre-trained object detection models for prediction, resulting in several prediction results. The object prediction result is obtained by fusing the several prediction results. The object detection models are obtained by reparameterizing the training images.
[0051] Furthermore, when the target detection program in memory 130 is executed by the processor, it also performs the following steps:
[0052] The target detection model is obtained by reparameterizing the training images, wherein the training images are pre-processed by proportionally slicing them into blocks.
[0053] Furthermore, when the target detection program in memory 130 is executed by the processor, it also performs the following steps:
[0054] Obtain the training dataset, wherein the training dataset includes training images of a first preset data volume and test images of a second preset data volume;
[0055] Based on the training images and the test images, several CenterNet network structures to be trained are trained to obtain several trained CenterNet network structures, wherein a number of branch structures are pre-added to the main structure of the CenterNet network structure to be trained.
[0056] Based on the reparameterization technique, the branch structure is fused into the main structure of the trained CenterNet network structure, so that the fused CenterNet network structure is consistent with the CenterNet network structure before the branch structure is added, resulting in several trained object detection models.
[0057] Furthermore, when the target detection program in memory 130 is executed by the processor, it also performs the following steps:
[0058] Based on the training images, proportional segmentation is performed, specifically including:
[0059] The targets in the training images are copied and pasted to obtain a set of copied and pasted images;
[0060] Select the copied and pasted training images from the set of copied and pasted images, scale and stitch them together to obtain scaled and stitched training images;
[0061] The scaled and stitched training image is sliced into blocks based on a preset slicing ratio to obtain the sliced training image.
[0062] Based on the size of the scaled and stitched training image, the segmented training image is enlarged proportionally to complete the proportional segmentation process of the training image.
[0063] Furthermore, when the target detection program in memory 130 is executed by the processor, it also performs the following steps:
[0064] Select a first training image and a second training image, and randomly jitter the size of the first training image;
[0065] Select a target from the first training image that is shaking, and paste the selected target into the second training image;
[0066] Detect whether the pasted target in the second training image occludes the original target in the second training image;
[0067] If the pasted target does not obscure the original target, the second training image containing the pasted target is retained; this process is repeated for all training images to obtain a set of copy-paste images that includes several training images containing pasted targets.
[0068] Furthermore, when the target detection program in memory 130 is executed by the processor, it also performs the following steps:
[0069] Select several training images with pasting targets from the set of copied and pasted images, and reduce the size of the training images with pasting targets based on a preset reduction ratio to obtain several reduced training images;
[0070] Based on a preset number of stitching operations, the scaled-down training images are selected and stitched together to obtain several scaled and stitched training images.
[0071] Furthermore, when the target detection program in memory 130 is executed by the processor, it also performs the following steps:
[0072] Based on several target location coordinates and confidence levels, and combined with a weighted bounding box fusion algorithm, the target prediction result is calculated.
[0073] This embodiment, through the above-described scheme, specifically involves acquiring the image to be predicted; inputting the image to be predicted into several pre-trained object detection models for prediction, resulting in several prediction results; and fusing these prediction results to obtain the target prediction result. The object detection models are obtained through reparameterized training based on training images. Based on this application's scheme, by using training images to reparameterize the object detection model, the model can adapt to the characteristics of various scenarios and targets, enhancing its generalization ability. By using multi-model fusion, that is, fusing the prediction results of multiple models, the impact of errors or instabilities of individual models on the final prediction result can be reduced, further improving the robustness and generalization performance of the object detection model, making the target prediction result more stable and reliable.
[0074] Based on, but not limited to, the above-described device architecture, this application proposes an embodiment of the target detection method.
[0075] First Embodiment
[0076] Reference Figure 2 , Figure 2 This is a flowchart illustrating a first exemplary embodiment of the target detection method of this application. In this embodiment, the target detection method includes:
[0077] Step S11: Obtain the image to be predicted;
[0078] Step S12: Input the image to be predicted into several pre-trained object detection models for prediction, and obtain several prediction results. Then, fuse the several prediction results to obtain the target prediction result. The object detection model is obtained by reparameterizing training based on the training image.
[0079] The execution subject of the method in this embodiment can be a target detection device, a target detection terminal device, or a server. This embodiment takes a target detection device as an example. The target detection device can be integrated into a terminal device such as a smartphone or tablet computer with data processing function.
[0080] The solution in this embodiment mainly enables the detection of small targets and improves the stability of target prediction results.
[0081] In this embodiment, to detect small targets in an image, the image to be predicted is first acquired. This acquisition can be done by obtaining a pre-stored image, acquiring a real-time captured image, or receiving an image sent from a third-party connected device or server. In other embodiments, different image acquisition methods can be selected based on the specific application scenario.
[0082] Subsequently, several pre-trained object detection models are used to predict the input image to be predicted, resulting in several prediction results. The number of object detection models can be two or more; the number of prediction results output corresponds to the number of object detection models. In this embodiment, the object detection model is trained using pre-collected training images through re-parameterization. Re-parameterization training refers to the technique of adjusting model parameters using training data to optimize performance and robustness.
[0083] Then, the several prediction results are fused to obtain the final target prediction result. Since each model has its unique characteristics and training methods, the fusion operation can comprehensively consider the advantages of each model and reduce the impact of the error or instability of a single model on the final result.
[0084] This embodiment, through the above-described scheme, specifically involves acquiring the image to be predicted; inputting the image to be predicted into several pre-trained object detection models for prediction, resulting in several prediction results; and fusing these prediction results to obtain the final object prediction result. The object detection models are obtained through reparameterized training based on training images. By reparameterizing the object detection models using training images, the models can adapt to the characteristics of various scenarios and targets, enhancing their generalization ability. Through multi-model fusion, that is, fusing the prediction results of multiple models, the impact of errors or instabilities of individual models on the final prediction result can be reduced, further improving the robustness and generalization performance of the object detection model, making the object prediction result more stable and reliable.
[0085] Second Embodiment
[0086] Furthermore, referring to Figure 3 , Figure 3 This is a flowchart illustrating a second exemplary embodiment of the object detection method of this application. Based on the first embodiment described above, in this embodiment, before obtaining the image to be predicted in step S11, the following may be included:
[0087] Step S10: Perform reparameterized training based on the training images to obtain the target detection model. The training images are pre-processed by proportionally slicing. Proportional slicing refers to dividing the original image into several smaller images according to specific rules, and then enlarging the smaller images to the size of the original image.
[0088] In this embodiment, step S10 is performed before step S11; in other embodiments, step S10 may also be performed between step S11 and step S12.
[0089] Compared to the above Figure 2 The embodiment shown also includes a scheme for training the target detection model.
[0090] Specifically, the step of performing reparameterized training based on the training images to obtain the object detection model may include:
[0091] Step S101: Obtain the training dataset, wherein the training dataset includes training images of a first preset data volume and test images of a second preset data volume;
[0092] Step S102: Train several CenterNet network structures to be trained based on the training images and the test images to obtain several trained CenterNet network structures, wherein a number of branch structures are pre-added to the main structure of the CenterNet network structure to be trained.
[0093] Step S103: Based on the reparameterization technique, the branch structure is fused into the main structure of the trained CenterNet network structure so that the fused CenterNet network structure is consistent with the CenterNet network structure before the branch structure is added, resulting in several trained object detection models.
[0094] More specifically, in this embodiment, a certain number of images are collected in advance to form a training dataset; the training dataset is divided into a training set and a test set, wherein the training set includes a first preset number of training images and the test set includes a second preset number of test images. The training images are used to train the object detection model, and the test images are used to test the trained object detection model to verify the prediction effect of the object detection model.
[0095] In this embodiment, CenterNet is selected as the network model structure for the object detection model. A number of branch structures are pre-added to the main structure of the CenterNet network structure—the hourglass main structure. These added branch structures can be 1x1 convolutions, identity connections, etc.
[0096] When training the object detection model, training images and test images are used to train several CenterNet network structures with a certain number of branches added, resulting in several trained CenterNet network structures.
[0097] Subsequently, based on the reparameterization technique, a number of branch structures added to the CenterNet network structure to be trained are fused into the main structure of the trained CenterNet network structure - the hourglass main structure, so that the fused CenterNet network structure is consistent with the original CenterNet network structure before the addition of branch structures, and several trained object detection models are obtained.
[0098] For example, such as Figure 4As shown, suppose there are k CenterNet network structures to be trained. Several 1x1 convolutional branches are added to the hourglass main structure of each CenterNet network structure to be trained. When training the object detection model, the pre-collected training data is divided into k parts. Each time, k-1 parts of the data are selected as the training set and 1 part as the test set for model training, resulting in k trained CenterNet network structures. Based on reparameterization technology, the numerous branch structures added to the CenterNet network structures to be trained are fused into the hourglass main structure of the trained CenterNet network structures. This ensures that the fused CenterNet network structure is consistent with the original CenterNet network structure before the addition of branch structures, resulting in k trained object detection models.
[0099] Then, k trained object detection models are used to predict the input image to be predicted, resulting in k prediction results. The k prediction results are then fused together to obtain the final object detection result, which is then output.
[0100] This embodiment improves the CenterNet model by using reparameterization techniques, enhancing its ability to detect targets at different scales, especially small-scale targets, and greatly improving the accuracy of small target detection. At the same time, the CenterNet optimization method based on reparameterization improves the deployment problem of the model in resource-constrained environments.
[0101] Third Embodiment
[0102] Furthermore, based on the second embodiment described above, in this embodiment, before performing reparameterized training based on the training images to obtain the target detection model, step S10 may further include: performing proportional block processing based on the training images.
[0103] Reference Figure 5 , Figure 5 This is a flowchart illustrating a third exemplary embodiment of the object detection method of this application. The step of performing proportional block processing based on the training image may include:
[0104] Step S1001: Copy and paste the targets in the training images to obtain a copy and paste image set.
[0105] Specifically, to enrich the diversity of training samples, any target is selected from the training images. Based on the selected target, the training image is copied and pasted to obtain a new, copied-and-pasted training image. The selected target can be copied and pasted into the original training image for that target, or it can be copied and pasted into other training images. All training images that have undergone copy-and-pasted processing are collected to form a copy-and-pasted image set.
[0106] More specifically, step S1001 above may include:
[0107] Select a first training image and a second training image, and randomly jitter the size of the first training image;
[0108] Select a target from the first training image that is shaking, and paste the selected target into the second training image;
[0109] Detect whether the pasted target in the second training image occludes the original target in the second training image;
[0110] If the pasted target does not obscure the original target, the second training image containing the pasted target is retained; this process is repeated for all training images to obtain a set of copy-paste images that includes several training images containing pasted targets.
[0111] In this embodiment, at least two training images are first selected from the collected training dataset: a first training image and a second training image. The first training image is then subjected to random size jittering, meaning its size is slightly and randomly adjusted to simulate different target sizes in a real-world scene. Next, a target is selected from the jittered first training image and pasted onto the second training image. This increases the likelihood of the target appearing against different backgrounds, allowing the subsequently trained model to better learn the relationship between the target and the background. For the pasted target, its corresponding bounding box and category label need to be updated. The bounding box defines the target's position and size in the image, while the category label indicates the target object's category. By updating these annotations, the model can receive accurate target localization and classification guidance during training.
[0112] Then, it is checked whether the pasted target in the second training image occludes the original target in the second training image. If the pasted target does not occlude the original target, the second training image containing the pasted target is retained.
[0113] Then, repeat the above steps to perform the copy-paste process on other training images in the collected training dataset. After the iteration is completed, several training images with pasting targets are obtained, and these several training images with pasting targets are combined into a copy-paste image set.
[0114] Step S1002: Select the copied and pasted training images from the copied and pasted image set, and perform scaling and stitching processing to obtain the scaled and stitched training images.
[0115] Specifically, training images are selected from the set of copied and pasted images. These copied and pasted training images are then scaled and stitched together. This involves first reducing the size of the copied and pasted training images, and then stitching them together with multiple scaled-down training images to obtain the scaled and stitched training images.
[0116] More specifically, step S1002 above may include:
[0117] Select several training images with pasting targets from the set of copied and pasted images, and reduce the size of the training images with pasting targets based on a preset reduction ratio to obtain several reduced training images;
[0118] Based on a preset number of stitching operations, the scaled-down training images are selected and stitched together to obtain several scaled and stitched training images.
[0119] In this embodiment, several training images containing pasted targets are selected from the set of copied and pasted images. These images are then scaled down according to a pre-set scaling ratio, resulting in several scaled-down training images. By scaling these training images, the appearance of targets at different sizes can be simulated, allowing the trained model to better learn the size invariance of targets.
[0120] Next, based on the pre-set stitching data, a corresponding number of scaled-down training images are selected and stitched together to obtain scaled and stitched training images. The above steps are repeated for all training images in the copied and pasted image set, resulting in several scaled and stitched training images. The scaled and stitched images will contain small targets from different original images, further increasing the likelihood and diversity of targets appearing against different backgrounds.
[0121] In addition, the information of each image and its corresponding detection box is updated according to the scaling size.
[0122] For example, four training images containing pasted targets are randomly selected from a set of copied and pasted images. Each image is then scaled down to one-quarter of its original size. These four scaled-down images are then stitched together to form a new training image. This new image contains small targets from the original images. Because the original images containing pasted targets are scaled down to one-quarter, the bounding boxes in the original images also need to be adjusted according to the scaling ratio to fit the new image.
[0123] Step S1003: The scaled and stitched training image is divided into blocks based on a preset segmentation ratio to obtain the block-divided training image.
[0124] Step S1004: Based on the size of the scaled and stitched training image, enlarge the segmented training image proportionally to complete the proportional segmentation of the training image.
[0125] Specifically, the scaled and stitched training images are segmented according to a pre-set segmentation ratio to obtain a number of segmented training images. Then, the size of the segmented training images is proportionally enlarged to the size of the original scaled and stitched training images, ensuring that the size of the segmented training images equals the size of the original scaled and stitched training images, thus completing the proportional segmentation of the training images. Simultaneously, the detection boxes of small targets in the segmented training images are enlarged proportionally.
[0126] This embodiment solves the problem of insufficient training data for deep learning by using data augmentation methods such as copy and paste, scaling and stitching, and image tiling, thereby greatly enriching the diversity of samples.
[0127] Fourth embodiment
[0128] Furthermore, based on the embodiments shown above, in this embodiment, the prediction result may include the target location coordinates and confidence level, and the step of fusing the plurality of prediction results to obtain the target prediction result may include:
[0129] Step S121: Based on several target location coordinates and confidence levels, and combined with a weighted bounding box fusion algorithm, the target prediction result is calculated.
[0130] Specifically, each prediction result obtained from several object detection models can include the target's location coordinates and confidence score. By using a weighted bounding box fusion algorithm, these target location coordinates and confidence scores are combined to calculate a fused target prediction result. The weighted bounding box fusion algorithm calculates the fused target coordinates and confidence scores according to a certain weight ratio. The weight ratio can be set according to different strategies, such as model performance, confidence scores, or other relevant factors.
[0131] Optionally, assuming there are k object detection models, for the same location in an image to be predicted, after inference by these k object detection models, k different prediction results are obtained, where each prediction result includes the target location coordinates and confidence information. These k prediction results can be represented as: (x 11 y 11 ,x 12 y 12 c1), (x 21 y 21 x 22 y 22 (C2), ..., (x) k1 y k1 x k2 y k2 c k The target location coordinates and confidence level after fusion can be calculated using the following formula:
[0132]
[0133]
[0134]
[0135]
[0136]
[0137] Where, x1, x 11 ...x k1 x2, x 21 ...x k2 All are the x-coordinates of the target position, y1, y2, y3, y4, y 11 ...y k1 y2, y 21 ...y k2 All are the vertical coordinates of the target position, c, c1...c k All are confidence levels.
[0138] This embodiment uses a weighted bounding box fusion method to combine the prediction results of multiple models to obtain a more accurate final target prediction result, improve the detection performance of small targets, and reduce erroneous predictions caused by the limitations of a single model.
[0139] Furthermore, embodiments of this application also propose a target detection device, the target detection device comprising:
[0140] The acquisition module is used to acquire the image to be predicted;
[0141] The prediction module is used to input the image to be predicted into several pre-trained object detection models for prediction, obtain several prediction results, and fuse the several prediction results to obtain the target prediction result. The object detection model is obtained by reparameterizing training based on the training image.
[0142] Furthermore, the target detection device also includes:
[0143] The model training module is used to perform reparameterized training based on the training images to obtain the target detection model, wherein the training images are pre-processed by proportionally slicing them into blocks.
[0144] The principle and implementation process of target detection in this embodiment are explained in the above embodiments, and will not be repeated here.
[0145] Furthermore, this application also proposes a target detection device, which includes a memory, a processor, and a target detection program stored in the memory and executable on the processor. When the target detection program is executed by the processor, it implements the steps of the target detection method described above.
[0146] Since this target detection program employs all the technical solutions of all the foregoing embodiments when executed by the processor, it has at least all the beneficial effects brought about by all the technical solutions of all the foregoing embodiments, which will not be elaborated here.
[0147] Furthermore, embodiments of this application also propose a computer-readable storage medium storing a target detection program, which, when executed by a processor, implements the steps of the target detection method described above.
[0148] Since this target detection program employs all the technical solutions of all the foregoing embodiments when executed by the processor, it has at least all the beneficial effects brought about by all the technical solutions of all the foregoing embodiments, which will not be elaborated here.
[0149] Compared to existing technologies, the target detection method, apparatus, device, and storage medium proposed in this application involve acquiring an image to be predicted; inputting the image to be predicted into several pre-trained target detection models for prediction, resulting in several prediction results; and fusing these prediction results to obtain a target prediction result. The target detection models are obtained through reparameterized training based on training images. Based on this application's solution, by using training images to reparameterize the target detection model, the model can adapt to the characteristics of various scenarios and targets, enhancing its generalization ability. By fusing the prediction results of multiple models through multi-model fusion, the impact of errors or instabilities of individual models on the final prediction result can be reduced, further improving the robustness and generalization performance of the target detection model, making the target prediction result more stable and reliable.
[0150] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0151] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0152] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0153] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a device (which may be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the methods of each embodiment of this application.
[0154] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A target detection method, characterized in that, The target detection method includes: The process of proportionally slicing training images specifically includes: copying and pasting targets from the training images to obtain a copy-paste image set; selecting copied and pasted training images from the copy-paste image set and scaling and stitching them together to obtain scaled and stitched training images; slicing the scaled and stitched training images into blocks based on a preset slicing ratio to obtain block-sized training images; and scaling the block-sized training images proportionally according to their size to complete the proportional slicing of the training images. The target detection model is obtained by reparameterizing the training images, wherein the training images are pre-processed by proportionally slicing them into blocks. Obtain the image to be predicted; The image to be predicted is input into several pre-trained object detection models for prediction, resulting in several prediction results. The object prediction result is obtained by fusing the several prediction results. The object detection model is obtained by reparameterizing the training image. The step of copying and pasting the targets in the training images to obtain a set of copied and pasted images includes: Select a first training image and a second training image, and randomly jitter the size of the first training image; Select a target from the first training image that is shaking, and paste the selected target into the second training image; Detect whether the pasted target in the second training image occludes the original target in the second training image; If the pasted target does not obscure the original target, the second training image containing the pasted target is retained; this process is repeated for all training images to obtain a set of copy-paste images that includes several training images containing pasted targets.
2. The target detection method according to claim 1, characterized in that, The step of performing reparameterization training based on the training images to obtain the object detection model includes: Obtain the training dataset, wherein the training dataset includes training images of a first preset data volume and test images of a second preset data volume; Based on the training images and the test images, several CenterNet network structures to be trained are trained to obtain several trained CenterNet network structures, wherein a number of branch structures are pre-added to the main structure of the CenterNet network structure to be trained. Based on the reparameterization technique, the branch structure is fused into the main structure of the trained CenterNet network structure, so that the fused CenterNet network structure is consistent with the CenterNet network structure before the branch structure is added, resulting in several trained object detection models.
3. The target detection method according to claim 1, characterized in that, The step of selecting the copied and pasted training images from the copied and pasted image set, scaling and stitching them together to obtain the scaled and stitched training images includes: Select several training images with pasting targets from the set of copied and pasted images, and reduce the size of the training images with pasting targets based on a preset reduction ratio to obtain several reduced training images; Based on a preset number of stitching operations, the scaled-down training images are selected and stitched together to obtain several scaled and stitched training images.
4. The target detection method according to claim 1, characterized in that, The prediction result includes the target location coordinates and confidence level. The step of fusing the several prediction results to obtain the target prediction result includes: Based on several target location coordinates and confidence levels, and combined with a weighted bounding box fusion algorithm, the target prediction result is calculated.
5. A target detection device, characterized in that, The target detection device includes: A proportional slicing module is used to perform proportional slicing processing on training images. This module is further used to copy and paste targets from the training images to obtain a copy-paste image set; select copied and pasted training images from the copy-paste image set and scale and stitch them together to obtain scaled and stitched training images; slice the scaled and stitched training images into blocks based on a preset slicing ratio to obtain sliced training images; and enlarge the sliced training images proportionally according to their size to complete the proportional slicing of the training images. Block processing; the proportional block processing module is further used to select a first training image and a second training image, and to randomly jitter the size of the first training image; select a target from the jittered first training image, and paste the selected target onto the second training image; detect whether the pasted target on the second training image with the pasted target occludes the original target on the second training image; if the pasted target does not occlude the original target, retain the second training image with the pasted target; repeat this process, iterating through all training images to obtain a set of copy-paste images including several training images with pasted targets; The training module is used to perform reparameterized training based on the training images to obtain an object detection model, wherein the training images are pre-processed by proportionally slicing them into blocks; The acquisition module is used to acquire the image to be predicted; The prediction module inputs the image to be predicted into several pre-trained object detection models for prediction, and obtains several prediction results. The prediction results are then fused together to obtain the target prediction result. The object detection models are obtained by reparameterizing training based on the training images.
6. A target detection device, characterized in that, The target detection device includes a memory, a processor, and a target detection program stored in the memory and executable on the processor. When the target detection program is executed by the processor, it implements the steps of the target detection method as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a target detection program, which, when executed by a processor, implements the steps of the target detection method as described in any one of claims 1-4.
Citation Information
Patent Citations
Target detection method and device based on multi-model fusion, equipment and medium
CN113688957A
Target detection model training method, target detection method, equipment and medium
CN116051961A