An object detection method based on incremental learning
By adding an image reconstruction error module and an incremental learning module to the target detection network, and designing image reconstruction loss functions with different weights, we solve the problem of low detection accuracy of existing incremental learning methods in new category tasks, and achieve Methods for high-precision detection in new category tasks and maintaining the detection capabilities of old categories.
Patent Information
- Application Number
- CN202110717472.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-06-28
AI Technical Summary
When existing incremental learning methods add new category tasks, they often lead to a decrease in the detection capabilities of old categories and cannot effectively improve the detection accuracy in new category tasks.
By adding an image reconstruction error module to the target detection network, we design image reconstruction loss functions with different weights for low-frequency and high-frequency components, build a complete feature space, and add incremental learning modules in the feature space to gradually optimize and train the network. parameters to maintain the detection capability of old categories and improve the detection accuracy of new categories.
It achieves significant improvement in detection accuracy in new category tasks, maintains the detection capabilities of old categories, and builds a rich related feature space containing tasks of each category.
Smart Images

Figure CN113536971B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of incremental learning of a deep network model, and in particular to a target detection method based on incremental learning. Background Art
[0002] Object detection algorithms have been widely used in real life. In specific scenarios, the accuracy of object detection algorithms has gradually increased to a state of near saturation. However, in real life, with the emergence of new demands and the increase in the types of products, the categories that object detection algorithms need to judge have also increased. If a new neural network model is re-established, or new detectable categories are added to an existing object detection model, and the existing network is directly trained using a data set of the new category, the trained model will largely lose its detection ability on the old categories. Based on this, researchers proposed incremental learning, which allows a learner to obtain new knowledge from new data while retaining the old knowledge learned from previous data.
[0003] Existing incremental learning methods can be divided into two categories: one is based on the idea of model distillation, which makes the output of the new network similar to the output of the original network in the old category task by designing a retention loss function; and the network is effectively detected in the new category data by detecting the new task loss function. By designing this loss function and fine-tuning the overall network, most of the detection ability of the old category can be preserved. This method changes the parameters of the original related tasks, and there will be changes in the classification ability of the original category, but the accuracy is higher in the new category task. The other is based on the idea of feature extraction, which uses the front layer of the network as a general feature extractor. When detecting new categories, a new output layer is added to the existing network. In the training stage, the parameters of the newly added output layer are trained with the new category data, so that the new model can effectively detect the newly added category task. This method does not change the parameters of the original class, so the classification ability of the original class is fully preserved, but the accuracy is not high in the new category task. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to propose a target detection method based on incremental learning to improve the detection accuracy of the algorithm in newly added category tasks.
[0005] The technical solution of the present invention to achieve the above-mentioned purpose is: a target detection method based on incremental learning, characterized in that: S1, using the original data set, and preprocessing the image data therein, adjusting the image to the size set by the expected target detection network; S2, building a target detection network, and adding an image reconstruction error module to the image classification feature layer of the target detection network, and extracting abstract and complete image features based on image reconstruction; S3, integrating the loss function of image reconstruction and the original target detection network, training and optimizing the target detection network, so that the image reconstruction loss function and the target detection network loss function converge, and saving the weight parameters of the optimized network; S4, using the new task data set, and preprocess the image data therein, and adjust the image to the size set by the network; S5, build a new network model based on the class incremental target detection network, and add an incremental learning module in the feature space of the network; S6, load the weight parameters obtained in step S3 in the new network model, and randomly initialize the parameters of the incremental learning module; S7, use the new task data set to train only the classification network and regression network of the incremental learning module, and make the loss functions of classification and regression converge, and save the weight parameters of the incremental target detection network; S8, deploy the optimized parameters to detect the target; S9, add a new category task, and repeat steps S4~S8.
[0006] The new technical solution for target detection using the present invention has significant advancement: this method constructs a relatively more complete feature space that contains rich relevant features for each category of tasks by designing an image reconstruction loss function that assigns different weights to low-frequency and high-frequency components in the image, thereby improving the detection accuracy of the algorithm in newly added category tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 This is a schematic diagram of a Yolo v4 incremental learning network framework based on a complete feature space in the method of the present invention.
[0008] Figure 2 This is a Yolo v4 incremental learning network module diagram based on a complete feature space in the method of the present invention.
[0009] Figure 3 Schematic diagram of a Faster RCNN incremental learning network framework based on a complete feature space in the method of the present invention.
[0010] Figure 4 The figure is a schematic diagram of a frequency division graph pyramid architecture constructed during the implementation of the method of the present invention. DETAILED DESCRIPTION
[0011] The specific implementation modes of the present invention will be further described below in conjunction with the accompanying drawings to make the technical solution of the present invention easier to understand and grasp, thereby making a clearer definition of the protection scope of the present invention.
[0012] In actual scenarios, using a deep convolutional neural network as a feature extractor can obtain abstract features. However, affected by the current learning task, the features of the network before the classification stage will focus on the current detection task, retaining the direct and effective features applicable to the current task, resulting in the loss of features in the image that are not related to the current task. Therefore, the features extracted by the deep convolutional neural network are only applicable to the current detection task. In order not to change the classification performance of the original model, the present invention designs and proposes a target detection method, which performs incremental learning based on the idea of feature extraction, so that the feature space remains relatively complete. The outlined steps are described as follows; S1. Use the original data set, and preprocess the image data therein to adjust the image to the size set by the expected target detection network; S2. Construct a target detection network, and add an image reconstruction error module to the image classification feature layer of the target detection network, and obtain abstract and complete image features based on image reconstruction extraction; S3. Comprehensively consider the loss function of the image reconstruction and the original target detection network, train and optimize the target detection network, so that the image reconstruction loss function and the target detection network loss function converge, and save the weight parameters of the optimized network; S4. Use a new task data set, and preprocess the image data therein to adjust the image to the size set by the expected target detection network; S2. Construct a target detection network, and add an image reconstruction error module to the image classification feature layer of the target detection network, and extract abstract and complete image features based on the image reconstruction; S3. Comprehensively consider the image reconstruction and the loss function of the original target detection network, train and optimize the target detection network, so that the image reconstruction loss function and the target detection network loss function converge, and save the weight parameters of the optimized network; S4. Use a new task data set, and preprocess the image data therein to adjust the image to the size set by the expected target detection network; S5. Preprocess the data and adjust the image to the size set by the network; S5. Build a new network model based on the class incremental target detection network and add an incremental learning module in the feature space of the network; S6. Load the weight parameters obtained in step S3 in the new network model and randomly initialize the parameters of the incremental learning module; S7. Use the new task data set to train only the classification network and regression network of the incremental learning module, and make the classification and regression loss functions converge, and save the weight parameters of the incremental target detection network; S8. Deploy the optimized parameters to detect the target; S9. Add a new category task and repeat steps S4~S8.
[0013] More specifically, step S1 includes the following detailed steps: S101, preprocessing the image by methods such as color enhancement, translation change, horizontal and vertical flipping, and random mosaic; S102, using a bilinear interpolation algorithm to scale the image data size to a fixed resolution, such as 416×416.
[0014] The specific method of adding the image reconstruction error module in the image classification feature layer of the target detection network in step S2 is as follows: S201, adding the image information reconstruction module before the classification and regression convolution layer of the first-stage target detection network, for example, adding the module in the Yolo v4 network, the adding process is as follows Figure 1 and Figure 2By adding image reconstruction error modules (i.e., image information reconstruction modules shown in the figure) before the classification and regression convolution layers at different levels, the network at the current level is assisted to extract abstract and complete image features; S202, after the feature extraction layer of the two-stage target detection network, an image reconstruction error module is added, such as adding this module in the Faster RCNN network, and the adding process is as follows: Figure 3 As shown. By adding an image information reconstruction module after the feature extraction layer of the network, the auxiliary feature extraction network extracts abstract and complete image features; S203, the image information reconstruction module consists of a convolution layer and an upsampling layer, which consists of a 3×3 convolution layer, a 1×1 convolution layer and an upsampling layer. The feature map first passes through a 3×3 convolution layer, and then uses an upsampling operation (such as reshape, bilinear difference, etc.) to adjust the width and height of the feature map to the width and height of the input image, and finally uses a 1×1 convolution layer to generate a reconstructed image.
[0015] It should be noted that the above-mentioned first-stage target detection network is not limited to the Yolo v4 network. The same type of network also includes SSD, and even Yolo itself has multiple series such as v1~v5. The above description and the following text only take Yolo v4 as an example. Similarly, the second-stage target detection network is also described only by examples including but not limited to the Faster RCNN network.
[0016] The specific operation of the comprehensive image reconstruction loss and the loss function of the target detection network in step S3 is as follows: S301. The loss function of the network consists of two parts, as shown in formula (1): As shown. It is the loss term of the target detection network, which is usually composed of error terms such as box regression loss, classification loss and confidence loss. is the image reconstruction loss term, which is given by formula (2): Calculated. Among them, Respectively represent the error between the predicted image and the real image label in each channel of R, G, and B, and the measurement method is Loss, the real image label can be a single color image or a combination of a series of high and low frequency components of the R, G, and B channels in the color image.
[0017] Construct a frequency distribution graph pyramid. The image of each color channel of a color image can be decomposed into a series of high- and low-frequency images. Taking the R channel as an example, each high- and low-frequency image corresponds to a frequency component graph, referred to as a frequency distribution graph. The combination formed by decomposing a series of frequency distribution graphs is called a frequency distribution graph pyramid. The frequency distribution graph pyramid has n+1 layers in total. The frequency distribution graph of each layer can generate a low-frequency component graph and a high-frequency component graph by the Gaussian convolution method. The low-frequency component graph is given by formula (3): Calculated; among them, is the R channel image of the original image, is the low-frequency component image extracted from the R channel of the original image, * represents two-dimensional convolution, and G is the two-dimensional Gaussian convolution kernel. The two-dimensional Gaussian convolution kernel is expressed by formula (4): The generating function shown is obtained, Represents variance.
[0018] For the high-frequency component image extracted from the R channel of the original image , then according to formula (5): Calculated.
[0019] Using the above calculation method of high-frequency component graph and low-frequency component graph, we constructed the following Figure 4 The frequency division pyramid is shown.
[0020] Then, the image information reconstruction error is constructed based on the frequency division graph pyramid. In an image, the background often occupies most of the image, and the target is a part of the image that is not in a fixed position and occupies a relatively small proportion. Therefore, during the reconstruction of the image, the network needs to focus on this small area. The high-frequency information of the image corresponds to the area where the pixel value changes dramatically in the image, especially the junction of the target and the background. Therefore, this application enhances the saliency of the target area by extracting different frequency division graphs of the picture, so that the network focuses on the target area to ensure the completeness of the feature space.
[0021] To this end, a reconstruction loss function that assigns different weights to the low-frequency and high-frequency components in the image is also designed in this step. There are two forms:
[0022] The first is to directly predict the high and low frequency component images and assign different error weights to the low frequency components and high frequency components in each channel image. The reconstruction loss function corresponding to the R channel is given by formula (6): Calculated, where L is the number of frequency distribution images of the R channel of the image, Indicates i The error weight of the frequency distribution map, is the prediction result of the i-th frequency distribution image in the image R channel, is the first i The true label of the frequency distribution map, A measure of loss.
[0023] Depending on the application scenario, different frequency division images are selected from the real label as the real label information. In practical applications, in order to simplify the computation of the network, the real label is an interpolated image with a resolution of 208×208. For example, 8 frequency division images of the same type are selected from each channel of the color image, namely the original channel image, the frequency division image, and the real label information. Figure 1 , Frequency division diagram 0-1, Frequency division Figure 1-0, frequency division diagram 0-0-1, frequency division diagram 0-1-1, frequency division Figure 1 -0-0, frequency division Figure 1-1 -0. Therefore, the number of tensor channels output by the image information reconstruction module in the network is 24, and each channel corresponds to a frequency map. Then, the error is calculated on each frequency map. Finally, all frequency map errors are summed up to obtain the final image reconstruction error.
[0024] The second form of reconstruction loss function is to use the high-frequency component as the weight coefficient of the loss function. The corresponding R channel reconstruction loss function is given by formula (7): Calculated. Among them, is the prediction result of the image R channel, represents the true label of the R channel of the image, w and h represent the width and height of the image respectively, represents the weight coefficient of each pixel in the R channel, and the weight coefficient is given by formula (8): Calculated, among which, L is the number of frequency distribution images of the R channel of the image, Indicates i The error weight of the frequency distribution map, is the i-th frequency distribution image in the R channel of the image, γ is a power.
[0025] The specific operation of the above step S4 is: obtain the newly added data set, and pre-process the image by methods such as color enhancement, translation change, horizontal and vertical flipping, and random mosaic; then use bilinear interpolation to scale all image data to a fixed resolution, such as 416×416.
[0026] The specific steps of the above step S5 are: inserting an incremental learning module in the complete feature space to output the detection results of the incremental class. The incremental learning module is composed of a convolutional layer or a fully connected layer. In a two-stage target detection network such as Faster RCNN, the added incremental learning module (or ICL module) includes an ICL-RPN module and an ICL-fc layer. Among them, the ICL-RPN module is used to generate candidate boxes of the incremental class and adopts the same structure as the RPN network. The ICL-fc layer is used to output the box and category information of the incremental class detection task, corresponding to the fully connected layer in the original FastRCNN. In a one-stage target detection network such as Yolo v4, ICL_Conv modules are added to the FPN-s1, FPN-s2, and FPN-s3 modules of the original network respectively to output the box and category information of the new incremental class detection task. The ICL_Conv module consists of 3×3 convolution and 1×1 convolution layers.
[0027] The specific steps of the above step S6 are: in the new network model, the parameters of the structure part that is the same as the old model before the new data set is added use the parameters of the old model that were previously saved, and in the newly added incremental learning module, the parameters are generated using the random initialization method. In different cases, in a two-stage target detection network such as Faster RCNN, the modules that need to randomly initialize parameters are the ICL-RPN module and the ICL-fc layer. In a one-stage target detection network such as Yolo v4, the module that needs to randomly initialize parameters is the ICL_Conv module added in the three detection stages.
[0028] The specific steps of the above step S7 are: use the newly added data set to train the incremental target detection network based on the complete feature space. The loss function of the training is the loss function of the corresponding target detection network. In a two-stage target detection network such as Faster RCNN, the loss function includes the box regression and classification error of ICL-RPN, and the precise box regression and classification error of the ICL-fc layer. In a one-stage target detection network such as Yolo v4, the loss function is the box regression error, confidence error and classification error. When the loss function converges, save all the parameters of the incremental target detection network.
[0029] The specific steps of the above step S8 include: in the inference stage, the prediction process of the incremental learning network is similar to the output process of the original target detection network.
[0030] In a two-stage target detection network such as Faster RCNN, the candidate box information, precise box regression information, and classification information of the RPN of the original category are calculated first, and then the candidate box information, precise box regression information, and classification information of the RPN of the newly added category are calculated. In a one-stage target detection network such as Yolo v4, the confidence, candidate box, and category information of the original category are calculated first, and then the confidence, candidate box, and category information of the newly added category are calculated.
[0031] In summary, the object detection method based on incremental learning of the present invention is described in detail in combination with the illustrated embodiment, which shows that it has outstanding substantive features and significant progress. The method constructs a relatively more complete feature space containing rich relevant features of each category task by designing an image reconstruction loss function that assigns different weights to low-frequency and high-frequency components in the image, thereby improving the detection accuracy of the algorithm in the newly added category tasks.
[0032] In addition to the above embodiments, the present invention may also have other implementation modes. Any technical solutions formed by equivalent replacement or equivalent transformation shall fall within the scope of protection required by the present invention.
Claims
1. A target detection method based on incremental learning, characterized in that: S1. Use the original dataset and preprocess the image data to adjust the image to the size set by the expected target detection network; S2. Build a target detection network and add an image reconstruction error module to the image classification feature layer of the target detection network. Decompose the image of each color channel of the color image R, G, B into a series of high- and low-frequency images to form a frequency distribution pyramid, and extract abstract and complete image features. S3, assigning different weights to the low-frequency and high-frequency components in the image to calculate the reconstruction error, integrating the loss function of the image reconstruction and the original target detection network, training and optimizing the target detection network, so that the image reconstruction loss function and the target detection network loss function converge, and saving the weight parameters of the optimized network; S4, use the new task data set, preprocess the image data therein, and adjust the image to the size set by the network; S5. Build a new network model based on the class incremental target detection network and add an incremental learning module in the feature space of the network; S6, loading the weight parameters obtained in step S3 into the new network model, and randomly initializing the parameters of the incremental learning module; S7. Use the new task data set to train only the classification network and regression network of the incremental learning module, and make the classification and regression loss functions converge, and save the weight parameters of the incremental target detection network; S8, deploy the optimized parameters and detect the target; S9. Add a new category of tasks and repeat steps S4 to S8.
2. The target detection method based on incremental learning according to claim 1, characterized in that: The preprocessing in step S1 at least includes color enhancement, translation change, horizontal flip, vertical flip, and random mosaic; and the image is adjusted to a predefined fixed resolution using a bilinear interpolation algorithm.
3. The target detection method based on incremental learning according to claim 1, characterized in that: The image reconstruction error module is composed of a 3×3 convolution layer, a 1×1 convolution layer and an upsampling layer, and its function is to first pass the classification features of the image through the 3×3 convolution layer, then use the upsampling operation to adjust the size of the feature image to the size of the input image, and then use the 1×1 convolution layer to generate a reconstructed image; step S2 adds the image reconstruction error module before the classification and regression convolution layer of the one-stage target detection network, or adds the image reconstruction error module after the feature extraction layer of the two-stage target detection network.
4. The target detection method based on incremental learning according to claim 1, characterized in that: Step S3 includes: S31. Analyze the loss function of the network after image reconstruction, and the loss term loss of the original target detection network obj_det And image reconstruction loss loss img_rec It consists of two parts, as shown in formula (1): loss total =loss img_rec +loss obj_det The calculation shows that, among them, loss obj_det It is composed of box regression loss, classification loss and confidence loss, while image reconstruction loss img_rec According to formula (2): loss img_rec =lossr img_rec +lossg img_rec +lossb img_rec The calculation shows that lossr img_rec 、lossg img_rec 、lossb img_rec Respectively represent the error between the predicted image and the real image label in each channel of R, G, and B; S32. Decompose the image of each color channel of the color image to obtain a series of high- and low-frequency images, where each high- and low-frequency image corresponds to a frequency component map, referred to as a frequency distribution map, and generate a low-frequency component map and a high-frequency component map through Gaussian convolution of the frequency distribution map, and combine them to construct a frequency distribution map pyramid. For the original image R channel, extract the low-frequency component map imgr low_fre , according to formula (3): imgr low_fre =imgr*G, where imgr is the R channel image of the original image, * is the two-dimensional convolution, and G is the two-dimensional Gaussian convolution kernel, according to formula (4): The generating function is obtained, where σ represents the variance; for the original image R channel, the high-frequency component image imgr is extracted high_fre , according to formula (5): imgr high_fie =mgr-imgr low_fre Calculated; S33. Construct image information reconstruction error based on frequency division image pyramid.
5. The target detection method based on incremental learning according to claim 4, characterized in that: In step S33, based on the high-frequency component map and low-frequency component map directly predicted by the corresponding channel image, the error weights corresponding to the low-frequency component and the high-frequency component are assigned, and the reconstruction loss function of the R channel of the corresponding image is expressed by formula (6): Calculated, where L is the number of frequency division images of the R channel of the image, a i represents the error weight of the i-th frequency image, predr(i) is the predicted result of the i-th frequency image in the R channel of the image, gtr(i) is the true label of the i-th frequency image in the R channel of the image, and L1 is a loss metric.
6. The target detection method based on incremental learning according to claim 4, characterized in that: In step S33, the high frequency component is used as the weight coefficient of the loss function, and the reconstruction loss function of the corresponding image R channel is expressed by formula (7): Calculated, where predr is the predicted result of the R channel of the image, gtr represents the true label of the R channel of the image, w and h represent the width and height of the image respectively, and weightr img_rec represents the weight coefficient of each pixel under the R channel, and the weight coefficient is given by formula (8): Calculated, where L is the number of frequency division images of the R channel of the image, α i Represents the error weight of the i-th frequency image, fre_img(i) is the i-th frequency image in the R channel of the image, and γ is the power.
7. The target detection method based on incremental learning according to claim 1, characterized in that: The incremental learning module in step S5 is composed of a convolutional layer or a fully connected layer and is inserted into the feature space; for Yolo v4 in the one-stage target detection network, ICL_Conv modules are added to the three modules FPN-s1, FPN-s2, and FPN-s3 respectively to output the box and category information of the new incremental detection task; for Faster RCNN in the two-stage target detection network, ICL-RPN module and ICL-fc layer are added, wherein the ICL-RPN module is used to generate candidate boxes of the same structure and incremental class as the RPN network, and the ICL-fc layer is used to output the box and category information of the incremental detection task.
8. The target detection method based on incremental learning according to claim 1, characterized in that: For the new network model constructed in step S5, the weight parameters saved in step S3 are loaded into the same structural part as the incremental target detection network, and for Yolo v4 in the one-stage target detection network, the objects of random initialization parameters are the three ICLConv modules, and for Faster RCNN in the two-stage target detection network, the objects of random initialization parameters are the ICL-RPN module and ICL-fc layer.
9. The target detection method based on incremental learning according to claim 1, characterized in that: The loss function trained in step S7 is the loss function of the corresponding target detection function. For Yolo v4 in the one-stage target detection network, the loss function is the box regression error, confidence error and classification error; for Faster RCNN in the two-stage target detection network, the loss function includes the box regression and classification error of ICL-RPN, and the precise box regression and classification error of the ICL-fc layer.
10. The target detection method based on incremental learning according to claim 1, characterized in that: In step S8, in the inference stage, the prediction process of the incremental learning network refers to the output process of the original target detection network; for Yolo v4 in the one-stage target detection network, the confidence, candidate box and category information of the original category are calculated first, and then the confidence, candidate box and category information of the newly added category are calculated; for Faster RCNN in the two-stage target detection network, the candidate box information and precise box regression information and classification information of the RPN of the original category are calculated first, and then the candidate box information and precise box regression information and classification information of the RPN of the newly added category are calculated.
