A training method, device and storage medium for a deep prototype network
By building a deep prototype network model and using a data collector to generate a support set and query set, the traditional deep learning image classification method's dependence on a large amount of annotated data is solved, the model's generalization ability and training efficiency are improved, and it is achieved with a small number of samples. high accuracy classification.
Patent Information
- Application Number
- CN202410418202.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-09
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-04-09
AI Technical Summary
Traditional deep learning image classification methods require a large amount of labeled data for training, which results in low versatility when faced with new categories. Moreover, labeling unlabeled data consumes a lot of time and manpower, and cannot learn as quickly as humans.
By building a deep prototype network model, using image sets with labeled categories to construct training sets, verification sets, and test sets, using a data collector to generate support sets and query sets, training the model iteratively in batches, and filtering out accurate classification results through the verification set The model with the highest degree improves the generalization ability of the model.
In the case of a small number of samples, the accuracy of image classification is improved, the generalization ability and training efficiency of the model are improved, and the user experience and data processing process are simplified.
Smart Images

Figure CN118038190B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image technology, and in particular to a training method, device and storage medium for a deep prototype network. Background Art
[0002] With the advent of the big data era, deep learning models have achieved advanced results in tasks such as image classification and text classification. However, the success of deep learning models depends largely on a large amount of training data. In real-world scenarios, some categories have only a small amount of data or a small amount of labeled data, and labeling unlabeled data will consume a lot of time and manpower. In contrast, humans only need a small amount of data to learn quickly. For example, a five or six-year-old child has never seen a penguin, but if he is shown an image of a penguin, when he enters the zoo and sees a real penguin, he will immediately recognize that this is the "penguin" he has seen in the image. This is the gap between machine learning and human learning.
[0003] Traditional deep learning image classification methods require a large amount of labeled data for training, and when faced with new categories, they often have the defect of not being very general. Summary of the invention
[0004] The embodiments of the present application provide a deep prototype network training method, device and storage medium, which can enhance the generalization ability of the model.
[0005] A first aspect of an embodiment of the present application provides a method for training a deep prototype network, comprising:
[0006] Obtain a set of images with marked categories, and use the image set to construct a training set, a validation set, and a test set, wherein the categories included in the training set and the validation set are consistent, and the categories included in the test set are inconsistent with the categories included in the training set;
[0007] Constructing a data collector, the data collector is used to extract images from the training set, the validation set or the test set to generate a support set and a query set, wherein the number of images of each category in the support set generated each time is fixed;
[0008] Build a deep prototype network model based on deep convolutional neural network;
[0009] Generating a first support set and a first query set from the training set in batches through the data collector, and iteratively training the deep prototype network model using the first support set and the first query set to update the network weights of the deep prototype network model;
[0010] Generating a second support set and a second query set from the validation set in batches by the data collector, and using the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model to obtain a deep prototype network model with the highest classification accuracy;
[0011] A third support set and a third query set are generated from the test set in batches by the data collector, and the classification accuracy of the deep prototype network model is evaluated using the third support set and the third query set.
[0012] Optionally, the step of constructing a deep prototype network model based on a deep convolutional neural network includes:
[0013] Use deep convolutional neural network as the backbone network;
[0014] The backbone network is initialized, and the head of the backbone network is replaced with a Flatten layer, thereby obtaining a deep prototype network model.
[0015] Optionally, the iterative training of the deep prototype network model using the first support set and the first query set includes:
[0016] Inputting the first support set into the deep prototype network model for feature extraction to obtain corresponding feature values;
[0017] Calculating the prototype of each category using the eigenvalues corresponding to the first support set;
[0018] Inputting the first query set into the deep prototype network model to extract features and obtain corresponding feature values;
[0019] Predicting the category of each image in the first query set according to the feature values corresponding to the first query set and the prototype of each category corresponding to the first support set;
[0020] Calculating the loss value using the loss function and updating the network weights of the deep prototype network model through back propagation;
[0021] Repeat the above steps until the preset number of iterations of training is reached or it is manually stopped.
[0022] Optionally, calculating the prototype of each category by using the eigenvalues corresponding to the first support set includes:
[0023] The prototype of each category is calculated according to the prototype algorithm and the feature value corresponding to each category in the first support set.
[0024] Optionally, the prototype algorithm includes a mean prototype algorithm, a weighted mean prototype algorithm, a center point prototype algorithm, and a probability density prototype estimation algorithm.
[0025] Optionally, the using the second support set and the second query set to perform classification accuracy evaluation on the iteratively trained deep prototype network model to obtain the deep prototype network model with the highest classification accuracy includes:
[0026] Obtaining a prototype of each category using the second support set;
[0027] Predicting the category of each image in the second query set using the prototype of each category corresponding to the second support set;
[0028] Update the hyperparameters of the deep prototype network model according to the prediction results, and calculate the classification accuracy of the prediction results;
[0029] Repeat the above steps. When the number of repetitions reaches a preset value, the deep prototype network model with the highest classification accuracy is obtained.
[0030] Optionally, the using the third support set and the third query set to perform classification accuracy evaluation on the deep prototype network model includes:
[0031] Obtaining a prototype of each category using the third support set;
[0032] Predicting the category of each image in the third query set using the prototype of each category corresponding to the third support set;
[0033] The classification accuracy, recall, and F1 value of the prediction results are calculated to evaluate the deep prototype network model.
[0034] A second aspect of an embodiment of the present application provides a training device for a deep prototype network, including:
[0035] An acquisition unit, used to acquire a set of images with marked categories, and use the image set to construct a training set, a validation set and a test set, wherein the categories included in the training set and the validation set are consistent, and the categories included in the test set are inconsistent with the categories included in the training set;
[0036] A first construction unit is used to construct a data collector, wherein the data collector is used to extract images from the training set, the validation set or the test set to generate a support set and a query set, wherein the number of images of each category in the support set generated each time is fixed;
[0037] A second construction unit is used to construct a deep prototype network model based on a deep convolutional neural network;
[0038] A first generating unit is used to generate a first support set and a first query set from the training set in batches through the data collector, and iteratively train the deep prototype network model using the first support set and the first query set to update the network weights of the deep prototype network model;
[0039] A second generating unit is used to generate a second support set and a second query set from the validation set in batches through the data collector, and use the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model to obtain a deep prototype network model with the highest classification accuracy;
[0040] The third generating unit is used to generate a third support set and a third query set from the test set in batches through the data collector, and use the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model.
[0041] A third aspect of an embodiment of the present application provides a training device for a deep prototype network, including:
[0042] Processor, memory, input-output unit, and bus;
[0043] The processor is connected to the memory, the input and output unit, and the bus;
[0044] A program is stored in the memory, and the processor calls the program to execute the method in the first aspect and any possible implementation manner of the first aspect.
[0045] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the computer executes the method in the first aspect and any possible implementation of the first aspect.
[0046] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0047] 1. The embodiment of the present application updates the network weights of the deep prototype network model through the training set, selects the deep prototype network model with the highest classification accuracy through the validation set, and evaluates the classification accuracy through the test set. The test set is a completely new category for the training set and the validation set, so the generalization ability of the deep prototype network model can be improved;
[0048] 2. The support set is a collection of small samples. Each category in the support set only requires a few images. Therefore, the embodiment of the present application can obtain a better accuracy rate with a small number of samples, thereby improving the efficiency of the training model.
[0049] 3. The embodiment of the present application automatically generates support sets and query sets through a data collector, and there is no need to manually construct support sets and query sets, which improves user experience and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A flowchart of an embodiment of a training method for a deep prototype network in an embodiment of the present application;
[0051] Figure 2 A schematic diagram of a flow chart of an embodiment of iterative training of a deep prototype network model in an embodiment of the present application;
[0052] Figure 3 This is a flow chart of an embodiment of obtaining a deep prototype network model with the highest classification accuracy in the embodiment of the present application;
[0053] Figure 4 A schematic diagram of a flow chart of an embodiment of evaluating the classification accuracy of a deep prototype network model in an embodiment of the present application;
[0054] Figure 5 A schematic diagram of the structure of an embodiment of a training device for a deep prototype network in an embodiment of the present application;
[0055] Figure 6 This is a structural diagram of another embodiment of a training device for a deep prototype network in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The embodiments of the present application provide a deep prototype network training method, device and storage medium for enhancing the generalization ability of the model.
[0057] The method of the present application can be applied to a server, a terminal or other devices with logic processing capabilities, and the present application does not limit this. For the convenience of description, the following description is made by taking the execution subject as a server as an example.
[0058] The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0059] See also Figure 1 In one embodiment of the present application, a method for training a deep prototype network includes:
[0060] 101. Obtain a set of images with labeled categories, and use the image set to construct a training set, a validation set, and a test set;
[0061] Among them, the categories of the training set and the validation set are consistent, and the categories of the test set are inconsistent with the categories included in the training set. That is, the test set is equivalent to the training set, and the categories included in the test set are all new categories.
[0062] 102. Construct a data collector, which is used to extract images from a training set, a validation set, or a test set to generate a support set and a query set, wherein the number of images of each category in each support set generated each time is fixed;
[0063] Among them, the number of images of each category in the support set generated each time is fixed, and the support set is a collection of small samples. The number of each category in the support set extracted by the data collector is the same. For example, images of the three categories of cat, dog and bird are extracted as the support set. If the extracted images of the cat category are 3, then the extracted images of the dog category and the extracted images of the bird category should all be 3 images. In an extraction task, the category of the query set extracted by the data collector should be exactly the same as the category of the support set (for example, when the data collector extracts the support set, the three categories of cat, dog and bird are extracted, so when extracting the query set, the three categories of cat, dog and bird should also be extracted), but the number of images of each category extracted can be the same or different (for example, 10 images are extracted for the cat category, 10 images can be extracted for the dog category, or other numbers of images can be extracted), and this application does not limit this. In a preferred embodiment, in the same extraction task, in the query set extracted by the data collector, the images of each category are more than the support set. It should be noted that in different extraction tasks, the categories of the query set extracted by the data collector and the images of each category may be different. When extracting images of each category of the query set, the data collector may determine the number of extracted images by random extraction, or may pre-set the number of images of each category to be extracted and extract images for each category according to the pre-set number during extraction, or may determine the number of images of each category of the extracted query set by other methods, and this application does not limit this.
[0064] 103. Construct a deep prototype network model based on deep convolutional neural network;
[0065] Generally speaking, deep convolutional neural networks can better extract image features, so the server builds a deep prototype network model based on deep convolutional neural networks. The deep convolutional neural network used can be resnet or other deep convolutional neural networks, which is not limited in this application. This application also does not limit the specific depth of the deep convolutional neural network.
[0066] 104. Generate a first support set and a first query set from the training set in batches through a data collector, and iteratively train the deep prototype network model using the first support set and the first query set to update the network weights of the deep prototype network model;
[0067] The iterative training can be stopped when the preset number of times is reached or manually stopped by the user. It should be noted that during the entire process of iterative training, all categories of images included in the training set need to be used to train the deep prototype network model, and the training should not be stopped before all categories of images included in the training set have been used.
[0068] 105. Generate a second support set and a second query set from the validation set in batches through a data collector, and use the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model to obtain a deep prototype network model with the highest classification accuracy;
[0069] During the validation set training phase, the hyperparameters of the deep prototype network model are updated after each training task, and the classification accuracy of the deep prototype network model is evaluated. At the end of the validation set training phase, the deep prototype network model with the highest classification accuracy is selected.
[0070] 106. Generate a third support set and a third query set from the test set in batches through a data collector, and use the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model.
[0071] After the server selects the deep prototype network model with the highest classification accuracy, it can evaluate the performance of the deep prototype network model on the test set, especially the classification accuracy indicator.
[0072] In this embodiment, the server first obtains a set of images with marked categories, and uses the image set to construct a training set, a validation set, and a test set, wherein the categories of the training set and the validation set are consistent, and the categories of the test set are inconsistent with the categories included in the training set, that is, the test set is equivalent to the training set, and the categories included in the test set are all new categories. Then, the server constructs a data collector, and then constructs a deep prototype network model based on a deep convolutional neural network, and then generates a first support set and a first query set from the training set through the data collector, and uses the first support set and the first query set to iteratively train the deep prototype network model, thereby updating the network weights of the deep prototype network model. Afterwards, the server generates a second support set and a second query set from the validation set through the data collector, and uses the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model, thereby obtaining a deep prototype network model with the highest classification accuracy. After obtaining the deep prototype network model with the highest classification accuracy, the server generates a third support set and a third query set from the test set through the data collector, and uses the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model. The server updates the network weights of the deep prototype network model through the training set, selects the deep prototype network model with the highest classification accuracy through the validation set, and evaluates the classification accuracy through the test set. The test set is a completely new category for the training set and validation set, so it can improve the generalization ability of the deep prototype network model. The support set is a collection of small samples. Each category in the support set only requires a few images, so the server can get better accuracy with a small number of samples, which improves the efficiency of the training model. The server automatically generates support sets and query sets through the data collector, and there is no need to manually build support sets and query sets, which improves user experience and efficiency.
[0073] See also Figure 2 In one possible implementation, the step 104 of the aforementioned embodiment of “iteratively training the deep prototype network model using the first support set and the first query set to update the network weights of the deep prototype network model” may include the following steps:
[0074] 201. Input the first support set into the deep prototype network model for feature extraction to obtain corresponding feature values;
[0075] 202. Calculate the prototype of each category using the eigenvalue corresponding to the first support set;
[0076] It should be noted that when the server calculates the prototype of each category, the algorithm adopted may be the mean prototype algorithm, the weighted mean prototype algorithm, the center point prototype algorithm, the probability density prototype estimation algorithm, etc. This application does not limit this.
[0077] 203. Input the first query set into the deep prototype network model to extract features and obtain corresponding feature values;
[0078] 204. Predicting a category of each image in the first query set according to the feature values corresponding to the first query set and the prototype of each category corresponding to the first support set;
[0079] When the server predicts the category of each image in the first query set, it uses a distance measurement method, and the specific calculation method used can be Euclidean distance, cosine similarity, Mahalanobis distance, Manhattan distance, Hamming distance, etc., which is not limited in this application. For the feature value corresponding to an image in a query set, the server can calculate the metric score of the feature value and the prototype of each category respectively, and then convert all the metric scores into probabilities (the sum of the probabilities corresponding to all the metric scores should be 1), and the category corresponding to the highest probability is used as the predicted category of the image.
[0080] 205. Use the loss function to calculate the loss value and update the network weights of the deep prototype network model through back propagation.
[0081] In the training set training phase, the server uses the loss function to calculate the loss value and updates the network weights of the deep prototype network model through back propagation. This phase can be stopped when the preset number of iterations is reached or manually stopped by the user.
[0082] See also Figure 3 In a possible implementation, in step 105 of the aforementioned embodiment, "using the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model to obtain the deep prototype network model with the highest classification accuracy" may include the following steps:
[0083] 301. Obtain a prototype of each category using the second support set;
[0084] 302. Predicting the category of each image in the second query set by using the prototype of each category corresponding to the second support set;
[0085] Steps 301 to 302 in this embodiment are similar to steps 201 to 204 in the above-mentioned embodiment, and will not be described in detail.
[0086] 303. Update the hyperparameters of the deep prototype network model according to the prediction results, and calculate the classification accuracy of the prediction results;
[0087] 304. Obtain the deep prototype network model with the highest classification accuracy.
[0088] During the validation set training phase, each time the server obtains a prediction result, it will update the hyperparameters of the deep prototype network model based on the prediction result and calculate the classification accuracy of the prediction result. At the end of this phase, the classification accuracy of each training is compared, the highest classification accuracy is selected, and then the corresponding deep prototype network model is obtained.
[0089] See also Figure 4 In a possible implementation, the step 106 of the aforementioned embodiment of “using the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model” may include the following steps:
[0090] 401. Obtain a prototype of each category using the third support set;
[0091] 402. Predicting the category of each image in the third query set by using the prototype of each category corresponding to the third support set;
[0092] Steps 401 to 402 in this embodiment are similar to steps 201 to 204 in the above-mentioned embodiment, and will not be described in detail.
[0093] 403. Calculate the classification accuracy, recall rate and F1 value of the prediction results to evaluate the deep prototype network model.
[0094] During the test set training phase, after obtaining the prediction results, the server calculates the classification accuracy, recall rate, and F1 value of the prediction results. If the classification accuracy, recall rate, and F1 value of the prediction results meet expectations, it can be determined that the performance of the deep prototype network model is good.
[0095] See also Figure 5 , an embodiment of a training device for a deep prototype network in an embodiment of the present application includes:
[0096] An acquisition unit 501 is used to acquire a set of images with marked categories, and use the image set to construct a training set, a validation set and a test set, wherein the categories included in the training set and the validation set are consistent, and the categories included in the test set are inconsistent with the categories included in the training set;
[0097] A first construction unit 502 is used to construct a data collector, wherein the data collector is used to extract images from the training set, the validation set or the test set to generate a support set and a query set, wherein the number of images of each category in the support set generated each time is fixed;
[0098] A second construction unit 503 is used to construct a deep prototype network model based on a deep convolutional neural network;
[0099] A first generating unit 504 is used to generate a first support set and a first query set from the training set in batches through the data collector, and iteratively train the deep prototype network model using the first support set and the first query set to update the network weights of the deep prototype network model;
[0100] A second generating unit 505 is used to generate a second support set and a second query set from the validation set in batches through the data collector, and use the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model to obtain a deep prototype network model with the highest classification accuracy;
[0101] The third generating unit 506 is used to generate a third support set and a third query set from the test set in batches through the data collector, and use the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model.
[0102] In this embodiment, the acquisition unit 501 first acquires a set of images with marked categories, and uses the image set to construct a training set, a validation set, and a test set, wherein the categories of the training set and the validation set are consistent, and the categories of the test set are inconsistent with the categories included in the training set, that is, the test set is equivalent to the training set, and the categories included in the test set are all new categories. Then, the first construction unit 502 constructs a data collector, and then the second construction unit 503 constructs a deep prototype network model based on a deep convolutional neural network, and the first generation unit 504 generates a first support set and a first query set from the training set through the data collector, and uses the first support set and the first query set to iteratively train the deep prototype network model, thereby updating the network weights of the deep prototype network model. Afterwards, the second generation unit 505 generates a second support set and a second query set from the validation set through the data collector, and uses the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model, thereby obtaining a deep prototype network model with the highest classification accuracy. After obtaining the deep prototype network model with the highest classification accuracy, the third generation unit 506 generates a third support set and a third query set from the test set through a data collector, and uses the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model. The server updates the network weights of the deep prototype network model through the training set, screens out the deep prototype network model with the highest classification accuracy through the verification set, and evaluates the classification accuracy through the test set. The test set is a completely new category for the training set and the verification set, so the generalization ability of the deep prototype network model can be improved. The support set is a collection of small samples, and each category in the support set only requires a few images. Therefore, the server can obtain better accuracy with a small number of samples, which improves the efficiency of the training model. The server automatically generates support sets and query sets through a data collector, and there is no need to manually construct support sets and query sets, which improves user experience and efficiency.
[0103] See also Figure 6 Another embodiment of the training device of the deep prototype network in the embodiment of the present application includes:
[0104] Processor 601, memory 602, input and output unit 603 and bus 604;
[0105] The processor 601 is connected to the memory 602, the input and output unit 603 and the bus 604;
[0106] The memory 602 stores a program, and the processor 601 calls the program to execute Figures 1 to 4 Steps in the illustrated embodiment.
[0107] In this embodiment, the function of the processor 601 is the same as that of the aforementioned Figures 1 to 4The steps in the illustrated embodiments correspond to each other and will not be described again here.
[0108] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0109] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0110] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0111] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0112] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A training method for a deep prototype network, characterized in that: include: Obtain a set of images with marked categories, and use the image set to construct a training set, a validation set, and a test set, wherein the categories included in the training set and the validation set are consistent, and the categories included in the test set are inconsistent with the categories included in the training set; Constructing a data collector, the data collector is used to extract images from the training set, the validation set or the test set to generate a support set and a query set, wherein the number of images of each category in the support set generated each time is fixed; in the same extraction task, the number of images of each category in the query set extracted by the data collector is greater than the number of images of each category in the support set extracted by the data collector; Build a deep prototype network model based on deep convolutional neural network; Generating a first support set and a first query set from the training set in batches through the data collector, and iteratively training the deep prototype network model using the first support set and the first query set to update the network weights of the deep prototype network model; Generating a second support set and a second query set from the validation set in batches by the data collector, and using the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model to obtain a deep prototype network model with the highest classification accuracy; Generating a third support set and a third query set from the test set in batches by the data collector, and using the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model; The step of evaluating the classification accuracy of the iteratively trained deep prototype network model by using the second support set and the second query set to obtain the deep prototype network model with the highest classification accuracy comprises: Obtaining a prototype of each category using the second support set; Predicting the category of each image in the second query set using the prototype of each category corresponding to the second support set; Update the hyperparameters of the deep prototype network model according to the prediction results, and calculate the classification accuracy of the prediction results; Repeat the steps of obtaining the prototype of each category, predicting the category of each image in the second query set, updating the hyperparameters of the deep prototype network model, and calculating the classification accuracy of the prediction results. When the number of repetitions reaches a preset value, the deep prototype network model with the highest classification accuracy is obtained.
2. The method according to claim 1, characterized in that The method of constructing a deep prototype network model based on a deep convolutional neural network includes: Use deep convolutional neural network as the backbone network; The backbone network is initialized, and the head of the backbone network is replaced with a Flatten layer, thereby obtaining a deep prototype network model.
3. The method according to claim 1, characterized in that The iterative training of the deep prototype network model using the first support set and the first query set includes: Inputting the first support set into the deep prototype network model for feature extraction to obtain corresponding feature values; Calculating the prototype of each category using the eigenvalues corresponding to the first support set; Inputting the first query set into the deep prototype network model to extract features and obtain corresponding feature values; Predicting the category of each image in the first query set according to the feature values corresponding to the first query set and the prototype of each category corresponding to the first support set; Calculating the loss value using the loss function and updating the network weights of the deep prototype network model through back propagation; Repeat the above steps until the preset number of iterations of training is reached or it is manually stopped.
4. The method according to claim 3, characterized in that The calculating the prototype of each category by using the eigenvalue corresponding to the first support set comprises: The prototype of each category is calculated by calculating the feature value corresponding to each category in the first support set according to the prototype algorithm.
5. The method according to claim 4, characterized in that The prototype algorithms include a mean prototype algorithm, a weighted mean prototype algorithm, a center point prototype algorithm, and a probability density prototype estimation algorithm.
6. The method according to any one of claims 1 to 5, characterized in that The using the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model comprises: Obtaining a prototype of each category using the third support set; Predicting the category of each image in the third query set by using the prototype of each category corresponding to the third support set; The classification accuracy, recall, and F1 value of the prediction results are calculated to evaluate the deep prototype network model.
7. A training device for a deep prototype network, characterized in that: include: An acquisition unit, used for acquiring a set of images with marked categories, and using the image set to construct a training set, a validation set and a test set, wherein the categories included in the training set and the validation set are consistent, and the categories included in the test set are inconsistent with the categories included in the training set; A first construction unit is used to construct a data collector, wherein the data collector is used to extract images from the training set, the validation set or the test set to generate a support set and a query set, wherein the number of images of each category in the support set generated each time is fixed; in the same extraction task, the number of images of each category in the query set extracted by the data collector is greater than the number of images of each category in the support set extracted by the data collector; A second construction unit is used to construct a deep prototype network model based on a deep convolutional neural network; A first generating unit is used to generate a first support set and a first query set from the training set in batches through the data collector, and iteratively train the deep prototype network model using the first support set and the first query set to update the network weights of the deep prototype network model; A second generating unit is used to generate a second support set and a second query set from the validation set in batches through the data collector, and use the second support set and the second query set to evaluate the classification accuracy of the iteratively trained deep prototype network model to obtain a deep prototype network model with the highest classification accuracy; A third generating unit is used to generate a third support set and a third query set from the test set in batches through the data collector, and use the third support set and the third query set to evaluate the classification accuracy of the deep prototype network model; The second generating unit is specifically used for: Obtaining a prototype of each category using the second support set; Predicting the category of each image in the second query set using the prototype of each category corresponding to the second support set; Update the hyperparameters of the deep prototype network model according to the prediction results, and calculate the classification accuracy of the prediction results; Repeat the steps of obtaining the prototype of each category, predicting the category of each image in the second query set, updating the hyperparameters of the deep prototype network model, and calculating the classification accuracy of the prediction results. When the number of repetitions reaches a preset value, the deep prototype network model with the highest classification accuracy is obtained.
8. A training device for a deep prototype network, characterized in that: include: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; A program is stored in the memory, and the processor calls the program to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a program stored thereon, wherein when the program is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 6.
