A target detection method based on background information compensation
By incorporating background information compensation into the YOLO v3 network and improving the loss function L, the problem of low accuracy in biological species identification under complex environments is solved, and higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202211387235.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-07
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-11-07
AI Technical Summary
Existing object detection algorithms ignore background information in complex environments, resulting in low accuracy in biological species identification.
Based on the YOLO v3 network, the model information obtained in the (i-1)th training round is used to compensate for the background knowledge in the i-th training round. An improved loss function L is used to combine the background information to improve the model's fitting ability.
While ensuring detection speed, the accuracy of target detection has been improved, especially in the identification of biological species in complex environments.
Smart Images

Figure CN115861730B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of target detection, in particular to a target detection method based on background information compensation. BACKGROUND
[0002] In computer vision tasks, target recognition is one of the important tasks. It can realize the recognition of specific biological targets, and thus has important significance for the protection and rational application and development of biological resources. For a long time, the recognition of biological species is mostly realized by artificial means, which not only produces high labor cost, but also is extremely low in efficiency. Therefore, it has great practical significance to realize autonomous recognition.
[0003] In recent years, target recognition is mainly divided into two categories:
[0004] One category is based on one-stage detector, which has representative You Only Look Once (YOLO for short) series and Single Shot MultiBox Detector (SSD for short) algorithm, etc. The general characteristics of this kind of algorithm can be represented as follows: first, the features are extracted through the feature network, then the prediction head is generated through the fusion of relevant feature layers, and finally a plurality of candidate prediction boxes are generated to achieve the purpose of detection. Among them, the representative is Region-Convolutional Neural Network (R-CNN for short) series, mainly including R-CNN, Fast Region-CNN (Fast R-CNN for short) and Faster Region-CNN (Faster R-CNN for short);
[0005] The other category is based on two-stage detector, and the main characteristics of this kind of algorithm are that a series of candidate boxes are generated by a candidate box generator, and then a region classifier is used to predict the region class of the candidate box.
[0006] The above methods pay too much attention to the candidate box part, in other words, the role of the background in an image on target recognition is ignored. Therefore, if the above methods are simply used to recognize biological species in the face of complex and changeable biological living environment, it is difficult to play the due effect of the algorithm and achieve the expected accuracy. SUMMARY
[0007] In order to solve the above problems, the present application provides a target detection method based on background information compensation, which can effectively identify and locate the characteristics of organisms in complex environments, and has certain stability in target detection tasks, thereby improving the accuracy of biological identification of the detection network to a certain extent.
[0008] In order to achieve the above purpose, the present application realizes the following technical solutions:
[0009] A target detection method based on background information compensation comprises the following steps:
[0010] Step 1, data collection and dataset construction:
[0011] Determine the species to be detected, collect photos of the corresponding species, and construct the dataset required for the detection task;
[0012] Step 2, dataset annotation:
[0013] Annotate the collected dataset to generate a dataset in the annotation format of The Visual Object Classes (VOC) dataset, so that the training set accounts for 81%, the validation set accounts for 9%, and the test set accounts for 10%;
[0014] Step 3, building a target detection network:
[0015] The target detection network is divided into a training network and a test network:
[0016] The test network is composed of an original YOLO v3 network, which is composed of a backbone network, a feature fusion network and a detection head. The backbone network adopts Darknet-53, which mainly extracts features and forms feature maps of different sizes. The feature fusion network mainly fuses the feature maps of different sizes extracted from the backbone network. The detection head is mainly formed by convolution after the fused feature map. During detection, the image is only input into the backbone network, and the target is detected in the detection head;
[0017] The training network is changed on the basis of the YOLO v3 training network, mainly manifested as: in the i-th round of training, the model information obtained by the i-1-th round of training is fed back to the i-th round of training, and the model information obtained by the i-1-th round of training can make up for the neglect of image background information in the i-th round of training, so as to improve the fitting ability of the i-th round of model, and at the same time achieve the purpose of partial self-supervision;
[0018] Step 4, training network:
[0019] Train the trained network in step 3 using the training set and validation set described in step 2;
[0020] Step 5, target detection test:
[0021] Step 4, the network has been trained, test the test set in step 2 to test the training results, verify the stability of the model and detect the species in step 1.
[0022] The model information fed back in step 3 includes the following steps:
[0023] Suppose the three prediction heads obtained by training the network in the i-th round are and The feature map of is (13, 13, c) in size, is (26, 26, c) in size, is (52, 52, c) in size, where c is the number of channels of the feature map, and is determined according to the category of the detected target, so and The feature map size of can be uniformly denoted as is expressed as where represents the width of the jth feature map in the i-th training, j takes 1, 2 or 3; represents the length of the jth feature map in the i-th training, and the calculation formula of c is expressed as:
[0024] c = 3 * ((4 + 1) + cls),
[0025] 3 in the formula represents that the determination of each target will generate 3 anchor boxes, 4 represents that the anchor box has four parameters of the center point coordinate and the length and width of the anchor box, 1 represents the confidence of the anchor box, and cls represents the number of categories of the detected target;
[0026] Suppose the three prediction heads obtained by training the model in the i-1th round are denoted as T1 i-1 , and From the above derivation, the three feature maps of the prediction head T1 i-1 , and can be uniformly denoted as that is where represents the width of the jth feature map in the prediction of the model obtained by the i-1th training, j takes 1, 2 or 3; represents the length of the jth feature map in the prediction of the model obtained by the i-1th training;
[0027] In order to let the trained Pay attention to background features and extract Relevant background knowledge is used to assist Attention to background knowledge includes:
[0028] Extract first Maximum value on each channel and mean As representatives of the channels, they can be represented by the following formulas:
[0029]
[0030]
[0031] At the same time for Maximum value on each channel and mean The following formula still applies:
[0032]
[0033]
[0034] To compensate for the neglect of background knowledge during the i-th training round, the model information obtained from the (i-1)-th training round is used to supplement the background knowledge from the i-th training round. This process can be achieved through... right Compensation and realization, that is for Provide the most important background knowledge, for Provide more comprehensive background information. However, It can only provide the most important information within a specific context, ignoring other less important contextual information; while This would provide more comprehensive background information, but it would diminish the importance of the most crucial information. Therefore, a combination of both approaches is used:
[0035] Let l0 be the loss function of the original YOLO v3 network during training, and L be the loss function of the improved object detection network. L can be expressed as the following expression:
[0036]
[0037]
[0038]
[0039] In the above expression, alpha is the equilibrium coefficient, the value range is alpha [0, 1]; m is the current training coefficient, which is a positive integer; n is the total number of training in the experiment, which is a positive integer; KL(·) represents KL divergence (Kullback-Leibler divergence); T is a self-defined coefficient, the value range is represented as {T|T>1, T [N +}, N + represents a positive integer; l1 represents The background knowledge provided by l1 is how much; l2 represents The background knowledge provided by l2 is how much. The present application improves the one-stage target detection algorithm YOLO v3, and the main improvement process is: the model information obtained by the i-1th round of training compensates for the background knowledge in the i th round of training process, which can be realized by The background knowledge provided by l1 is how much; l2 represents
[0040] The background knowledge provided by l2 is how much. The background knowledge provided by l1 is how much; l2 represents The background knowledge provided by l2 is how much. The background knowledge provided by l1 is how much; l2 represents The background knowledge provided by l2 is how much. The background knowledge provided by l1 is how much; l2 represents The background knowledge provided by l2 is how much.
[0041] Advantages or beneficial effects of the present application:
[0042] 1. In the existing target detection technology, most of them ignore the importance of background information to target detection, and the present application mainly proposes a background compensation method for background information, which mainly uses the results predicted by the model obtained by the i-1th round of training to compensate for the background knowledge in the i th round of training process, and improves the traditional YOLO v3 network model;
[0043] 2. After improving the YOLO v3 network by the method, not only the network parameters of the existing network are not increased, but also the accuracy of network detection is improved under the premise of ensuring the detection speed, and the superior performance of the network is exerted, which provides guarantee for real-time detection of targets;
[0044] 3. The present application can be widely used in biological protection, environmental survey and other aspects, and has wide application prospect. BRIEF DESCRIPTION OF DRAWINGS
[0045] Figure 1 It is the flow chart of the target detection method based on background information compensation in the embodiment of the present application;
[0046] Figure 2 It is the principle diagram of the conventional YOLO v3 algorithm;
[0047] Figure 3A principle diagram based on an improved YOLO v3 algorithm provided by the present application is provided.
[0048] Figure 4 A comparison diagram of mAP of YOLO v3 and the improved network of the present application. DETAILED DESCRIPTION
[0049] The present application will be described in detail below with reference to the accompanying drawings and examples, and many practical details will be described in the following description for the purpose of clear illustration. The examples described below by reference to the accompanying drawings are exemplary and are intended to explain the present application, and cannot be understood as limiting the present application. That is, in some embodiments of the present application, these practical details are not necessary.
[0050] The present application is a target detection method based on background information compensation, which generally includes: data acquisition, using a camera with a waterproof device or other equipment to collect images of biological objects to be detected; data set making, labeling the collected biological photos as VOC format data sets, and dividing the training set, validation set and test set according to a certain proportion; network building, building an improved target detection network; network training, training the built target detection network, and saving the weight model; network testing, testing the built target detection network according to the saved weight model, and detecting the effect in actual application.
[0051] Embodiment:
[0052] As shown in Figure 1 A target detection method based on background information compensation includes the following steps:
[0053] Step 1) Collect data and build data sets:
[0054] Get underwater biological photos by camera or other equipment, including underwater biological objects to be detected, and take relevant data sets; the simulation experiment in the present application is mainly for underwater fish species detection, so the data set directly uses Fish4Knowledge fish data set, including 23 kinds of fish, a total of 27370 fish images, since the data has the disadvantage of uneven distribution, therefore, the simulation experiment in the present application mainly selects 5000 of them, including 5 kinds of fish: net pattern home mud fish, black band pepper goby, long spine light gill fish, clark double saw fish and butterfly fish;
[0055] Step 2) Label data sets:
[0056] The five kinds of fish in step 1) are manually labeled as VOC format data sets, of which the training set accounts for 4050, the validation set accounts for 450, and the test set accounts for 500;
[0057] Step 3) Build target detection network:
[0058] The target detection network is divided into a training network and a test network;
[0059] The test network is composed of an original YOLO v3 network, as shown in Figure 2 The backbone network adopts Darknet-53 to extract features, and feature maps of different sizes can be obtained. After up-sampling operations are performed on the feature maps of different sizes, the feature maps of different sizes are changed into feature maps of the same size. Then, the feature maps of the same size are fused, and finally, the fused feature maps are convolved into three detection heads of different sizes, denoted as In the formula, c = 3 * ((4 + 1) + cls), and cls = 5 according to step 1), so c = 30. During detection, only the image to be detected needs to be input into the backbone network, and then whether the target to be detected exists can be detected in the detection head.
[0060] The training network adopts a training network improved from the original YOLO v3, as shown in Figure 3 The specific improved part can be represented as follows: during the i-th round of training, the model information obtained in the (i-1)-th round of training is fed back to the i-th round of training. This information can compensate for the neglect of image background information during the i-th round of training, thereby improving the fitting ability of the i-th round model and achieving a partial self-supervised purpose. Specifically, the following content can be expressed:
[0061] As can be seen from Figure 3 , the model information obtained in the (i-1)-th round of training is fed back to the i-th round of training. As can be seen from Figure 3 , the model information is and , wherein information is used to compensate to compensate , so as to compensate for the image background information during the i-th round of training. Specifically, the KL divergence between and is calculated, and the KL divergence between , and the calculation formula is:
[0062]
[0063]
[0064] and is added to the loss function. The expression of the total loss function L is represented as:
[0065]
[0066] Step 4) Train the improved YOLO v3 network model using the image data set with class and location labels described in step 2, with the following specific operations:
[0067] Step 4-1) Normalize the pictures used for training to 416x416 pixels;
[0068] Step 4-2) Set the model parameters:
[0069] The training iteration period is set to epoch = 200, the initial learning rate is set to lr = 5e-5, and the pictures put into the network for training each time are set to batch_size = 8;
[0070] Step 4-3) Extract features from the pictures through the backbone network part to obtain three effective feature maps of different sizes, fuse the features of the three different sizes, extract high-dimensional features through upsampling operations during the fusion process, and then fuse them with features of different scales to form a detection head. Finally, the detection results are output by the prediction head to obtain the detection model;
[0071] Step 4-4) After 200 iterations, the loss function tends to be stable, proving that the model is reliable;
[0072] Step 5) Use the improved YOLO v3 model after training to perform the final detection of underwater fish using the non-maximum suppression method, with a threshold value of NMS = 0.5. Through the above steps, high-accuracy detection of underwater fish can be achieved.
[0073] As shown in the mAP value comparison chart before and after the improvement of YOLO v3, the horizontal coordinate in the chart represents the value of m, and the vertical coordinate represents the average AP value. The AP value is the average precision. Figure 4 From the chart, it can be seen that when appropriate m = 80, a = 0.95, and T = 10, the mAP of the improved underwater target detection network is 96.57%, and the mAP of the original network is 94.08%. The mAP of the original network is improved by 2.49%. Figure 4 Based on the above analysis, the improved target detection network can improve the accuracy of underwater target detection based on background information compensation, and is helpful for underwater target detection.
[0074]
[0075] The preferred embodiments of the application disclosed above are only to facilitate the understanding of the application, and do not limit the application to the specific embodiments described. It is apparent that many modifications and variations can be made according to the contents of the present specification. The present specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the application, so that those skilled in the art can well understand and utilize the application.
Claims
1. A target detection method based on background information compensation, characterized in that, Comprise the following steps: Step 1, collect data, build data set: Determine the species to be detected, collect the photos of the corresponding species, and build the data set required for the detection task; Step 2, label the data set: The collected data set is labeled to generate a data set in the visual challenge competition data set labeling format, so that the training set accounts for 81%, the validation set accounts for 9%, and the test set accounts for 10%; Step 3, build target detection network: The target detection network is divided into training network and test network: The test network is composed of the original YOLO v3 network, which is composed of a backbone network, a feature fusion network and a detection head. The backbone network uses Darknet-53, which is used to extract features and form feature maps of different sizes; The feature fusion network fuses the feature maps of different sizes extracted from the backbone network; the detection head is formed by convolution after the fused feature map; when detecting, only the image needs to be input into the backbone network, and finally the target is detected in the detection head; The training network is based on the YOLO v3 training network and has been modified in the [missing information - likely a specific step or step]. During the first round of training, the first... The model information obtained from the first training round is fed back to the second round. In the first round of training, and the feedback... The model information obtained from the first training round can compensate for the second round of training. During the first training round, background information of the image is ignored in order to improve the performance of the second training round. The model's fitting ability is improved, while also achieving a partial self-supervision. The model information fed back in step 3 includes the following steps: No. The network was trained in rounds to obtain three prediction heads. , and Feature map, The size is , The size is , The size is ,in This refers to the number of channels in the feature map, which is determined based on the type of target being detected. , and The feature map size is uniformly denoted as , represented as ,Right now ,in Representing the During the first round of training The width of each feature map, Choose 1, 2, or 3; Representing the During the first round of training The length of each feature map is calculated using the following formula: , 3 represents the determination of each target generates 3 anchor boxes, 4 represents the center point coordinates of the anchor box and the length and width of the anchor box, 1 represents the confidence of the anchor box, represents the number of types of detected targets; No. The three prediction heads obtained during the model's prediction in the training round are denoted as... , and The three feature maps of the prediction head , and Unified as ,Right now ,in Representatives used the first The model obtained from the first training round predicts the first time. The width of each feature map, Choose 1, 2, or 3; Representatives used the first The model obtained from the first training round predicts the first time. The length of each feature map; extracting background knowledge related to the task to assist attention to background knowledge, including: extracted first maximum value on each channel and mean value are expressed by the following equations, respectively, as a representative of the channel , At the same time for the maximum value on each channel and the mean value there are still the following formulas: At the same time, the loss function of the original YOLO v3 network during training is recorded as The loss function of the improved target detection network is recorded as , is expressed as the following expression: In the above expression It is the balance coefficient, and its value range is... ; These are the current training coefficients, which are positive integers. This represents the total number of training iterations during the experiment, and is a positive integer. Indicates KL divergence; It is a custom coefficient, and its value range is expressed as follows: N + l1 represents positive integers; l1 represents... for The amount of background knowledge provided; l2 represents for The amount of background information provided; Step 4, training network: Use the training set and validation set described in step 2 to train the training network in step 3; Step 5, target detection test: Use the network trained in step 4 to test the test set in step 2 to verify the training result, and detect the species in step 1.
Citation Information
Patent Citations
Deep inverse reinforcement learning-based target detection method in unmanned aerial vehicle aerial video based on deep inverse reinforcement learning
CN110321811A
Light-weight and high-efficiency target detection method applied to embedded platform
CN111723747A