Training method and device of image classification and recognition model and image classification and recognition method
By using convolutional neural networks and multi-round training steps in the image recognition model, combined with bagging sampling, an enhanced classifier is constructed to balance the sample distribution, which solves the problem of low accuracy of traditional models in large-scale image classification and recognition, and significantly improves Image recognition accuracy.
Patent Information
- Application Number
- CN202410816603.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-01
AI Technical Summary
The image recognition model trained by traditional model training methods has low classification and recognition accuracy for large-scale images and cannot effectively meet the requirements of large-scale image classification and feature extraction.
Using a convolutional neural network, an image classification and recognition model including the first, second and third classifiers is constructed through multiple rounds of training steps. In each round of training, samples are randomly selected and misclassified samples are added to the next round of training subsets. , and combined with the Bagging sampling method to ensure a balanced number of training subset samples for each classifier.
The classification and recognition accuracy of large-scale images is improved. By strengthening the classifier and balancing the sample distribution, the classification accuracy of the model is significantly improved.
Smart Images

Figure CN118736378A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition, and in particular to a training method and device for an image classification and recognition model, and an image classification and recognition method. Background Art
[0002] The information conveyed by images is more intuitive and richer than other forms. Image recognition technology refers to the use of computers to process and identify images, replacing humans to complete classification and recognition work, making it have advanced intelligence similar to human vision, and is widely used in the extraction and classification of target features. However, the image recognition model trained by the traditional model training method is only based on the recognition and analysis of local feature nodes of image targets, which is difficult to meet the requirements of large-scale image classification and feature extraction, and its classification and recognition accuracy for large-scale images is low. With the advent of the big data era, the processing of large-scale image classification is increasing.
[0003] Currently, no effective solution has been proposed to the problem that image recognition models trained by traditional model training methods have low classification and recognition accuracy for large-scale images. Summary of the invention
[0004] The present invention provides a method and device for training an image classification and recognition model, and an image classification and recognition method to solve the problem that the image recognition model trained by the traditional model training method has low classification and recognition accuracy for large-scale images.
[0005] In a first aspect, the present invention provides a training method for an image classification and recognition model, wherein the image classification and recognition model adopts a convolutional neural network and the image classification and recognition model includes a first classifier, a second classifier, and a third classifier, wherein the training method includes multiple rounds of training steps, and each round of the training steps includes:
[0006] Constructing a training set for the first classifier, the second classifier, and the third classifier, wherein the training set includes a plurality of image samples;
[0007] Randomly extracting N image samples with replacement from the training set of the first classifier to add to the first training subset, and adding the unextracted image samples to the first transfer subset;
[0008] The first classifier is trained by the first training subset, and the image samples in the first transfer subset are classified by the trained first classifier, and M1 image samples that are misclassified are added to the second training subset;
[0009] Randomly extract N-M1 image samples with replacement from the training set of the second classifier and add them to the second training subset, and add the unextracted image samples to the second transfer subset;
[0010] The second classifier is trained by the second training subset, and the image samples in the second transfer subset are classified by the trained second classifier, and M2 image samples with classification errors are added to the third training subset;
[0011] Randomly extracting N-M2 image samples with replacement from the training set of the third classifier and adding them into the third training subset;
[0012] The third classifier is trained using the third training subset.
[0013] In a second aspect, the present invention provides an image classification and recognition method, which classifies images by adopting an image classification and recognition model of a convolutional neural network, and the image classification and recognition model is trained by the training method of the image classification and recognition model described in the first aspect.
[0014] In a third aspect, the present invention provides a training device for an image classification and recognition model, wherein the image classification and recognition model adopts a convolutional neural network and the image classification and recognition model includes a first classifier, a second classifier, and a third classifier, and the training device includes:
[0015] A training set construction module, used to construct training sets for the first classifier, the second classifier and the third classifier, wherein the training sets include a plurality of image samples;
[0016] A first extraction module, configured to randomly extract N image samples with replacement from the training set of the first classifier and add them to a first training subset, and to add the unextracted image samples to a first transfer subset;
[0017] A first training module, configured to train the first classifier using the first training subset, classify the image samples in the first transfer subset using the trained first classifier, and add M1 image samples that are misclassified into a second training subset;
[0018] A second extraction module, configured to randomly extract N-M1 image samples with replacement from the training set of the second classifier and add them to a second training subset, and to add the unextracted image samples to a second transfer subset;
[0019] A second training module is used to train the second classifier using the second training subset, classify the image samples in the second transfer subset using the trained second classifier, and add M2 image samples that are misclassified into a third training subset;
[0020] A third extraction module, used for randomly extracting N-M2 image samples with replacement from the training set of the third classifier and adding them to a third training subset;
[0021] The third training module is used to train the third classifier using the third training subset.
[0022] In a fourth aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the training method of the image classification recognition model described in the first aspect.
[0023] Compared with the related art, the training method of the image classification and recognition model provided by the present invention applies and improves the Boosting method, and uses three classifiers to form a strong classifier. It not only adds the image samples misclassified by the previous classifier to the training subset of the next classifier, but also ensures that the training subset of each classifier has the same number of image samples, and combines the Bagging sampling method to perform sample sampling for the training subset of each classifier. The image classification and recognition model obtained by the training method has a high classification and recognition accuracy for large-scale images, which solves the problem that the image recognition model trained by the traditional model training method has a low classification and recognition accuracy for large-scale images.
[0024] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a flowchart of a training method for an image classification and recognition model provided in an embodiment of the present invention;
[0026] Figure 2 is a flowchart of a training method for an image classification and recognition model in one embodiment of the present invention;
[0027] Figure 3 This is a comparison chart of the classification and recognition accuracy of CNN and its integrated strategy model;
[0028] Figure 4 This is a comparison chart of the accuracy changes of CNN's Bagging ensemble strategy model and three classifiers;
[0029] Figure 5This is a comparison chart of the accuracy of CNN's Bagging ensemble strategy model and the model trained using labeled data;
[0030] Figure 6 This is a comparison chart of the classification and recognition accuracy of CNN's Bagging ensemble strategy model and a single classifier;
[0031] Figure 7 It is a result graph of label expansion of an image set by the weighted association rule mining method provided by the present invention;
[0032] Figure 8 It is a schematic diagram of the influence of parameter selection on labeling performance in the weighted association rule mining method provided by the present invention. DETAILED DESCRIPTION
[0033] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0034] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0035] The present invention provides a training method for an image classification and recognition model.
[0036] Among them, the image classification and recognition model adopts a convolutional neural network and the image classification and recognition model includes a first classifier, a second classifier and a third classifier.
[0037] Figure 1 is a flow chart of a training method for an image classification and recognition model provided in an embodiment of the present invention, such as Figure 1 As shown, the process includes multiple rounds of training steps, and each round of training steps includes steps S110 to S170.
[0038] Step S110: construct training sets for the first classifier, the second classifier, and the third classifier, wherein the training sets include a number of image samples.
[0039] Step S120: randomly extract N image samples with replacement from the training set of the first classifier and add them to the first training subset, and add the unextracted image samples to the first transfer subset.
[0040] Step S130 , training the first classifier through the first training subset, classifying the image samples in the first transfer subset through the trained first classifier, and adding M1 image samples that are misclassified into the second training subset.
[0041] Step S140, randomly extract N-M1 image samples with replacement from the training set of the second classifier and add them to the second training subset, and add the unextracted image samples to the second transfer subset.
[0042] Step S150, training the second classifier through the second training subset, classifying the image samples in the second transfer subset through the trained second classifier, and adding M2 image samples that are misclassified into the third training subset.
[0043] Step S160: randomly extract N-M2 image samples with replacement from the training set of the third classifier and add them to the third training subset.
[0044] Step S170: training the third classifier using the third training subset.
[0045] Specifically, the Boosting method is an iterative model training method, which uses a serial class to continuously make up for the deficiencies of the previous weak classifier, thereby constructing a strong classifier. The Boosting method uses a serial method to form a training subset of the classifier. During the data set update process, the training network consists of three classifiers. The training method provided by the present invention is essentially an application and improvement of the Boosting method.
[0046] First, three classifiers are trained in a serial manner to construct a strong classifier. Secondly, the image samples that were misclassified by the previous classifier are used as part of the training subset of the next classifier, so that the next classifier can pay more attention to the image samples that were misclassified by the previous classifier during the training and learning process, thereby balancing the shortcomings of the previous classifier. More importantly, in order to balance the number of image samples in the training subsets of different classifiers, image samples are randomly and with replacement extracted from the training sets of each classifier to supplement the training subsets, so that the number of image samples in the training subsets of each classifier is N. Among them, randomly and with replacement extracting image samples and adding them to the training subsets of each classifier is the Bagging sampling method. For unstable models such as decision trees and neural networks that have a greater impact on the training scale, the Bagging sampling method has a good training effect.
[0047] It should be noted that the three classifiers can use exactly the same training set in the first round of training, and the training sets of each classifier can be continuously updated and expanded in subsequent rounds of training. At this time, the training sets of each classifier are partially different. It should be noted that, assuming that the number of image samples in the training set of each classifier is L, then N should be greater than or equal to L / 2.
[0048] Furthermore, the cutoff condition of the training method includes: after the current round of training steps, the improvement of the classification and recognition accuracy of the image classification and recognition model for image samples compared with the previous round is less than the target threshold. Specifically, the purpose of model training is to continuously improve the classification and recognition accuracy of the image classification and recognition model until the classification and recognition accuracy of the image classification and recognition model no longer improves or no longer improves significantly. Therefore, the target threshold can be set in advance, and when the improvement of the classification and recognition accuracy of the image classification and recognition model by the current round of training steps is less than the target threshold, you can choose to stop learning. Among them, the target threshold can be set according to the actual situation, and it can be set to 0.
[0049] And, different convolutional neural networks can be used for the three classifiers. In one embodiment, the first classifier is VGGNet, the second classifier is GoogLeNet, and the third classifier is ResNet.
[0050] In summary, the above technical solution applies and improves the Boosting method, and uses three classifiers to form a strong classifier. It not only adds the image samples that are misclassified by the previous classifier to the training subset of the next classifier, but also ensures that the training subset of each classifier has the same number of image samples, and combines the Bagging sampling method to perform sample sampling for the training subset of each classifier. The image classification and recognition model obtained by this training method has a high classification and recognition accuracy for large-scale images, which solves the problem that the image recognition model trained by the traditional model training method has a low classification and recognition accuracy for large-scale images.
[0051] In some of the embodiments, N-M1 image samples are randomly selected with replacement from the training set of the second classifier and added to the second training subset, and the unselected image samples are added to the second transfer subset, including: N-M1 image samples are randomly selected with replacement from the image samples other than M1 image samples in the training set of the second classifier and added to the second training subset, and the unselected image samples are added to the second transfer subset.
[0052] Randomly extracting N-M2 image samples with replacement from the training set of the third classifier and adding them to the third training subset includes: randomly extracting N-M2 image samples with replacement from the image samples other than the M2 image samples in the training set of the third classifier and adding them to the third training subset.
[0053] In order to balance the number of samples in the training subset of each classifier, it is necessary to extract image samples from their respective training sets to supplement the training subsets. For the second or third classifier, in order to avoid the training subset being too concentrated on image samples that were misclassified by the previous classifier, these image samples can be excluded during sampling.
[0054] As mentioned above, the three classifiers can use exactly the same training set in the first round of training, and the training sets of each classifier can be continuously updated and expanded in subsequent rounds of training.
[0055] Therefore, in some embodiments, in the first round of training steps, the training sets of the first classifier, the second classifier, and the third classifier are the same; each round of training steps further includes step S180 and step S190 after the third classifier training is completed:
[0056] Step S180: construct a candidate sample set, which includes M all image samples;
[0057] Step S190, randomly extracting three new training sets from the candidate sample set with replacement, and adding the three new training sets to the training sets of the first classifier, the second classifier, and the third classifier, respectively. Each new training set includes Mall / 3 image samples.
[0058] In this embodiment, a specific training set update strategy is provided. Through the above training set update strategy, the differences between the three classifiers can be further increased, the speed at which the three classifiers converge to a uniform state can be slowed down, and the effective integration of the three classifiers can be achieved. Starting from the second round of training, after the third classifier training is completed, the total samples added to the training set in the previous round are verified and marked, and a more stringent screening standard is adopted. Only the three classifiers consistently predict the pseudo-label as the final classification label of the image sample, and the remaining samples are included in the unlabeled image sample set.
[0059] Figure 2 FIG. 1 is a flow chart of a training method for an image classification and recognition model in one embodiment of the present invention. For the above embodiment, the training process of the image classification and recognition model can refer to Figure 2 .exist Figure 2 In the sample set M all Then it is the candidate sample set (the number of samples is M all ), the sample set L is the training set (the number of samples is L), and the number of training subsets for each classifier is M all / 3+L, after comprehensive training of the three classifiers, a strong classifier can be obtained.
[0060] As mentioned above, the model training process is mainly introduced. It is also very important to label image samples in the initial stage of training. Due to the huge amount of image samples, it is impossible to manually label each image sample. The image label propagation labeling method is a method for labeling unlabeled image samples based on labeled image samples. In some embodiments of the present invention, an image label propagation labeling method based on semantic clustering analysis is used for labeling.
[0061] Specifically, in some embodiments, the training method further includes a sample labeling step, wherein the sample labeling step performs label propagation labeling on unlabeled image samples according to labeled image samples, and the labeled image samples are used to construct a training set and a candidate sample set. The sample labeling step includes steps S210, S220, and S230.
[0062] Step S210 , determining an approximate image cluster of the target image sample to be labeled from the labeled image samples through semantic clustering.
[0063] Step S220, determining each semantic label existing in the approximate image cluster of the target image sample and the corresponding number of occurrences, and calculating the weight of each semantic label.
[0064] Among them, the weight w of the i-th semantic label iThe calculation formula is as follows:
[0065]
[0066] I(l i )=-logp(l i )
[0067] Among them, l i represents the i-th semantic label, I(l i ) represents the information content of the i-th semantic label, I(l j ) represents the information content of the jth semantic label, q represents the total number of different semantic labels existing in the approximate image cluster of the target image sample, represents the total information content of all semantic labels, p(l i ) represents the probability of the i-th semantic label appearing in the approximate image cluster.
[0068] Step S230 , determining the semantic label of the target image sample according to each semantic label existing in the approximate image cluster of the target image sample and the corresponding weight.
[0069] Specifically, X={x1,x2,...x N} represents an image sample dataset. Each image sample is considered as a node, and a graph can be constructed. The weight corresponding to the edge connecting two nodes reflects the visual similarity of the two image samples. Through semantic clustering analysis, we can obtain the visual similarity of the target image sample x. i A set of similar image samples is called target image sample x i The approximate image cluster of Approximate image clusters The semantic labels of all image samples appearing in are counted to form a set of labels, denoted as L = {l1:n1,l2:n2...,l q :n q}. Among them, l i (i∈(1,2,...,q)) represents the semantic label, n i (i∈(1,2,...,q)) represents the semantic label l i The above weight calculation formula can be used to calculate the number of occurrences of each semantic label l in the label set L. i Initialize a weight value w i .
[0070] The embodiment provides a specific weighted association rule mining method, which semantically clusters the approximate image samples of each target image sample and determines the semantic label of the target image sample through the semantic labels of these approximate image samples.
[0071] The rules mined by the weighted association rule mining method have improved support and confidence in terms of weighted support and weighted confidence compared with those of traditional association rule mining. And the confidence of the rule {laptop, ThinkPad}→{computer} is also higher than the confidence of the rule {laptop}→{computer} and the rule {ThinkPad}→{computer} (the latter two are both through the association of a single approximate label). This can also prove that the correlation between the computer and the label set {laptop, ThinkPad} is stronger than the correlation between the laptop and the computer or the ThinkPad and the computer. The main reasons for the above results are as follows: the traditional association rule mining method Apriori has an important property, that is, all non-empty subsets of frequent item sets must also be frequent item sets. In the weighted association rule mining method provided by the present invention, all non-empty subsets of frequent item sets do not need to be frequent item sets. Since the weighted association rule mining method believes that the importance of each item in a thing is different, it should be distinguished, so different weights are given to each item and each item set. Although some tags are rare, they contain a lot of valuable information. Giving these tags and the tag sets containing them a larger weight increases their importance in the semantic tag set, so that they can play a better role in the rule mining stage. The weighted association rule mining method measures the support of semantic tags by accumulating weights instead of using traditional support counting statistics. This retains infrequent tag sets to obtain more information and mines the implicit relationship between tags from these tag sets.
[0072] Finally, after obtaining the weight of each semantic label in the approximate image cluster of the target image sample, the semantic label of the target image sample can be updated. For example, the semantic label of the target image sample can be obtained by weighted superposition of each semantic label in the approximate image cluster; or the semantic label with the largest weight can be used as the semantic label of the target image sample, and the selection and processing can be carried out according to the actual situation. The focus of the above scheme is to determine all semantic labels related to the target image sample and their weights.
[0073] As described above, at least one embodiment of each part of the training method for the image classification and recognition model provided by the present invention has been described respectively. It should be noted that the various parts of the training method for the image classification and recognition model can be combined using different embodiments to form different embodiments of the training method for the image classification and recognition model.
[0074] For example, in a specific overall embodiment, the training method of the image classification recognition model includes:
[0075] Step S210 , determining an approximate image cluster of the target image sample to be labeled from the labeled image samples through semantic clustering.
[0076] Step S220 , determining each semantic tag existing in the approximate image cluster of the target image sample and the corresponding number of occurrences, and calculating the weight of each semantic tag.
[0077] Among them, the weight w of the i-th semantic label i The calculation formula is as follows:
[0078]
[0079] I(l i )=-logp(l i )
[0080] Among them, I(l i ) represents the information content of the i-th semantic label, I(l j ) represents the information content of the jth semantic label, q represents the total number of different semantic labels existing in the approximate image cluster of the target image sample, Represents the total information content of all semantic tags.
[0081] Step S230 , determining the semantic label of the target image sample according to each semantic label existing in the approximate image cluster of the target image sample and the corresponding weight.
[0082] Step S110, constructing training sets for the first classifier, the second classifier and the third classifier, wherein the training sets include a number of image samples. The first classifier is VGGNet, the second classifier is GoogLeNet, and the third classifier is ResNet.
[0083] Step S120: randomly extract N image samples with replacement from the training set of the first classifier and add them to the first training subset, and add the unextracted image samples to the first transfer subset.
[0084] Step S130 , training the first classifier through the first training subset, classifying the image samples in the first transfer subset through the trained first classifier, and adding M1 image samples that are misclassified into the second training subset.
[0085] Step S140, randomly extracting N-M1 image samples with replacement from the image samples other than M1 image samples in the training set of the second classifier and adding them to the second training subset, and adding the unextracted image samples to the second transfer subset.
[0086] Step S150, training the second classifier through the second training subset, classifying the image samples in the second transfer subset through the trained second classifier, and adding M2 image samples that are misclassified into the third training subset.
[0087] Step S160: randomly extract N-M2 image samples with replacement from the image samples other than the M2 image samples in the training set of the third classifier and add them to the third training subset.
[0088] Step S170: training the third classifier using the third training subset.
[0089] Step S180: construct a candidate sample set, which includes M all image samples;
[0090] Step S190, randomly extracting three new training sets from the candidate sample set with replacement, and adding the three new training sets to the training sets of the first classifier, the second classifier, and the third classifier, respectively. Each new training set includes M all / 3 image samples. In the first round of training, the training sets of the first classifier, the second classifier and the third classifier are the same.
[0091] In this specific embodiment, a specific implementation process of the training method of the image classification recognition model is provided. The specific explanation of each step can be referred to the aforementioned embodiment and will not be repeated in this specific embodiment.
[0092] As follows, the effectiveness of the training method for the image classification and recognition model provided by the present invention is further illustrated through model performance comparison experiments and result analysis.
[0093] 1. Experimental environment.
[0094] This experiment was completed in the Ubuntu 4.04 system. The deep learning caffe framework was used to complete the model construction and parameter setting. The CPU of Intel (R) Xeon (R) CPU E5-2643 was used, the memory size was 64G, and the GPU selected the memory size of 12GB x 2 NVIDIA Tesla K40m x 2. In order to distribute the data, 3000 tables were selected as the training set L, 1811 tables as the verification set Y, and 6977 unknown samples as the test set u. In order to verify the effectiveness of the proposed training method, experiments were conducted on the classic Flickr image dataset. The dataset consists of 25,000 images covering animals, people, landscapes, cities, and modern life. The tags are generated by Flickr users, with a total of 1386 tags covering 29 semantic topics, as shown in Table 1.
[0095] Table 1 Semantic topics contained in the Flickr image collection
[0096] General Topics Subtopics Sky cloud water Sea / Ocean, River, Lake people Portrait, Boy / Man, Girl / Woman, Baby night Plant Life Tree, flower animal Dog, Bird Structure architecture, building, house, city / urban, bridge, road / street Sunset indoor transportation car
[0097] Experiments were conducted on the Flickr image dataset, and 10 semantic topics with the highest frequency were selected, each of which was labeled at least 200 times. 150 images were randomly selected from each topic to form a training set, and the remaining 50 images formed a test set. Images in the training and test sets were extracted, including 64-dimensional color histograms in LAB space, 144-dimensional color autocorrelation maps in HSV space, 73-dimensional edge gradient histogram features, 128-dimensional wavelet texture features, and 500-dimensional SIFT features represented by visual word bags.
[0098] 2. Model performance comparison experiment and result analysis.
[0099] In the verification of the comprehensive learning model of convolutional neural network (CNN), both strategies effectively slowed down the speed at which the three classifiers converged. Using the improved Boosting strategy (compared with the training method provided by the present invention, random sample sampling with replacement is not used and the training set of each classifier is not updated), the accuracy of the sixth round is no longer improved. The Bagging ensemble strategy (the training method provided by the present invention) is used to train to the seventh round and mark all unlabeled samples. The experimental results of the two comprehensive strategies and the experimental results of the traditional method are as follows Figure 3 shown.
[0100] The experimental results show that as the training progresses, the accuracy of the model continues to improve and eventually stabilizes. Therefore, the result of the round with the highest accuracy is taken as the final model, that is, the improved Boosting strategy model of CNN takes the result of the fifth round as the final model, and the Bagging ensemble strategy model of CNN (the image classification and recognition model obtained by the training method of the present invention) takes the result of the seventh round as the final model. Figure 3 It can be seen that compared with the CNN method, the improved Boosting strategy has a delaying effect on the convergence of the model, but the effect is small. Moreover, a large number of error samples are introduced when using this strategy for integration, so that the accuracy of the model has almost no improvement or even decreases in the later stage. This phenomenon shows that this strategy is not applicable. It can neither solve the problem of small differences between classifiers, nor the accumulation of noise will make the model accuracy worse. In the Bagging ensemble strategy model of CNN, good performance is shown. In the early stage of the model, the method of randomly adding newly added samples to the training set of the three classifiers is adopted, which delays the speed at which the classifiers converge to consistency. The accuracy of the previous model was slow, and the error sharing method was weakened. Error propagation, the model was trained to the seventh round to obtain the final model, and the model accuracy reached 83.44%. After experimental comparison, it is concluded that the Bagging ensemble strategy classification model of CNN is a model with better performance. The training process and results of the model are analyzed in detail below. During the training process of the Bagging ensemble strategy, the changes in the accuracy of the three classifiers and the comprehensive classification model are as follows Figure 4 shown.
[0101] from Figure 4 It can be seen that with the increase in the number of training times, the accuracy of the three classifiers gradually increases from small to large, and finally stabilizes. After training, the accuracy of a single classifier is higher than the previous one, indicating that the accuracy of the prediction results is generally on the rise. After all the unlabeled samples are labeled, the maximum accuracy of the three classifiers VGGNet, GoogLeNet and ResNet reaches 74.78%, 75.32% and 75.56%, respectively, which is 12.01%, 10.57% and 11.74% higher than the 62.77%, 64.75% and 63.82% in the first round. The prediction results of the integrated model in each round of training are more than 5% higher than the accuracy of the three individual models, indicating that this method has certain advantages. In the later stage, the advantages of the integrated method are more obvious. The accuracy of the three classification models tends to be flat, while the accuracy of the CNN's Bagging integrated strategy model has been increasing, eventually reaching 83.44%. The three final models of VGGNet, GoogLeNet and ResNet trained with all unknown samples are labeled using the CNN Bagging ensemble strategy model. The accuracy of the model trained directly using the real labels of all samples is as follows: Figure 5 shown.
[0102] from Figure 5 It can be seen that the proposed CNN's Bagging integrated strategy model has labeled 7000 unknown sample labels. The accuracy of the three models is 74.78%, 75.32%, and 75.56%, respectively. The accuracy of the models trained with the true labels of all samples is 79.5%, 80.61%, and 79.6%, respectively. Compared with the two, the error of the CNN's Bagging integrated strategy classification model is about 5%, which shows that the CNN's Bagging integrated strategy can label a large number of unknown samples with a smaller error and is a feasible solution.
[0103] A single classifier was trained using 3,000 labeled samples, and 7,000 unlabeled samples were directly labeled. The labeling accuracy was compared with that of the bagging ensemble strategy model using CNN. The results are as follows: Figure 6As shown. Using 3000 labeled samples to train VGGNet, GoogLeNet and ResNet models, the correct prediction rates of 7000 unlabeled samples are 60.15%, 61.93% and 62.72% respectively. The prediction accuracy of CNN's Bagging integrated strategy model is 83.44%, and the overall prediction accuracy is improved by about 20%. According to the comparison of the above experimental results, in order to solve the model training problem when the number of labeled samples is small, a CNN's Bagaging integrated strategy model training method is proposed. The trained model shows better performance and lower error rate, and the model has good convergence.
[0104] Under different support thresholds, the proposed weighted association rule mining method for image annotation (WARMFIA) is compared with the classic association rule discovery method Apriori to analyze the number of rules found. The results are shown in Table 2. Table 3 shows a small set of association rules found by applying the WARMFIA method.
[0105] Table 2 Comparison of the number of association rules found by WARMFIA and Apriori methods
[0106] Support threshold Apriori Method WARMFIA method 0.3 13 375 0.4 8 204 0.5 5 91
[0107] Table 3 Some rules found by WARMFIA method
[0108] Serial Number rule Weighted Support Weighted Confidence 1 Sky=>Clouds 0.52 0.75 2 Sky, Sun => Sunset 0.35 0.68 3 Sea, people=>beach 0.17 0.62 4 Lake => Boat 0.28 0.54 5 Car, Street => City 0.15 0.43
[0109] It can be clearly seen from Table 2 that under any support threshold, this method has more association rules than the Apriori method, which means that this method can obtain more information from labels and label sets. As can be seen from Table 3, the support threshold of the rule car, street=>city is not high. This is caused by omissions in the manual labeling process, resulting in incomplete labeling. In the classic Apriori method, the label city may be deleted because the support count does not meet the requirements. However, in this method, since labels and label sets are weighted, labels with fewer occurrences have large weights, so valuable information can be retained and more potentially interesting rules can be mined. The initial label set of the unlabeled image is expanded using the mined rules, and the results are shown in Figure 2. Figure 7 shown.
[0110] from Figure 7It can be seen that most unlabeled images can be expanded to 4-10 potentially meaningful semantic labels, which also reflects the method of the WARMFIA method in discovering the number of association rules and the quality of expanded labels. The performance is better than the classic Apriori method, which shows the effectiveness of this method. Since the comprehensive correlation measure is a linear combination of the image visual label correlation and the internal correlation of the label set, the choice of the balancing factor β also has an impact on the average precision. The value of β is between 0 and 1. When β = 0, the comprehensive correlation between labels depends on the visual correlation of the image. When β = 1, the comprehensive correlation between labels is determined by the internal correlation of the label set. For each value of β, the average precision of all test images is calculated, and the number of labels in the candidate set is taken as 4, 6, 8, 10, and 12, respectively. The experimental results are shown in Figure 8 shown.
[0111] from Figure 8 It can be seen that there are 5 average precision curves fluctuating between 0 and 1. In particular, when β = 0.6, all precision curves reach the optimal value of their performance, and the results are better than the results of using semantic visual label correlation and label set internal correlation separately. When β = 0.6, the results show that the contribution of visual label correlation is slightly greater than the contribution of label set internal correlation in the linear combination process of comprehensive correlation measures. At the same time, the smaller the K value, the higher the accuracy obtained. This is because as the range of candidate label sets increases, the results will contain noise contained in similar visual neighbor images, resulting in inaccurate labeling results. This experiment shows that considering the correlation of image visual labels and the internal correlation of label sets is of great significance to the accuracy of labeling. The labeling performance is sensitive to different β values. By default, the value of β is set. The best result of 0.6 is obtained. In summary, the measure of similarity between semantic labels is explored. The mutual information of the posterior probability of the candidate label set is used to measure the image visual label correlation. The weighted bath metric is used to measure the internal correlation of the label set, and the two metrics are combined. Labels are selected from the candidate label set for denoising, and the effectiveness of the relevant measurement methods is verified through experiments, with satisfactory results.
[0112] 3. Conclusion
[0113] Image classification is a key research object for researchers in machine learning and pattern recognition. Traditional image classification methods are difficult to meet the requirements of large-scale image classification in terms of performance, efficiency and intelligence. In the divergence-based semi-supervised learning method, the three models are often too fast due to the small differences between classifiers. The idea of ensemble learning is applied to the field of semi-supervised image classification. Boosting strategy and Bagging strategy are proposed to improve CNN, which increase the difference by distinguishing the training set samples of different classifiers. Experiments are carried out according to the ensemble model design, and the results of the two strategies are compared and analyzed. The experimental results show that the CNN Bagging comprehensive strategy classification model can delay the speed of the model and has better classification performance. Users are incompletely labeled during the labeling process, resulting in labels with low frequency but meaningful. Since they do not meet the support count, they cannot be mined using mining methods. Therefore, a weighted association rule mining method suitable for image semantic labeling tasks is proposed. This assigns a certain weight to each label and label set, and retains those labels with low occurrence but valuable. Rules that meet the weighted support and confidence thresholds are extracted, and rules that are difficult to perceive and have high interest are mined. When using the weighted association rule mining method to mine the association relationship between semantic tags, the proposed method manually determines the thresholds of the two parameters, weighted support and weighted confidence. Therefore, further exploration is needed in the method of selecting the threshold.
[0114] The present invention also provides an image classification and recognition method, which classifies images by adopting an image classification and recognition model of a convolutional neural network, and the image classification and recognition model is trained by the training method of the image classification and recognition model provided by the present invention.
[0115] The present invention also provides a training device for an image classification and recognition model. The image classification and recognition model adopts a convolutional neural network and the image classification and recognition model includes a first classifier, a second classifier and a third classifier. The training device includes a training set construction module, a first extraction module, a first training module, a second extraction module, a second training module, a third extraction module and a third training module.
[0116] The training set construction module is used to construct the training sets of the first classifier, the second classifier and the third classifier, and the training sets include a number of image samples.
[0117] The first extraction module is used to randomly extract N image samples with replacement from the training set of the first classifier and add them to the first training subset, and add the unextracted image samples to the first transfer subset.
[0118] The first training module is used to train the first classifier through the first training subset, classify the image samples in the first transfer subset through the trained first classifier, and add M1 image samples that are misclassified into the second training subset.
[0119] The second extraction module is used to randomly extract N-M1 image samples with replacement from the training set of the second classifier and add them to the second training subset, and add the unextracted image samples to the second transfer subset.
[0120] The second training module is used to train the second classifier through the second training subset, classify the image samples in the second transfer subset through the trained second classifier, and add M2 image samples that are misclassified into a third training subset.
[0121] The third extraction module is used to randomly extract N-M2 image samples with replacement from the training set of the third classifier and add them to the third training subset.
[0122] The third training module is used to train the third classifier using the third training subset.
[0123] The above technical solution applies and improves the Boosting method, and uses three classifiers to form a strong classifier. It not only adds the image samples that are misclassified by the previous classifier to the training subset of the next classifier, but also ensures that the training subset of each classifier has the same number of image samples, and combines the Bagging sampling method to perform sample sampling for the training subset of each classifier. The image classification and recognition model obtained by the training device has a high classification and recognition accuracy for large-scale images, which solves the problem that the image recognition model trained by the traditional model training method has a low classification and recognition accuracy for large-scale images.
[0124] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0125] The present invention also provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the training method of the image classification and recognition model provided by the present invention.
[0126] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.
[0127] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.
Claims
1. A training method for an image classification and recognition model, wherein the image classification and recognition model adopts a convolutional neural network and the image classification and recognition model includes a first classifier, a second classifier and a third classifier, characterized in that: The training method comprises multiple rounds of training steps, each round of the training steps comprising: Constructing a training set for the first classifier, the second classifier, and the third classifier, wherein the training set includes a plurality of image samples; Randomly extracting N image samples with replacement from the training set of the first classifier to add to the first training subset, and adding the unextracted image samples to the first transfer subset; The first classifier is trained by the first training subset, and the image samples in the first transfer subset are classified by the trained first classifier, and M1 image samples that are misclassified are added to the second training subset; Randomly extract N-M1 image samples with replacement from the training set of the second classifier and add them to the second training subset, and add the unextracted image samples to the second transfer subset; The second classifier is trained by the second training subset, and the image samples in the second transfer subset are classified by the trained second classifier, and M2 image samples with classification errors are added to the third training subset; Randomly extracting N-M2 image samples with replacement from the training set of the third classifier and adding them into the third training subset; The third classifier is trained using the third training subset.
2. The training method of the image classification recognition model according to claim 1, characterized in that: The method of randomly extracting N-M1 image samples from the training set of the second classifier with replacement and adding them to the second training subset, and adding the unextracted image samples to the second transfer subset, comprises: From the image samples other than the M1 image samples in the training set of the second classifier, N-M1 image samples are randomly selected with replacement to be added to the second training subset, and the unselected image samples are added to the second transfer subset.
3. The training method of the image classification recognition model according to claim 1, characterized in that: The step of randomly extracting N-M2 image samples from the training set of the third classifier and adding them to the third training subset with replacement includes: From the image samples other than the M2 image samples in the training set of the third classifier, N-M2 image samples are randomly selected with replacement to add into the third training subset.
4. The training method of the image classification recognition model according to claim 1, characterized in that: In a first round of training steps, the training sets of the first classifier, the second classifier and the third classifier are the same; Each round of the training step further includes: Construct a candidate sample set, the candidate sample set includes M all image samples; Three groups of new training sets are randomly selected from the candidate sample set with replacement, and the three groups of new training sets are added to the training sets of the first classifier, the second classifier and the third classifier respectively, and each group of the new training sets includes M all / 3 image samples.
5. The training method of the image classification recognition model according to claim 4, characterized in that: The training method further comprises a sample labeling step, wherein the sample labeling step performs label propagation labeling on unlabeled image samples according to labeled image samples, and the labeled image samples are used to construct the training set and the candidate sample set; The sample marking step comprises: Determine an approximate image cluster of a target image sample to be labeled in the labeled image samples through semantic clustering; Determine each semantic label existing in the approximate image cluster of the target image sample and the corresponding number of occurrences, and calculate the weight of each semantic label; The semantic label of the target image sample is determined according to each semantic label existing in the approximate image cluster of the target image sample and the corresponding weight.
6. The training method of the image classification recognition model according to claim 5, characterized in that: The weight w of the i-th semantic label i The calculation formula is as follows: I(l i )=-logp(l i ) Among them, I(l i ) represents the information content of the i-th semantic label, I(l j ) represents the information content of the jth semantic label, and q represents the total number of different semantic labels existing in the approximate image cluster of the target image sample.
7. The training method of the image classification recognition model according to any one of claims 1 to 6, characterized in that: The cut-off conditions of the training method include: After the current round of training steps is completed, the improvement of the classification and recognition accuracy of the image classification and recognition model for image samples compared with the previous round is less than the target threshold.
8. An image classification and recognition method, characterized in that: The images are classified by adopting an image classification and recognition model of a convolutional neural network, wherein the image classification and recognition model is trained by the training method of the image classification and recognition model described in any one of claims 1 to 7.
9. A training device for an image classification and recognition model, wherein the image classification and recognition model adopts a convolutional neural network and the image classification and recognition model includes a first classifier, a second classifier and a third classifier, characterized in that: The training device comprises: A training set construction module, used to construct training sets for the first classifier, the second classifier and the third classifier, wherein the training sets include a plurality of image samples; A first extraction module, configured to randomly extract N image samples with replacement from the training set of the first classifier and add them to a first training subset, and to add the unextracted image samples to a first transfer subset; A first training module, configured to train the first classifier using the first training subset, classify the image samples in the first transfer subset using the trained first classifier, and add M1 image samples that are misclassified into a second training subset; A second extraction module, configured to randomly extract N-M1 image samples with replacement from the training set of the second classifier and add them to a second training subset, and to add the unextracted image samples to a second transfer subset; A second training module is used to train the second classifier using the second training subset, classify the image samples in the second transfer subset using the trained second classifier, and add M2 image samples that are misclassified into a third training subset; A third extraction module, used for randomly extracting N-M2 image samples with replacement from the training set of the third classifier and adding them to a third training subset; The third training module is used to train the third classifier using the third training subset.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the training method for the image classification and recognition model according to any one of claims 1 to 7.
