Training method, target detection method, device, medium and robot

By using a hierarchical training set and support set method, the target detection model is trained using a combination of positive samples, benchmark samples, and negative samples. This solves the problems of difficulty in obtaining high-quality samples and high annotation costs, and improves the model's ability to distinguish between similar and dissimilar items, making it suitable for real-time target detection.

CN116740537BActive Publication Date: 2026-05-08MIDEA GRP (SHANGHAI) CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MIDEA GRP (SHANGHAI) CO LTD
Filing Date
2023-07-07
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Current deep learning-based object detection models suffer from difficulties in obtaining high-quality samples and high costs in labeling training samples. Furthermore, small-sample detection techniques struggle to distinguish between similar objects, affecting detection accuracy.

Method used

A hierarchical training method using training and support sets is adopted. The model is trained by combining positive, benchmark, and negative samples. Feature extraction and hyperparameter updates are combined to improve the model's ability to distinguish between similar and dissimilar items. The support set is used for final training to reduce sample requirements.

Benefits of technology

It improves the accuracy and recall of the target detection model under low sample conditions, reduces annotation costs, and is suitable for real-time target detection scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116740537B_ABST
    Figure CN116740537B_ABST
Patent Text Reader

Abstract

The application provides a training method, a target detection method, a device, a medium and a robot, and a training method of a target detection model, which comprises the following steps: acquiring a training set, wherein the training set comprises positive samples, benchmark samples, negative samples and spliced samples obtained by splicing the positive samples, the benchmark samples and the negative samples; acquiring a support set; training a preset detection model by using the positive samples, the benchmark samples and the negative samples, to obtain a first training model; training the first training model by using the spliced samples, to obtain a second training model; and training the second training model by using the support set, to obtain the target detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and more specifically, to a training method, a target detection method, an apparatus, a medium, and a robot. Background Technology

[0002] Computer vision is an important field of artificial intelligence technology. At present, deep learning-based object detection models are a common method for solving object detection tasks.

[0003] However, current deep learning-based object detection models face challenges such as difficulty in obtaining a large number of high-quality samples and high costs associated with labeling training samples.

[0004] Based on the above drawbacks, a small sample detection technique has been proposed in the relevant technical solutions. At present, the small sample detection technique can only distinguish outlier items. The model seriously misidentifies multiple similar objects as one object, which affects the accuracy of target detection. Summary of the Invention

[0005] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.

[0006] Therefore, a first aspect of the present invention is to provide a method for training an object detection model.

[0007] A second aspect of the present invention is that a target detection method is provided.

[0008] A third aspect of the present invention is that a training apparatus for an object detection model is provided.

[0009] A fourth aspect of the present invention is that a target detection device is provided.

[0010] A fifth aspect of the invention is that it provides a training apparatus for another object detection model.

[0011] A sixth aspect of the present invention is that a readable storage medium is provided.

[0012] A seventh aspect of the present invention is that a robot is provided.

[0013] In view of the above, according to a first aspect of the present invention, the present invention provides a method for training an object detection model, comprising: acquiring a training set, the training set including positive samples, benchmark samples, negative samples, and composite samples obtained by combining positive samples, benchmark samples, and negative samples; acquiring a support set; training a preset detection model using positive samples, benchmark samples, and negative samples to obtain a first training model; training the first training model using composite samples to obtain a second training model; and training the second training model using the support set to obtain an object detection model.

[0014] According to a second aspect of the present invention, the present invention provides a target detection method, comprising: receiving an image to be detected; inputting the image to be detected into a target detection model trained by the target detection model training method of the first aspect to obtain a detection result; and outputting the detection result.

[0015] According to a third aspect of the present invention, the present invention provides a training apparatus for an object detection model, comprising: an acquisition unit for acquiring a training set, the training set including positive samples, reference samples, negative samples, and composite samples obtained by combining positive samples, reference samples, and negative samples; the acquisition unit is further configured to acquire a support set; a training unit for training a preset detection model using positive samples, reference samples, and negative samples to obtain a first training model; the training unit is further configured to train the first training model using composite samples to obtain a second training model; and the training unit is further configured to train the second training model using the support set to obtain an object detection model.

[0016] According to a fourth aspect of the present invention, the present invention provides a target detection apparatus, comprising: a receiving unit for receiving an image to be detected; a processing unit for inputting the image to be detected into a target detection model trained by the target detection model training method of the first aspect, so as to obtain a detection result; and an output unit for outputting the detection result.

[0017] According to a fifth aspect of the invention, the invention provides another training apparatus for a target detection model, including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the method as described above.

[0018] According to a sixth aspect of the present invention, the present invention provides a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method as described above.

[0019] According to a seventh aspect of the present invention, the present invention provides a robot comprising: a training device for any of the target detection models described above; and / or a target detection device as described above; and / or a readable storage medium as described above.

[0020] In the technical solution of this application, the training of the object detection model is mainly divided into three levels. The first two levels are trained using a training set, and the last level is trained using a support set.

[0021] In the second-level model training process, the model is trained using a combined sample obtained by combining positive samples, benchmark samples, and negative samples. Since the combined sample contains three samples, the training result can achieve multi-target detection.

[0022] At the same time, combined with the first level of training, the object detection model has the ability to distinguish between similar and dissimilar items. Based on the above two levels of training, the training results not only have the ability to distinguish between similar and dissimilar items, but also have the ability to distinguish between similar objects, thereby improving the reliability of the object detection model.

[0023] Furthermore, the object detection model proposed in this application uses a support set for model training, so that the training result belongs to the detection model of a small sample object detection algorithm. Therefore, the object detection model does not need a large number of high-quality samples for training. At the same time, the labeling cost assigned to it is relatively low, thus reducing the cost of assigning to model training.

[0024] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0025] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0026] Figure 1 A flowchart illustrating the training method of the target detection model in an embodiment of the present invention is shown;

[0027] Figure 2 A schematic diagram of the first-level training in an embodiment of the present invention is shown;

[0028] Figure 3 A schematic diagram of the second-level training in an embodiment of the present invention is shown;

[0029] Figure 4 A schematic diagram of the third-level training in an embodiment of the present invention is shown;

[0030] Figure 5 A schematic block diagram of a training device for an object detection model according to an embodiment of the present invention is shown;

[0031] Figure 6 A schematic block diagram of a target detection device according to an embodiment of the present invention is shown;

[0032] Figure 7 A schematic block diagram of a training device for another target detection model in an embodiment of the present invention is shown. Detailed Implementation

[0033] To better understand the above aspects, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0034] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0035] In one embodiment of this application, such as Figure 1 As shown, a training method for an object detection model is provided, including:

[0036] Step 102: Obtain the training set, which includes positive samples, baseline samples, negative samples, and composite samples obtained by combining positive samples, baseline samples, and negative samples.

[0037] Step 104, obtain the support set;

[0038] Step 106: Train the preset detection model using positive samples, benchmark samples, and negative samples to obtain the first training model;

[0039] Step 108: Train the first training model using merged samples to obtain the second training model;

[0040] Step 110: Train the second training model using the support set to obtain the object detection model.

[0041] In the embodiments of this application, the training of the object detection model is mainly divided into three levels. The first two levels are trained using a training set, and the last level is trained using a support set.

[0042] In the second-level model training process, the model is trained using a combined sample obtained by combining positive samples, benchmark samples, and negative samples. Since the combined sample contains three samples, the training result can achieve multi-target detection.

[0043] At the same time, combined with the first level of training, the object detection model has the ability to distinguish between similar and dissimilar items. Based on the above two levels of training, the training results not only have the ability to distinguish between similar and dissimilar items, but also have the ability to distinguish between similar objects, thereby improving the reliability of the object detection model.

[0044] Furthermore, the object detection model proposed in this application uses a support set for model training, so that the training result belongs to the detection model of a small sample object detection algorithm. Therefore, the object detection model does not need a large number of high-quality samples for training. At the same time, the labeling cost assigned to it is relatively low, thus reducing the cost of assigning to model training.

[0045] The first level of training involves training the object detection model to obtain the first training model; the second level of training involves training the first training model to obtain the second training model; and the third level of training involves training the second training model to obtain the training result.

[0046] In some embodiments, the training set and the support set can be acquired simultaneously, or one can be acquired first, depending on the actual needs of use, and will not be elaborated here.

[0047] In some embodiments, optionally, obtaining a training set specifically includes: obtaining a basic dataset, the basic dataset including a first class dataset, wherein the number of samples in each class of the first class dataset is greater than or equal to a first value; determining a first image and a second image with the same item classification and a third image with a different item classification from the first image based on the first class dataset; using one of the first image and the second image as a positive sample, the other as a baseline sample, and the third image as a negative sample; and obtaining a combined sample by combining the first image, the second image, and the third image.

[0048] In this embodiment, the methods for determining positive samples, negative samples, and benchmark samples, as well as the methods for determining composite samples, are given.

[0049] Specifically, by limiting the number of samples in each category of the first dataset to be greater than or equal to a first value, the first value is used to distinguish between the training set and the support set. The first value can be selected according to actual needs, which will not be elaborated here.

[0050] In this case, if the number of samples is greater than or equal to the first value, it is considered that there are enough samples for each category in the first dataset to be used for model training.

[0051] In some embodiments, the first dataset may optionally include samples from only a single category.

[0052] Specifically, for example, the first type of dataset contains only sample images of tables.

[0053] In some embodiments, optionally, since the combined sample includes a first image, a second image, and a third image, that is, multiple targets are contained in the same sample, the model trained with this sample not only improves classification performance but also increases the ability to distinguish similar objects and detect multiple targets, thereby improving the recall rate of the training results.

[0054] In some embodiments, optionally, obtaining a support set includes: obtaining a base dataset, the base dataset including a second type dataset, wherein the number of samples in each category of the second type dataset is less than a first value; and determining a support set based on the second type dataset.

[0055] In this embodiment, the produck-10K item classification dataset is used as the base dataset, where produck-10K is a type of product classification dataset.

[0056] In the second dataset, each sample contains only an image of a single category to be detected. If the number of samples is insufficient, screenshots from shopping websites can be used to expand the dataset, followed by manual labeling and classification.

[0057] In the second type of dataset, if the number of samples in each category is less than the first value, the samples are considered to be relatively scarce and can be used as the support set.

[0058] Specifically, for example, in the base dataset, 10 categories of target items with relatively abundant samples are selected. Then, two images of the same category and one image of a different category are randomly selected, continuously cropped and stitched together, and manually labeled. These are added to the training set as new samples for the second-level training. From the categories with relatively scarce samples, 5 categories of target items are selected, and then 5 high-quality images are selected from them as the support set for 5-way 5-shot small sample target detection. Finally, other images from the 5 categories that serve as the support set are used as the query set for performance testing.

[0059] In some embodiments, optionally, the preset detection model includes a feature extraction module and an object detection module. The preset detection model is trained using positive samples, benchmark samples, and negative samples to obtain a first training model, including: using the feature extraction module to extract features from the positive samples, benchmark samples, and negative samples to obtain corresponding first feature vectors, second feature vectors, and third feature vectors; determining a first feature distance between the first feature vector and the second feature vector; determining a second feature distance between the second feature vector and the third feature vector; and updating the hyperparameters of the object detection module based on the first feature distance and the second feature distance to obtain the first training model.

[0060] In this embodiment, such as Figure 2 As shown, the channel mode of the preset detection model is modified to a three-channel mode. In the three-channel mode, the preset detection model has three input channels, corresponding to positive samples, baseline samples, and negative samples, respectively. After feature extraction by the feature extraction module, the corresponding feature vectors are obtained.

[0061] In this process, the distance between positive and negative samples in the feature space is determined using the benchmark sample as the benchmark, namely the first feature distance and the second feature distance. By calculating the loss, the preset detection model is made to have the ability to distinguish between similar items and dissimilar items, as well as the ability to distinguish between positive and negative samples, thus obtaining the first training model.

[0062] Specifically, the loss is calculated based on the first feature distance and the second feature distance, and then the hyperparameters are updated according to the loss, thereby realizing the model update and training, and obtaining the first training model.

[0063] Furthermore, the detection model proposed in this application employs a single-stage target detection algorithm, thus enabling its application in real-time target detection scenarios with high speed requirements.

[0064] In some embodiments, optionally, the feature extraction module is a YOLO feature extraction model F, where YOLO is the name of a model. Two similar images and one dissimilar image are randomly selected. One similar image is the positive sample P, the other similar image is the baseline sample B, and the dissimilar image is the negative sample N. After feature extraction by the YOLO feature extraction model F, the feature vector f is obtained. P =F(P), f B =F(B), f N =F(N), where f P =F(P) is the feature vector output by the YOLO feature extraction model F, which takes positive samples P as input and is also the first feature vector. B =F(B) is the feature vector output by the YOLO feature extraction model F, which takes the benchmark sample B as input and is also known as the second feature vector. N =F(N) is the feature vector output by the YOLO feature extraction model F with negative samples N as input, which is also the third feature vector.

[0065] Then the first feature distance D PB The expression is as follows:

[0066]

[0067] Second characteristic distance D BN The expression is as follows:

[0068]

[0069] Wherein, the feature distance between the positive sample and the benchmark sample in the feature space is D. PB The feature distance between the negative sample and the reference sample in the feature space is D. BN The model needs to recognize that the distance between samples of the same class is less than the distance between samples of different classes, thus distinguishing between positive and negative samples.

[0070] D PB +α≤D BN

[0071] Where α is a hyperparameter of the target detection model.

[0072] If D BN Compared to D PB A distance greater than α indicates that the classification of this sample group is correct. If this condition is not met, it means the model cannot distinguish between positive and negative samples. Therefore, a loss function Loss1 can be defined, with the following expression:

[0073] Loss1(P,B,N)=max{0,D PB +α-D BN}

[0074] By satisfying the above loss function, the model can distinguish between positive and negative samples.

[0075] In one embodiment, considering that the model determined based on Loss1 can only be used to distinguish between positive and negative samples, but cannot enable the model to correctly locate anchor boxes, the coordinates x, y, height h, and width w of the prior box of the anchor box are set. The prior box is then fitted to the true box by regression adjustment of parameters. The corresponding loss function Loss2 is defined as follows:

[0076]

[0077] Where the coordinates of the ground truth bounding boxes for positive samples are x T y T The height is h T Width is w T μ im Here, S represents the set weight values, S is the size of the YOLO model grid cell, and B is the prior bounding box. This represents the object that the prior box is responsible for predicting.

[0078] Based on the above loss function, the prior box can be fitted to the true box.

[0079] Furthermore, the probability and confidence level of the item category are fitted to be as close as possible to the true value of the label. The loss function Loss3 is defined, and its expression is as follows:

[0080]

[0081] Among them, C P C represents the confidence level of the prediction. L μ is the IOU value between the current anchor box and the ground truth box. ig The set weight value, The bounding box represents objects that are not predicted by the prior bounding box, where c is the specific category and p is the object. i For the predicted probability value, correspondingly, p i (c) represents the probability value of predicting the class indicated by c, p iT For the true probability value, correspondingly, p iT (c) represents the true probability value of the category indicated by c.

[0082] Based on this, the loss function of the YOLO feature extraction model F is expressed as:

[0083] Loss(P,B,N)=Loss1(P,B,N)+Loss2(P,B,N)+Loss3(P,B,N).

[0084] After the first level, clustering enables the model to recognize single targets. However, for items of the same type placed side by side, the model's ability to distinguish between similar objects is still insufficient. It may identify multiple similar objects as a single object, resulting in a significant drop in the object detection recall rate.

[0085] Based on this, we proceed to the second level of training on the training set data, such as... Figure 3 As shown, the input channel is changed to a single channel, and the previously processed cropped and stitched images, i.e., stitched samples, are used as the training set for training. While performing clustering, this increases the model's ability to distinguish similar objects on the same image, thereby improving the model's multi-object detection capability.

[0086] Training at this level, using multiple targets and including positive, negative, and baseline samples, can significantly improve model performance, increase recall, and solve the problem of multi-target detection.

[0087] In some embodiments, optionally, the object detection module has a classifier function, which trains a second training model using a support set to obtain an object detection model, including: using a feature extraction module to extract features from samples in the support set to obtain a corresponding fourth feature vector; expressing the fourth feature vector and hyperparameters in the classifier function using cosine similarity; and updating the hyperparameters based on the fourth feature vector to obtain the object detection model.

[0088] In this embodiment, the accuracy of model detection can be improved by adjusting the expression of the fourth feature vector and hyperparameters in the classifier function.

[0089] Specifically, the training process at the third level is as follows: Figure 4 As shown, if the support set contains samples S, then these samples are input into the YOLO feature extraction model F to obtain the feature vector f. S =F(S), based on this, the probability P predicted by the YOLO feature extraction model F is... S The expression is as follows:

[0090] P S =Softmax(Wf S +b)

[0091] Where W and b are the hyperparameters of the YOLO feature extraction model F.

[0092] In the above embodiment, W is a matrix and b is a vector, which need to be learned through training.

[0093] In the above embodiments, P S The specific expression is as follows:

[0094]

[0095] Among them, b1, b2, b3, f S1 f S2 f SS Wf is the matrix representation S +b.

[0096] By normalizing W and f3, Wf S Replacing it with cosinsimilarity, which sets the L2 norm to 1, can significantly improve the model's accuracy, and can be represented as sim(W,f). S ).

[0097] in,

[0098] As shown above, after the fourth feature vector and hyperparameters in the classifier function are expressed using cosine similarity, P S The expression is as follows:

[0099]

[0100] In this embodiment, training at the third level is performed based on the above expression to obtain the training result.

[0101] In the third-level training, the loss function is expressed as follows:

[0102] min∑ j CrossEntropy(S T ,P s )

[0103] Among them, S T The support set represents the true label value. When training with a small number of data samples, overfitting is inevitable. Therefore, cross-entropy regularization is used to avoid overfitting. Here, CrossEntropy is the function expression of cross-entropy, and j is the sample in the support set.

[0104] In the third level of training, the images in the query set are denoted as Q, and the feature vector f is obtained through the YOLO feature extraction model F. Q =F(Q), where entropy is used to measure the information content of a probability distribution as H(P). Q ), which is represented as follows:

[0105] H(P Q )=-∑ j P j logP j

[0106] Among them, P Q The probability values ​​obtained by the model for the images in the query set are calculated by taking the entropy of each image in the query set and then averaging them. This is the cross-entropy regularization coefficient δ. The smaller this coefficient is, the better the detection performance of the model.

[0107] Among them, P j Let F be the probability predicted by the YOLO feature extraction model, taking a query set sample j as input.

[0108] Specifically, the loss function for this third-level training is expressed as follows:

[0109] Loss(S) = min∑ j CrossEntropy(S T ,P s )+δ

[0110] In some embodiments, the initial value of the random matrix W can be optionally set to be the average of the feature vectors of each category, and the initial value of b can be set to 0, which can greatly improve the learning effect of the parameters.

[0111] In some embodiments, the feature extraction module may optionally include: a coordinate encoding information embedding module and a spatial convolutional pooling pyramid structure, wherein the output interface of the coordinate encoding information embedding module is connected to the input interface of the spatial convolutional pooling pyramid structure.

[0112] In this embodiment, a coordinate encoding information embedding module is set before the spatial convolutional pooling pyramid structure. This module is used as an introduced attention mechanism to embed positional information into channel attention. Due to its low computational cost, the lightweight network can obtain attention in a larger area, effectively alleviating the problem of positional information loss and thus enhancing the representational ability of the feature map.

[0113] In some embodiments, optionally, the spatial convolutional pooling pyramid structure can be understood as an SPPCSPC module, and the coordinate encoding information embedding module can be understood as a coordinate module.

[0114] The SPPC module is a module in the YOLO feature extraction model.

[0115] In some embodiments, optionally, before training the second training model using the support set to obtain the object detection model, the method further includes: editing the samples in the support set and updating the support set based on the processing result; wherein the editing process includes at least one of the following: flipping, rotating, shifting, scaling, erasing, and filling.

[0116] In this embodiment, by editing the samples in the support set, the support set can be expanded, thus solving the problem of insufficient samples.

[0117] In some embodiments, optionally, a fine-tuning operation is also performed on the updated support set, wherein the fine-tuning operation initializes the network with the trained parameters and trains it with its own data.

[0118] In some embodiments, the feature extraction module may optionally be any one of YOLOv1-YOLOv5, YOLOX, YOLOR, or PP-YOLOE.

[0119] Among them, YOLOv1-YOLOv5, YOLOX, YOLOR, and PP-YOLOE are updated versions of the YOLO feature extraction model.

[0120] In one embodiment, a target detection method is proposed, comprising: receiving an image to be detected; inputting the image to be detected into a target detection model trained by the training method of the target detection model described above, so as to obtain a detection result; and outputting the detection result.

[0121] In this embodiment, the proposed target detection method can detect multiple targets while also having the ability to distinguish between objects of the same type, thereby improving the reliability of the target detection model.

[0122] Meanwhile, the object detection model proposed in this application uses a support set for model training, so that the training result belongs to the detection model of a small sample object detection algorithm. Therefore, the object detection model does not need a large number of high-quality samples for training. At the same time, the labeling cost assigned to it is relatively low, thus reducing the cost of assigning to model training.

[0123] In one embodiment, such as Figure 5 As shown, a training device 500 for an object detection model is proposed, comprising: an acquisition unit 502 for acquiring a training set, the training set including positive samples, benchmark samples, negative samples, and composite samples obtained by combining positive samples, benchmark samples, and negative samples; the acquisition unit 502 is also used to acquire a support set; a training unit 504 for training a preset detection model using positive samples, benchmark samples, and negative samples to obtain a first training model; the training unit 504 is also used to train the first training model using composite samples to obtain a second training model; and the training unit 504 is also used to train the second training model using the support set to obtain an object detection model.

[0124] In some embodiments, optionally, the acquisition unit 502 is specifically used to: acquire a basic dataset, the basic dataset including a first class dataset, wherein the number of samples in each class of the first class dataset is greater than or equal to a first value; determine a first image and a second image with the same item classification and a third image with a different item classification from the first image based on the first class dataset; take one of the first image and the second image as a positive sample, the other as a baseline sample, and the third image as a negative sample; and obtain a composite sample by merging the first image, the second image, and the third image.

[0125] In some embodiments, optionally, the acquisition unit 502 is specifically used for: acquiring a basic dataset, the basic dataset including a second type of dataset, wherein the number of samples in each category of the second type of dataset is less than a first value; and determining a support set based on the second type of dataset.

[0126] In some embodiments, optionally, the preset detection model includes a feature extraction module and an object detection module. The training unit 504 is specifically used to: extract features from positive samples, benchmark samples, and negative samples using the feature extraction module to obtain corresponding first feature vectors, second feature vectors, and third feature vectors; determine a first feature distance between the first feature vector and the second feature vector; determine a second feature distance between the second feature vector and the third feature vector; and update the hyperparameters of the object detection module based on the first feature distance and the second feature distance to obtain a first training model.

[0127] In some embodiments, optionally, the object detection module has a classifier function and a training unit 504, specifically used for: using a feature extraction module to extract features from samples in the support set to obtain a corresponding fourth feature vector; expressing the fourth feature vector and hyperparameters in the classifier function using cosine similarity; and updating the hyperparameters based on the fourth feature vector to obtain an object detection model.

[0128] In some embodiments, the feature extraction module may optionally include: a coordinate encoding information embedding module and a spatial convolutional pooling pyramid structure, wherein the output interface of the coordinate encoding information embedding module is connected to the input interface of the spatial convolutional pooling pyramid structure.

[0129] In some embodiments, optionally, the acquisition unit 502 is further configured to: perform editing processing on the samples in the support set and update the support set based on the processing result; wherein the editing processing includes at least one of the following: flipping, rotating, shifting, scaling, erasing, and filling.

[0130] In one embodiment, such as Figure 6 As shown, the present invention provides a target detection device 600, comprising: a receiving unit 602 for receiving an image to be detected; a processing unit 604 for inputting the image to be detected into a target detection model trained by the target detection model training method of any of the above embodiments to obtain a detection result; and an output unit 606 for outputting the detection result.

[0131] In one embodiment, such as Figure 7 As shown, the present invention provides a training device 700 for a target detection model, including a processor 702 and a memory 704. The memory 704 stores a program or instructions that can be executed on the processor 702. When the program or instructions are executed by the processor, they implement the steps of any of the methods described above.

[0132] The memory 704 can be used to store software programs and various data. The memory 704 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area can store the operating system, application programs or instructions required for at least one function (such as sound playback function, image playback function, etc.). Furthermore, the memory 704 can include volatile memory or non-volatile memory, or both. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0133] In one embodiment, the present invention provides a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of any of the methods described above.

[0134] In one embodiment, a robot is provided, including: a training device for any of the target detection models described above; and / or a target detection device as described above; and / or a readable storage medium as described above.

[0135] The robot proposed in this application includes a training device for any of the target detection models described above, and / or a target detection device and / or a readable storage medium as described above. Therefore, it has all the corresponding beneficial technical effects, which will not be elaborated here.

[0136] In some embodiments, the robot may optionally be a home service robot, such as a robot vacuum cleaner or a nursing robot, in order to recognize and perceive its environment and create a home service robot with complete closed-loop control for the user's home, thereby realizing the digitalization and intelligentization of the home.

[0137] The terms "first" and "second" in the specification and claims of this application may explicitly or implicitly include one or more of the features. In the textual description of this invention, unless otherwise stated, "a plurality of" means two or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0138] In the claims, description, and accompanying drawings of this invention, the term "plural" refers to two or more. Unless otherwise explicitly defined, the terms "upper," "lower," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the invention and simplifying the description process, not to indicate or imply that the device or element referred to must have the described specific orientation, or be constructed and operated in a specific orientation. Therefore, these descriptions should not be construed as limiting the invention. The terms "connect," "install," "fix," etc., should be interpreted broadly. For example, "connect" can be a fixed connection between multiple objects, a detachable connection between multiple objects, or an integral connection; it can be a direct connection between multiple objects or an indirect connection between multiple objects through an intermediate medium. For those skilled in the art, the specific meaning of the above terms in this invention can be understood based on the specific circumstances described above.

[0139] In the claims, description, and accompanying drawings of this invention, the terms "one embodiment," "some embodiments," "specific embodiment," etc., refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the invention. In the claims, description, and accompanying drawings of this invention, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0140] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A training method for an object detection model, characterized in that, include: Obtain a training set, which includes positive samples, benchmark samples, negative samples, and a combined sample obtained by combining the positive samples, the benchmark samples, and the negative samples. Obtain the support set; The preset detection model is trained using the positive samples, the benchmark samples, and the negative samples to obtain the first training model; The first training model is trained using the combined samples to obtain the second training model; The second training model is trained using the support set to obtain the target detection model; The acquisition of the training set includes: Obtain a basic dataset, which includes a first type of dataset, wherein the number of samples in each category of the first type of dataset is greater than or equal to a first value; Based on the first type of dataset, a first image and a second image with the same item classification, and a third image with a different item classification from the first image are identified. One of the first image and the second image is used as the positive sample and the other is used as the baseline sample, and the third image is used as the negative sample; The stitched sample is obtained by stitching the first image, the second image, and the third image together. The stitched sample includes the first image, the second image, and the third image. The acquisition of the support set includes: Obtain a basic dataset, which includes a second type of dataset, wherein the number of samples in each category of the second type of dataset is less than the first value; The support set is determined based on the second type of dataset.

2. The training method for the target detection model according to claim 1, characterized in that, The preset detection model includes a feature extraction module and an object detection module. The first training model is obtained by training the preset detection model using the positive samples, the benchmark samples, and the negative samples, including: The feature extraction module is used to extract features from the positive sample, the benchmark sample, and the negative sample to obtain the corresponding first feature vector, second feature vector, and third feature vector. Determine the first feature distance between the first feature vector and the second feature vector; Determine the second feature distance between the second feature vector and the third feature vector; The hyperparameters of the target detection module are updated based on the first feature distance and the second feature distance to obtain the first training model.

3. The training method for the target detection model according to claim 2, characterized in that, The object detection module has a classifier function, and the step of training the second training model using the support set to obtain the object detection model includes: The feature extraction module is used to extract features from the samples in the support set to obtain the corresponding fourth feature vector; The fourth feature vector and the hyperparameter in the classifier function are expressed using cosine similarity; The hyperparameters are updated based on the fourth feature vector to obtain the target detection model.

4. The training method for the target detection model according to claim 2, characterized in that, The feature extraction module includes: The system includes a coordinate encoding information embedding module and a spatial convolutional pooling pyramid structure, wherein the output interface of the coordinate encoding information embedding module is connected to the input interface of the spatial convolutional pooling pyramid structure.

5. The training method for the target detection model according to claim 1, characterized in that, Before training the second training model using the support set to obtain the object detection model, the method further includes: The samples in the support set are edited, and the support set is updated based on the processing results; The editing process includes at least one of the following: flipping, rotating, shifting, scaling, erasing, and filling.

6. A target detection method, characterized in that, include: Receive the image to be detected; The image to be detected is input into the target detection model trained by the target detection model training method as described in any one of claims 1 to 5 to obtain the detection result; Output the detection results.

7. A training device for an object detection model, characterized in that, include: An acquisition unit is used to acquire a training set, the training set including positive samples, benchmark samples, negative samples, and a combined sample obtained by combining the positive samples, the benchmark samples, and the negative samples; The acquisition unit is also used to acquire a support set; The training unit is used to train the preset detection model using the positive samples, the benchmark samples, and the negative samples to obtain the first training model; The training unit is also used to train the first training model using the combined samples to obtain the second training model; The training unit is further configured to train the second training model using the support set to obtain the target detection model; The acquisition unit is further configured to acquire a basic dataset, the basic dataset including a first type of dataset, wherein the number of samples in each category of the first type of dataset is greater than or equal to a first value; based on the first type of dataset, determine a first image and a second image with the same item classification, and a third image with an item classification different from the first image; use one of the first image and the second image as the positive sample and the other as the benchmark sample, and the third image as the negative sample; and obtain the combined sample by merging the first image, the second image, and the third image, the combined sample including the first image, the second image, and the third image; The acquisition unit is further configured to acquire a basic dataset, which includes a second type of dataset, wherein the number of samples in each category of the second type of dataset is less than a first value; and to determine the support set based on the second type of dataset.

8. A target detection device, characterized in that, include: The receiving unit is used to receive the image to be detected; A processing unit is configured to input the image to be detected into the target detection model trained by the target detection model training method as described in any one of claims 1 to 5, so as to obtain a detection result; The output unit is used to output the detection results.

9. A training device for an object detection model, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the method as described in any one of claims 1 to 5.

10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1 to 5.

11. A robot, characterized in that, include: The training apparatus for the target detection model as described in claim 7 or 9; and / or The target detection device as described in claim 8; and / or The readable storage medium as described in claim 10.

Citation Information

Patent Citations

  • Image classification network model training method and device, equipment and medium

    CN113762508A

  • Small sample target detection method, system and device and storage medium

    CN115546470A

  • Target detection model training method and device, equipment and storage medium

    CN115546693A