A training method and device for target detection model

Through pre-training of the first training image without annotation and incremental learning of the second training image, the problem of long training period and high cost of the target detection model in the existing technology is solved, and more efficient model training and more accurate are achieved. Target detection.

CN113822302BActive Publication Date: 2024-09-27BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010559883.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-18
Publication Date
2024-09-27
Estimated Expiration
2040-06-18

AI Technical Summary

Technical Problem

Existing target detection models require manual annotation during the training process, resulting in a long training cycle and high cost, requiring a large amount of manpower and material resources.

Method used

Pre-training is performed through the first training image that does not require annotation to obtain the initial target detection model, and then the second training image is used to continue training, and the incremental learning algorithm is used to optimize the model capabilities.

Benefits of technology

It reduces the cost of labeling sample data, improves the accuracy of target detection, and speeds up model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113822302B
    Figure CN113822302B
Patent Text Reader

Abstract

The present application provides a method and device for training a target detection model, wherein the method for training the target detection model includes: obtaining a first training image; inputting the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image; inputting the first training image and the first candidate region information into a target detection model to be trained for training to obtain an initial target detection model; obtaining a second training image and second candidate region information corresponding to the second training image; inputting the second training image and the second candidate region information into the initial target detection model for continued training to obtain a target detection model. This method reduces the cost of labeling sample data, improves the accuracy of target detection, and speeds up the training of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and device for training a target detection model, an image detection method and device, a computing device, and a computer-readable storage medium. Background Art

[0002] With the development of artificial intelligence technology, automatic labeling systems have been widely used. Automatic labeling systems are applications based on target detection models. After the image to be detected is input into the target detection model, the target detection model responds to the input image to be detected and labels the corresponding detection content.

[0003] During the training process of existing target detection models, it is necessary to manually annotate training images, mark the detection content in the training images, and then input the annotated training images into the target detection model for training. However, this training method requires a long training cycle and a large number of manually annotated training images for training. Therefore, it takes a lot of manpower and material resources, which increases the cost of training the model.

[0004] Therefore, how to shorten the model training cycle and reduce the model training cost has become an urgent problem that technical personnel need to solve. Summary of the invention

[0005] In view of this, the embodiments of the present application provide a method and apparatus for training a target detection model, a computing device, and a computer-readable storage medium to address the technical defects existing in the prior art.

[0006] According to a first aspect of an embodiment of the present application, a method for training a target detection model is provided, comprising:

[0007] Acquire a first training image;

[0008] Inputting the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image;

[0009] Inputting the first training image and the first candidate region information into a target detection model to be trained to obtain an initial target detection model;

[0010] Acquire a second training image and second candidate region information corresponding to the second training image;

[0011] The second training image and the second candidate region information are input into the initial target detection model for further training to obtain a target detection model.

[0012] Optionally, the candidate region detection model includes a feature extraction layer, a candidate region network layer, a spatial pyramid pooling layer, and a pooling layer;

[0013] Inputting the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image includes:

[0014] Inputting the first training image into the feature extraction layer to extract a feature image of the first training image;

[0015] Inputting the feature image into the candidate region network layer to obtain a plurality of sub-candidate regions corresponding to the feature image;

[0016] Inputting the feature image and multiple sub-candidate regions into the spatial pyramid pooling layer to obtain a candidate feature vector corresponding to each of the sub-candidate regions;

[0017] Each of the candidate feature vectors is input into the pooling layer for pooling processing to obtain first candidate region information corresponding to the first training image.

[0018] Optionally, inputting each of the candidate feature vectors into the pooling layer for pooling processing includes:

[0019] Performing target recognition processing on each of the candidate feature vectors to obtain a first weight coefficient matrix, and / or performing target detection processing on each of the candidate feature vectors to obtain a second weight coefficient matrix;

[0020] Pooling processing is performed based on the first weight coefficient matrix and / or the second weight coefficient matrix.

[0021] Optionally, performing target recognition processing on each of the candidate feature vectors to obtain a first weight coefficient matrix includes:

[0022] Performing target recognition processing on each of the candidate feature vectors to obtain a weight coefficient for each category in each of the sub-candidate regions;

[0023] A first weight coefficient matrix is ​​generated according to each of the sub-candidate regions and the weight coefficient of the category in each of the sub-candidate regions.

[0024] Optionally, performing target detection processing on each of the candidate feature vectors to obtain a second weight coefficient matrix includes:

[0025] Perform target detection processing on each of the candidate feature vectors to obtain a weight coefficient of each category in each sub-candidate area;

[0026] A second weight coefficient matrix is ​​generated according to the weight coefficient of each category in each sub-candidate region and each of the sub-candidate regions.

[0027] Optionally, inputting the first training image and the first candidate region information into a target detection model to be trained for training to obtain an initial target detection model includes:

[0028] Inputting the first training image and the first candidate region information into a target detection model to be trained;

[0029] The target detection model generates first detection area information according to the first training image;

[0030] Calculating a first loss value according to the first detection area information and the first candidate area information;

[0031] The model parameters of the target detection model to be trained are adjusted according to the first loss value until the training conditions are met to obtain an initial target detection model.

[0032] Optionally, inputting the second training image and the second candidate region information into the initial object detection model to continue training to obtain the object detection model includes:

[0033] Inputting the second training image and the second candidate region information into the initial object detection model;

[0034] The initial target detection model generates second detection area information according to the second training image;

[0035] Calculating a second loss value according to the second detection area information and the second candidate area information;

[0036] The model parameters of the initial target detection model are adjusted according to the second loss value until the training conditions are met to obtain the target detection model.

[0037] According to a second aspect of an embodiment of the present application, there is provided an image detection method, comprising:

[0038] Acquire the image to be detected;

[0039] Inputting the image to be detected into a target detection model for target detection, wherein the target detection model is trained by any target detection model training method in the first aspect of the embodiments of the present application;

[0040] Obtain a detection result in the image to be detected output by the target detection model.

[0041] According to a third aspect of an embodiment of the present application, a training device for a target detection model is provided, comprising:

[0042] A first acquisition module is configured to acquire a first training image;

[0043] a candidate region information acquisition module, configured to input the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image;

[0044] A first training module is configured to input the first training image and the first candidate region information into a target detection model to be trained to obtain an initial target detection model;

[0045] A second acquisition module is configured to acquire a second training image and second candidate region information corresponding to the second training image;

[0046] The second training module is configured to input the second training image and the second candidate area information into the initial target detection model for further training to obtain a target detection model.

[0047] According to a fourth aspect of an embodiment of the present application, there is provided an image detection device, including:

[0048] A third acquisition module is configured to acquire an image to be detected;

[0049] A target detection module is configured to input the image to be detected into a target detection model for target detection, wherein the target detection model is trained by any target detection model training method in the first aspect of the embodiments of the present application;

[0050] The fourth acquisition module is configured to obtain the detection result in the image to be detected output by the target detection model.

[0051] According to a fifth aspect of an embodiment of the present application, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein when the processor executes the instructions, the steps of the training method of the target detection model or the image detection method are implemented.

[0052] According to a sixth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer instructions, which, when executed by a processor, implement the steps of the training method of the target detection model or the image detection method.

[0053] According to a seventh aspect of an embodiment of the present application, a chip is provided, which stores computer instructions, and when the instructions are executed by the chip, the steps of the training method of the target detection model or the image detection method are implemented.

[0054] The training method of the target detection model provided in the embodiment of the present application first pre-trains through a first training image that does not require labeling to obtain an initial target detection model, thereby achieving labeling from scratch and reducing the cost of labeling sample data. The second training image is then used to continue training, and the capability of the target detection model is optimized through an incremental learning algorithm, thereby improving the accuracy of target detection and accelerating the model training speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 is a structural block diagram of a computing device provided in an embodiment of the present application;

[0056] Figure 2 is a flow chart of a method for training a target detection model provided in an embodiment of the present application;

[0057] Figure 3a is the first training image provided in the embodiment of the present application;

[0058] Figure 3b is a schematic diagram of multiple sub-candidate regions output by the candidate region network provided in an embodiment of the present application;

[0059] Figure 3c is a schematic diagram of first candidate region information corresponding to a first training image provided in an embodiment of the present application;

[0060] Figure 4 is a schematic diagram of a method for generating first candidate region information by a candidate region detection model provided in an embodiment of the present application;

[0061] Figure 5 It is a structural diagram of the YoloV3 network provided in the embodiment of the present application;

[0062] Figure 6 It is a flowchart of the target detection model training method provided in the embodiment of the present application;

[0063] Figure 7 It is a schematic diagram of the architecture of the target detection model training method provided in the embodiment of the present application;

[0064] Figure 8 is a flow chart of a method for training a target detection model provided by another embodiment of the present application;

[0065] Fig. 9 is a flow chart of the image detection method provided in an embodiment of the present application;

[0066] Fig.10 It is a structural diagram of the training decoration of the target detection model provided in the embodiment of the present application;

[0067] Fig.11 It is a schematic diagram of the structure of the image detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0068] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0069] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.

[0070] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "in response to determination".

[0071] First, the terms involved in one or more embodiments of the present invention are explained.

[0072] First training image: The first type of training image of the target detection model, which does not include the candidate region information corresponding to the training image and is used for unsupervised training.

[0073] First candidate region information: candidate region information corresponding to the first training image detected by the candidate region detection model.

[0074] Candidate region detection model: a weakly supervised learning model that processes the first training image to obtain candidate region information corresponding to the first training image.

[0075] Initial target detection model: The target detection model trained with the first training image can generate candidate region information, but it is not accurate enough.

[0076] Second training image: The second type of training image of the target detection model, including the candidate region information corresponding to the training image, used for supervised training.

[0077] Second candidate region information: candidate region information corresponding to the second training image, including labels used for object detection model training.

[0078] Object detection model: After the object detection model is trained with the second training image, it has the ability to accurately detect objects in the image.

[0079] Region Proposal Network: A fully convolutional neural network that is used to generate high-quality region proposals.

[0080] Spatial pyramid pooling: Feature images of different sizes can be used as input, and features of a feature image can be extracted and aggregated from different angles to generate an output of a fixed size.

[0081] First detection area information: detection area information output by the target detection model to be trained according to the first training image during the training process.

[0082] Second detection area information: detection area information output by the initial object detection model according to the second training image during the training process.

[0083] Supervised learning: Supervised learning algorithms build predictive models by learning from a large amount of training data, where each training sample has its corresponding true output.

[0084] Weakly supervised learning: Weakly supervised learning algorithms allow the use of a small number of samples with true labels or samples with rough labels for training, thus obtaining results close to supervised learning.

[0085] Incremental learning: Incremental learning means that a learning system can continuously learn new knowledge from new samples and preserve most of the previously learned knowledge.

[0086] In the present application, a training method and apparatus for a target detection model, an image detection method and apparatus, a computing device, and a computer-readable storage medium are provided, which are described in detail one by one in the following embodiments.

[0087] Figure 1 The structure block diagram of a computing device 100 according to an embodiment of the present application is shown. The components of the computing device 100 include but are not limited to a memory 110 and a processor 120. The processor 120 is connected to the memory 110 via a bus 130, and the database 150 is used to store data.

[0088] The computing device 100 also includes an access device 140 that enables the computing device 100 to communicate via one or more networks 160. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 140 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0089] In one embodiment of the present application, the above components of the computing device 100 and Figure 1 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 1 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.

[0090] The computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 100 may also be a mobile or stationary server.

[0091] The processor 120 may execute Figure 2 Steps in the training method of the object detection model shown. Figure 2 A flowchart of a method for training a target detection model according to an embodiment of the present application is shown, including steps 202 to 210.

[0092] Step 202: Acquire a first training image.

[0093] The first training image is a first type of training image for the target detection model. The first training image does not include candidate region information corresponding to the training image and is used for unsupervised training.

[0094] The first training image can be obtained from an existing network library, such as ImageNet, or can be a self-created library for training. The first training image is a picture without candidate region information, that is, the first training image is an image without a bounding box.

[0095] In one embodiment provided in the present application, an image of a cat is used as an example to explain the method provided in the present application. Figure 3a , Figure 3a A first training image provided by an embodiment of the present application is shown. There is a cat in the image, and the first training image does not have a boundary box for identifying the cat area.

[0096] Step 204: input the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image.

[0097] The first training image is input into the classification network model, and the first training image is labeled. If the first training image is an image of a cat, the label of the first training image is "cat"; if the first training image is an image of a bird, the label of the first training image is "bird".

[0098] The first training image is input into a candidate region detection model, where the candidate region detection model is a weakly supervised learning model, and is used to process the first training image to obtain candidate region information corresponding to the first training image.

[0099] Optionally, the candidate region detection model includes a feature extraction layer, a candidate region network layer, a spatial pyramid pooling layer, and a pooling layer;

[0100] Optional, see Figure 4 , step 204 can be implemented through the following steps 402 to 408.

[0101] Step 402: Input the first training image to the feature extraction layer to extract a feature image of the first training image.

[0102] The feature extraction layer is used to extract the feature image of the first training image. The feature extraction layer may be a convolutional neural network with a residual structure from which a fully connected layer is removed. The convolutional neural network with a residual structure may be ResNet, ResNet18, ResNet50, etc.

[0103] In the embodiments provided in this application, the above example is used. Figure 3a The first training image shown is input into the ResNet50 convolutional neural network with the fully connected layer removed. The first training image is input into the ResNet50 model. The ResNet50 convolutional neural network includes a first convolutional layer group, a second convolutional layer group, a third convolutional layer group, a fourth convolutional layer group and a fifth convolutional layer group to extract the feature image of the first training image.

[0104] Step 404: Input the feature image into the candidate region network layer to obtain multiple sub-candidate regions corresponding to the feature image.

[0105] The candidate region network layer (RPN) is also a fully-convolutional network (FCN), which can be trained end-to-end for the task of generating detection proposal boxes. It can predict the boundaries and scores of objects at the same time, but it adds two additional convolutional layers (full convolutional layers cls and reg) on ​​the CNN. The input of the RPN network can be an image of any size. The feature image is input into the RPN, which encodes the position of each feature image to generate a feature vector, and outputs an objectness score and regressedbounds for k candidate regions (region proposal) for each position, that is, at each convolution mapping position, it outputs the object scores and candidate region information of k (3*3=9) region proposals of multiple scales (3 types) and aspect ratios (3 types) at this position, and obtains multiple sub-candidate regions corresponding to the feature image through the RPN layer.

[0106] In the embodiment provided in the present application, the above example is used to input the feature image into the candidate region network layer to obtain multiple sub-candidate regions corresponding to the feature image. Figure 3b , Figure 3b Multiple sub-candidate regions corresponding to the feature image output by the candidate region network are shown.

[0107] Step 406: input the feature image and multiple sub-candidate regions into the spatial pyramid pooling layer to obtain a candidate feature vector corresponding to each of the sub-candidate regions.

[0108] The Spatial Pyramid Pooling (SPP) layer can take feature images of different sizes as input, extract features from different angles of a feature image, and then aggregate them to generate a fixed-size output. Fixed-size feature vectors are extracted from multi-scale features to solve the problem of different feature image sizes. The fixed-size candidate feature vector corresponding to each sub-candidate region is obtained through the feature vector and multiple sub-candidate regions.

[0109] In the embodiment provided in the present application, the feature image output by the candidate region network and the corresponding multiple sub-candidate regions are input into the spatial pyramid pooling layer to obtain a candidate feature vector corresponding to each sub-candidate region.

[0110] Step 408: Input each of the candidate feature vectors into the pooling layer for pooling processing to obtain first candidate region information corresponding to the first training image.

[0111] The candidate feature vectors corresponding to each sub-candidate region are pooled to obtain first candidate region information corresponding to the first training image.

[0112] Optionally, each of the candidate feature vectors is input into the pooling layer for pooling processing, including: performing target recognition processing on each of the candidate feature vectors to obtain a first weight coefficient matrix, and / or performing target detection processing on each of the candidate feature vectors to obtain a second weight coefficient matrix; and performing pooling processing based on the first weight coefficient matrix and / or the second weight coefficient matrix.

[0113] In practical applications, only target recognition processing can be performed on each candidate feature vector to obtain a first weight coefficient matrix, or target detection processing can be performed on each candidate feature vector to obtain a second weight coefficient matrix, or target recognition processing can be performed on each candidate feature vector to obtain a first weight coefficient matrix and target detection processing can be performed on each candidate feature vector to obtain a second weight coefficient matrix. Preferably, target recognition processing can be performed on each candidate feature vector to obtain a first weight coefficient matrix and target detection processing can be performed on each candidate feature vector to obtain a second weight coefficient matrix.

[0114] Optionally, each of the candidate feature vectors is subjected to target recognition processing to obtain a first weight coefficient matrix, including: each of the candidate feature vectors is subjected to target recognition processing to obtain a weight coefficient for each category in each of the sub-candidate areas; and a first weight coefficient matrix is ​​generated according to the weight coefficients of each of the sub-candidate areas and the categories in each of the sub-candidate areas.

[0115] The first weight coefficient matrix is ​​obtained by performing target recognition processing on each candidate feature vector, performing target recognition processing on each candidate feature vector, obtaining the weight coefficient of each category in each sub-candidate area, and generating the first weight coefficient matrix M*N according to the weight coefficients of each sub-candidate area and the category in each sub-candidate area, where M is the category and N is the sub-candidate area.

[0116] Optionally, each of the candidate feature vectors is subjected to target detection processing to obtain a second weight coefficient matrix, including: performing target detection processing on each of the candidate feature vectors to obtain a weight coefficient of each category in each sub-candidate area; and generating a second weight coefficient matrix based on the weight coefficient of each category in each sub-candidate area and each of the sub-candidate areas.

[0117] The second weight coefficient matrix is ​​obtained by performing target detection processing on each candidate feature vector. Target detection processing is performed on each obtained candidate feature vector to obtain the weight coefficient of each category in each sub-candidate area. According to the weight coefficient of each category in each sub-candidate area and each of the sub-candidate areas, a second weight coefficient matrix N*M is generated, where N is the sub-candidate area and M is the category.

[0118] In the embodiment provided in the present application, the first weight coefficient matrix and the second weight coefficient matrix are pooled using the above example, and the first weight matrix and the second weight matrix are transposed matrices. The first weight matrix and the second weight matrix are element-wise multiplied to obtain the score of each sub-candidate region. The first candidate region information is obtained according to the score of each sub-candidate region, and the first candidate region information identifies the candidate box in the first training image, such as Figure 3c As shown, Figure 3c It shows that the first training image passes through the candidate region detection model to obtain the first candidate region information corresponding to the first training image.

[0119] Step 206: input the first training image and the first candidate region information into the target detection model to be trained to obtain an initial target detection model.

[0120] The target detection model to be trained is a model that does not have target detection capability, and the target detection model to be trained may be a Faster R-CNN, SSD, or Yolo model.

[0121] The initial target detection model is a target detection model trained by the first training image. The initial target detection model can generate candidate region information, but it is not accurate enough.

[0122] Optionally, the first training image and the first candidate area information are input into the target detection model to be trained for training to obtain an initial target detection model, including: inputting the first training image and the first candidate area information into the target detection model to be trained; the target detection model generates first detection area information based on the first training image; calculates a first loss value based on the first detection area information and the first candidate area information; adjusts model parameters of the target detection model to be trained according to the first loss value until training conditions are met, to obtain an initial target detection model.

[0123] In the embodiments provided in this application, the above example is used, and the YoloV3 model is taken as an example to further explain this application.

[0124] The first 52 layers of the network structure of the darknet-53 network used by the YoloV3 network are as follows Figure 5 As shown, Figure 5 Shown is a structural diagram of the YoloV3 network.

[0125] Among them, DBL is the basic component of YoloV3, which is convolution + BN + Leaky relu. For YoloV3, BN and Leaky relu are inseparable parts of the convolution layer and together constitute the smallest component.

[0126] The n in resn represents a number, such as res1, res2, ..., res8, etc., indicating how many res_units are contained in this res_block. It is a large component of YoloV3. YoloV3 began to borrow the residual structure of ResNet, and using this structure can make the network structure deeper.

[0127] Concat is tensor concatenation, which concatenates the darknet middle layer and the upsampling of a subsequent layer. The concatenation operation is different from the residual layer add operation. Concatenation will expand the dimension of the tensor, while add is just a direct addition and will not cause the tensor dimension to change.

[0128] like Figure 5 As shown, YoloV3 outputs three feature images Y1, Y2, and Y3 of different scales, where the depth of Y1, Y2, and Y3 is 255, and the side length rule is 13:26:52. Three prediction boxes will be output in each feature image, totaling 9 prediction boxes, and then the prediction box with the highest probability score of the target existence is found from the 9 prediction boxes as the first detection area information.

[0129] The cross entropy loss value is calculated based on the first detection area information and the first candidate area information, and the target detection model to be trained is adjusted by back propagation based on the loss value until an initial target detection model is obtained. At this time, the initial target detection model uses the first candidate area information generated by the candidate area detection model as the true value to train the first training model, so the recognition of the initial target detection model is not accurate enough. It is necessary to continue training.

[0130] Step 208: Acquire a second training image and second candidate region information corresponding to the second training image.

[0131] Second training image: The second type of training image of the target detection model, including the candidate region information corresponding to the training image, is used for supervised training. The second training image can be an image with precise candidate region information, or it can be manual review information feedback returned in actual applications. For example, during the use of the initial target detection model, if the user finds that the recognized annotation information is not accurate enough, the user interactively corrects the annotation information and stores the accurate annotation information. The first training image with accurate annotation information can also be used as the second training image.

[0132] Step 210: Input the second training image and the second candidate region information into the initial target detection model to continue training and obtain a target detection model.

[0133] The second candidate region information corresponding to the second training image and the second training image is input into the initial target detection model, where the second candidate region information is the bounding box of the second training image. The second candidate region information corresponding to the second training image and the second training image is input into the initial target detection model for continued training, and the initial target detection model is incrementally learned to finally obtain a target detection model.

[0134] Optionally, the second training image and the second candidate area information are input into the initial target detection model to continue training to obtain a target detection model, including: inputting the second training image and the second candidate area information into the initial target detection model; the initial target detection model generates second detection area information based on the second training image; calculates a second loss value based on the second detection area information and the second candidate area information; adjusts model parameters of the initial target detection model according to the second loss value until training conditions are met to obtain a target detection model.

[0135] Specifically, the second training image and the second candidate area information are input into the initial target detection model for further training. The operation steps for obtaining the target detection model are similar to the operation steps for inputting the first training image and the first candidate area information into the target detection model to be trained for training to obtain the initial target detection model. For the specific operation process, please refer to the detailed explanation of inputting the first training image and the first candidate area information into the target detection model to be trained for training to obtain the initial target detection model, which will not be repeated here.

[0136] The training method of the target detection model provided in the embodiment of the present application first pre-trains through a first training image that does not require labeling to obtain an initial target detection model, thereby achieving labeling from scratch and reducing the cost of labeling sample data. The second training image is then used to continue training, and the capability of the target detection model is optimized through an incremental learning algorithm, thereby enhancing the accuracy of target detection and accelerating the model training speed.

[0137] Combine the following Figure 6 , Figure 7 and Figure 8 The training method of the target detection model provided in this application is further explained. Figure 6A flow chart of the target detection model training method provided in an embodiment of the present application is shown, in which the user image is classified by a classification model, the classification label and the user image are obtained and input into the target detection model for weak supervision training, and the candidate area information corresponding to the user image is output, and the candidate area information is displayed to the user. If the candidate area information is correctly identified, the user image and the corresponding candidate area information are stored as correct annotation results. If the candidate area identification is incorrect, the user's interactive correction is received, and the target detection model is incrementally learned according to the interactive correction information, so that the target detection model continues to learn target detection capabilities.

[0138] Figure 7 A schematic diagram of the architecture of the target detection model training method provided in an embodiment of the present application is shown. As shown in the figure, candidate area detection is performed in a weakly supervised training module based on the user image to obtain corresponding candidate area information, and the candidate area information and the user image are input into the target detection model for strong supervised training to obtain an initial target detection model. In the subsequent training process of the second training data, the weakly supervised training module no longer plays a role.

[0139] Figure 8 A training method for a target detection model according to an embodiment of the present application is shown, taking the second training image as a user interaction correction image as an example, and including steps 802 to 816.

[0140] Step 802: Obtain a user image.

[0141] In the embodiment provided in the present application, the user image obtained is a dog.

[0142] Step 804: Input the user image to the feature extraction layer to extract a feature image of the user image.

[0143] In the embodiment provided in the present application, the user image is input into a ResNet convolutional neural network with a fully connected layer removed to extract a feature image of the user image.

[0144] Step 806: Input the feature image into the candidate region network layer to obtain multiple sub-candidate regions corresponding to the feature image.

[0145] In the embodiment provided in the present application, the feature image is input into the candidate region network layer to obtain multiple sub-candidate regions corresponding to the feature image.

[0146] Step 808: Input the feature image and multiple sub-candidate regions into the spatial pyramid pooling layer to obtain a candidate feature vector corresponding to each of the sub-candidate regions.

[0147] In the embodiment provided by the present application, each of the sub-candidate regions and the feature image is input into the spatial pyramid pooling layer to obtain a fixed-size candidate feature vector corresponding to each sub-candidate region. The fixed-size feature vector is extracted from the multi-scale features to solve the problem of different feature image sizes.

[0148] Step 810: Perform target recognition processing on each of the candidate feature vectors to generate a first weight coefficient matrix, perform target detection processing on each of the candidate feature vectors to generate a second weight coefficient matrix, and perform pooling processing on the first weight sparse matrix and the second weight coefficient matrix to obtain candidate area information corresponding to the image.

[0149] In the embodiment provided in the present application, target recognition processing is performed on each of the candidate feature vectors to obtain the weight coefficient of each category in each sub-candidate area, and a first weight coefficient matrix M*N is generated based on the weight coefficients of each sub-candidate area and the category in each sub-candidate area, where M is the category and N is the sub-candidate area.

[0150] Perform target detection processing on each of the candidate feature vectors to obtain the weight coefficient of each category in each sub-candidate area, and generate a second weight coefficient matrix N*M according to the weight coefficient of each category in each sub-candidate area and each sub-candidate area, where N is the sub-candidate area and M is the category.

[0151] The first weight coefficient matrix and the second weight coefficient matrix are tail-multiplied to obtain a score for each sub-candidate region, and candidate region information corresponding to the image is obtained according to the score of each sub-candidate region.

[0152] Step 812: Input the user image and the candidate area information into the target detection model to be trained to obtain the target detection model.

[0153] In the embodiment provided in the present application, the candidate region information and the user image are input into the target detection model to be trained to obtain the target detection model. At this time, the recognition of the detection model is not accurate enough and further training is required.

[0154] Step 814: Input the user image into the target detection model for processing, obtain a labeling result, and display the labeling information to the user.

[0155] In the embodiment provided in the present application, a user image is input into a target detection model for processing, labeling information output by the target detection model is obtained, and the labeling information is displayed to the user. If the labeling information is accurate, the user image and the labeling information are stored correspondingly.

[0156] Step 816: When the annotation information is inaccurate, receiving interaction correction information from the user, and performing incremental learning on the target detection model based on the user image and the interaction correction information.

[0157] In the embodiment provided in the present application, when the annotation information is inaccurate, the user actively modifies the annotation information, and inputs the modified correction information and the user image into the target detection model to continue incremental learning and training until the target detection model acquires accurate target detection capabilities.

[0158] The training method of the target detection model provided in the embodiment of the present application first pre-trains through a first training image that does not require labeling to obtain an initial target detection model, thereby achieving labeling from scratch and reducing the cost of labeling sample data. The second training image is then used to continue training, and the capability of the target detection model is optimized through an incremental learning algorithm, thereby enhancing the accuracy of target detection and accelerating the model training speed.

[0159] The processor 120 may execute Fig. 9 The steps in the image detection method are shown. Fig. 9 A flowchart of an image detection method according to an embodiment of the present application is shown, including steps 902 to 906.

[0160] Step 902: Acquire an image to be detected.

[0161] Step 904: input the image to be detected into a target detection model for target detection, wherein the target detection model is trained using the target detection model training method described above.

[0162] Step 906: Obtain the detection result in the image to be detected output by the target detection model.

[0163] In the embodiment provided in the present application, the model to be detected is input into the target detection model trained by the above-mentioned target detection model training method for detection, and the detection result output by the target detection model is obtained, so that the detection of the target detection model is more accurate.

[0164] Corresponding to the above-mentioned target detection model training method embodiment, the present application also provides a target detection model training device embodiment, Fig.10 FIG. 1 is a schematic diagram showing the structure of a training device for a target detection model according to an embodiment of the present application. Fig.10 As shown, the device comprises:

[0165] The first acquisition module 1002 is configured to acquire a first training image.

[0166] The candidate region information acquisition module 1004 is configured to input the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image.

[0167] The first training module 1006 is configured to input the first training image and the first candidate region information into the target detection model to be trained to obtain an initial target detection model.

[0168] The second acquisition module 1008 is configured to acquire a second training image and second candidate region information corresponding to the second training image.

[0169] The second training module 1010 is configured to input the second training image and the second candidate region information into the initial target detection model for further training to obtain a target detection model.

[0170] Optionally, the candidate region detection model includes a feature extraction layer, a candidate region network layer, a spatial pyramid pooling layer, and a pooling layer;

[0171] The candidate region information acquisition module 1004 includes:

[0172] A feature extraction subunit is configured to input the first training image into the feature extraction layer to extract a feature image of the first training image;

[0173] A sub-candidate region acquisition sub-unit is configured to input the feature image into the candidate region network layer to acquire a plurality of sub-candidate regions corresponding to the feature image;

[0174] A pyramid pooling subunit is configured to input the feature image and a plurality of sub-candidate regions into the spatial pyramid pooling layer to obtain a candidate feature vector corresponding to each of the sub-candidate regions;

[0175] The pooling subunit is configured to input each of the candidate feature vectors into the pooling layer for pooling processing to obtain first candidate region information corresponding to the first training image.

[0176] Optionally, the pooling subunit is further configured to perform target recognition processing on each of the candidate feature vectors to obtain a first weight coefficient matrix, and / or perform target detection processing on each of the candidate feature vectors to obtain a second weight coefficient matrix; and perform pooling processing based on the first weight coefficient matrix and / or the second weight coefficient matrix.

[0177] Optionally, the pooling subunit is further configured to perform target recognition processing on each of the candidate feature vectors to obtain a weight coefficient for each category in each of the sub-candidate regions; and generate a first weight coefficient matrix based on the weight coefficients of each of the sub-candidate regions and the categories in each of the sub-candidate regions.

[0178] Optionally, the pooling subunit is further configured to perform target detection processing on each of the candidate feature vectors to obtain a weight coefficient of each category in each sub-candidate area; and generate a second weight coefficient matrix based on the weight coefficient of each category in each sub-candidate area and each sub-candidate area.

[0179] Optionally, the first training module 1006 is further configured to input the first training image and the first candidate area information into the target detection model to be trained; the target detection model generates first detection area information based on the first training image; calculates a first loss value based on the first detection area information and the first candidate area information; adjusts the model parameters of the target detection model to be trained according to the first loss value until the training conditions are met, thereby obtaining an initial target detection model.

[0180] Optionally, the second training module 1010 is further configured to input the second training image and the second candidate area information into the initial target detection model; the initial target detection model generates second detection area information based on the second training image; calculates a second loss value based on the second detection area information and the second candidate area information; adjusts the model parameters of the initial target detection model according to the second loss value until the training conditions are met, thereby obtaining a target detection model.

[0181] The training device for the target detection model provided in the embodiment of the present application first performs pre-training through a first training image that does not require labeling to obtain an initial target detection model, thereby achieving labeling from scratch and reducing the cost of labeling sample data. The training is then continued with a second training image, and the capability of the target detection model is optimized through an incremental learning algorithm, thereby enhancing the accuracy of target detection and accelerating the model training speed.

[0182] Corresponding to the above-mentioned image detection method embodiment, the present application also provides an image detection device embodiment, Fig.11 FIG. 1 is a schematic diagram showing the structure of an image detection device according to an embodiment of the present application. Fig.11 As shown, the device comprises:

[0183] The third acquisition module 1102 is configured to acquire an image to be detected;

[0184] The target detection module 1104 is configured to input the image to be detected into a target detection model for target detection, wherein the target detection model is trained by the above-mentioned target detection model training method;

[0185] The fourth acquisition module 1106 is configured to obtain the detection result in the image to be detected output by the target detection model.

[0186] In the embodiment provided in the present application, the model to be detected is input into the target detection model trained by the above-mentioned target detection model training method for detection, and the detection result output by the target detection model is obtained, so that the detection of the target detection model is more accurate.

[0187] In one embodiment of the present application, a computing device is also provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein when the processor executes the instructions, the steps of the target detection model training method or the image detection method are implemented.

[0188] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the target detection model training method or image detection method as described above.

[0189] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the target detection model training method or the image detection method mentioned above belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the target detection model training method or the image detection method mentioned above.

[0190] An embodiment of the present application discloses a chip storing computer instructions, which, when executed by a processor, implement the steps of the target detection model training method or the image detection method as described above.

[0191] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0192] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0193] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0194] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0195] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.

Claims

1. A method for training a target detection model, characterized in that: include: Acquire a first training image; Inputting the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image, wherein the candidate region detection model includes a feature extraction layer, a candidate region network layer, a spatial pyramid pooling layer, and a pooling layer; Inputting the first training image and the first candidate region information into a target detection model to be trained to obtain an initial target detection model; Acquire a second training image and second candidate region information corresponding to the second training image; The second training image and the second candidate region information are input into the initial target detection model for further training to obtain a target detection model.

2. The target detection model training method according to claim 1, characterized in that: Inputting the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image includes: Inputting the first training image into the feature extraction layer to extract a feature image of the first training image; Inputting the feature image into the candidate region network layer to obtain a plurality of sub-candidate regions corresponding to the feature image; Inputting the feature image and multiple sub-candidate regions into the spatial pyramid pooling layer to obtain a candidate feature vector corresponding to each of the sub-candidate regions; Each of the candidate feature vectors is input into the pooling layer for pooling processing to obtain first candidate region information corresponding to the first training image.

3. The target detection model training method according to claim 2, characterized in that: Inputting each of the candidate feature vectors into the pooling layer for pooling processing, including: Performing target recognition processing on each of the candidate feature vectors to obtain a first weight coefficient matrix, and / or performing target detection processing on each of the candidate feature vectors to obtain a second weight coefficient matrix; Pooling processing is performed based on the first weight coefficient matrix and / or the second weight coefficient matrix.

4. The method for training a target detection model according to claim 3, wherein: Performing target recognition processing on each of the candidate feature vectors to obtain a first weight coefficient matrix includes: Performing target recognition processing on each of the candidate feature vectors to obtain a weight coefficient for each category in each of the sub-candidate regions; A first weight coefficient matrix is ​​generated according to each of the sub-candidate regions and the weight coefficient of the category in each of the sub-candidate regions.

5. The method for training a target detection model according to claim 3, wherein: Performing target detection processing on each of the candidate feature vectors to obtain a second weight coefficient matrix includes: Perform target detection processing on each of the candidate feature vectors to obtain a weight coefficient of each category in each sub-candidate area; A second weight coefficient matrix is ​​generated according to the weight coefficient of each category in each sub-candidate region and each of the sub-candidate regions.

6. The method for training a target detection model according to claim 1, wherein: Inputting the first training image and the first candidate region information into a target detection model to be trained for training to obtain an initial target detection model includes: Inputting the first training image and the first candidate region information into a target detection model to be trained; The target detection model generates first detection area information according to the first training image; Calculating a first loss value according to the first detection area information and the first candidate area information; The model parameters of the target detection model to be trained are adjusted according to the first loss value until the training conditions are met to obtain an initial target detection model.

7. The method for training a target detection model according to claim 1, wherein: Inputting the second training image and the second candidate region information into the initial object detection model to continue training to obtain the object detection model, including: Inputting the second training image and the second candidate region information into the initial object detection model; The initial target detection model generates second detection area information according to the second training image; Calculating a second loss value according to the second detection area information and the second candidate area information; The model parameters of the initial target detection model are adjusted according to the second loss value until the training conditions are met to obtain the target detection model.

8. An image detection method, characterized in that: include: Acquire the image to be detected; Inputting the image to be detected into a target detection model for target detection, wherein the target detection model is trained by the target detection model training method of any one of claims 1 to 7; Obtain a detection result in the image to be detected output by the target detection model.

9. A training device for a target detection model, characterized in that: include: A first acquisition module is configured to acquire a first training image; a candidate region information acquisition module, configured to input the first training image into a candidate region detection model to obtain first candidate region information corresponding to the first training image, wherein the candidate region detection model includes a feature extraction layer, a candidate region network layer, a spatial pyramid pooling layer, and a pooling layer; A first training module is configured to input the first training image and the first candidate region information into a target detection model to be trained to obtain an initial target detection model; A second acquisition module is configured to acquire a second training image and second candidate region information corresponding to the second training image; The second training module is configured to input the second training image and the second candidate area information into the initial target detection model for further training to obtain a target detection model.

10. An image detection device, characterized in that: include: A third acquisition module is configured to acquire an image to be detected; A target detection module, configured to input the image to be detected into a target detection model for target detection, wherein the target detection model is trained by the target detection model training method of any one of claims 1 to 7; The fourth acquisition module is configured to obtain the detection result in the image to be detected output by the target detection model.

11. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the instructions, the steps of the method described in any one of claims 1-7 or 8 are implemented.

12. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by the processor, the steps of the method described in any one of claims 1 to 7 or 8 are implemented.