Classification vector generation method, device, computer equipment and storage medium

By extracting and merging feature vectors under multiple rotation angles, a comprehensive classification vector is generated, which solves the problem of low accuracy of existing metric learning methods after the rotation angle changes, and achieves more efficient classification performance.

CN112348061BInactive Publication Date: 2024-10-01SHANGHAI YANKONG TECHLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011155908.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-26
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing metric learning methods have low model accuracy after the data angle changes, and cannot effectively adapt to rotation angle changes.

Method used

By obtaining the image data to be processed at multiple rotation angles, input it into the pre-trained classification network to extract feature vectors, and perform merging and dimensionality reduction according to preset rules to generate comprehensive classification vectors to improve classification accuracy.

Benefits of technology

The classification accuracy is improved and efficient classification performance can be maintained when the rotation angle changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112348061B_ABST
    Figure CN112348061B_ABST
Patent Text Reader

Abstract

The present application relates to a classification vector generation method, device, computer equipment and storage medium. The method comprises: obtaining image data to be processed, wherein the image data to be processed comprises image data to be processed at multiple rotation angles; inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed; extracting preset dimensions from the feature vectors of the multiple rotation angles respectively according to preset rules; merging the preset dimensions of the extracted feature vectors of the multiple rotation angles to obtain a comprehensive classification vector, wherein the comprehensive classification vector is used to classify the image data to be processed to obtain corresponding classification labels. The use of this method can improve classification accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a classification vector generation method, apparatus, computer equipment and storage medium. Background Art

[0002] Metric Learning is a common machine learning method in face recognition, proposed by Eric Xing in NIPS 2002. It can learn a feature (Embedding) space, in which all data is converted into a feature vector, and the distance between the feature vectors of similar samples is small, and the distance between the feature vectors of dissimilar samples is large, so as to distinguish the data. Metric learning is also called distance metric learning (DML) or similarity learning. Metric learning is now commonly used in many fields, such as image target detection, image classification, target tracking, face recognition, data classification, etc.

[0003] In traditional technology, metric learning is divided into two types, one is based on supervised learning and the other is based on unsupervised learning.

[0004] However, current metric learning only uses samples with a uniform angle for training. When the angle of the data changes, the accuracy of the model obtained by the original training is low. Summary of the invention

[0005] Based on this, it is necessary to provide a classification vector generation method, device, computer equipment and storage medium that can improve classification accuracy in response to the above technical problems.

[0006] A classification vector generation method, the method comprising:

[0007] Acquire image data to be processed, wherein the image data to be processed includes image data to be processed at multiple rotation angles;

[0008] Inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed;

[0009] Extracting preset dimensions from the feature vectors of the multiple rotation angles respectively according to preset rules;

[0010] The preset dimensions of the feature vectors of the extracted multiple rotation angles are combined to obtain a comprehensive classification vector, and the comprehensive classification vector is used to classify the image data to be processed to obtain a corresponding classification label.

[0011] In one embodiment, the step of inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed includes:

[0012] Extracting an initial classification vector corresponding to the image data to be processed at each rotation angle;

[0013] According to a preset grouping rule, the initial classification vector is split into a plurality of grouping vectors corresponding to the number of rotation angles;

[0014] Performing dimensionality reduction processing on the grouping vector;

[0015] According to the preset grouping rule, the grouping vectors after the dimensionality reduction process are reversely merged to obtain feature vectors of multiple rotation angles corresponding to the image data to be processed.

[0016] In one embodiment, the performing dimensionality reduction processing on the grouping vector includes:

[0017] The grouping vector is sequentially input into a fully connected layer and a normalized layer to perform dimensionality reduction processing on the grouping vector.

[0018] In one embodiment, before inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, the method further includes:

[0019] Splitting the image data to be processed to obtain image data to be processed at multiple rotation angles;

[0020] Merge the image data to be processed at multiple rotation angles in the batch size dimension.

[0021] In one embodiment, splitting the image data to be processed to obtain image data to be processed at multiple rotation angles includes:

[0022] The image data to be processed is split according to the channel dimension to obtain image data to be processed at multiple rotation angles.

[0023] In one embodiment, the training method of the pre-trained classification network includes:

[0024] Acquire sample image data, wherein the sample image data includes sample image data at multiple rotation angles and corresponding sample labels;

[0025] Inputting the sample image data into an initial classification network to extract feature vectors of multiple rotation angles corresponding to the sample image data;

[0026] Extracting preset dimensions from feature vectors of multiple rotation angles corresponding to the sample image data respectively according to preset rules;

[0027] According to the preset dimensions in the feature vectors of the multiple rotation angles corresponding to the sample label and the sample image data, respectively calculate the angle loss function corresponding to each rotation angle;

[0028] A comprehensive loss function is calculated according to the angle loss function;

[0029] The initial classification network is trained by performing gradient backpropagation through the comprehensive loss function until the change of the comprehensive loss function is less than a preset value, and the training of the initial classification network is completed.

[0030] In one embodiment, the calculating the comprehensive loss function according to the angle loss function includes:

[0031] The average value corresponding to the angle loss function is calculated as the comprehensive loss function.

[0032] A method for classifying pictures, the method comprising:

[0033] Generate a comprehensive classification vector by using any of the classification vector generation methods in the above items;

[0034] Matching the comprehensive classification vector with a standard vector in a database;

[0035] When the comprehensive classification vector successfully matches the standard vector in the database, the classification label corresponding to the successfully matched standard vector is obtained as the classification label of the image data to be processed.

[0036] A classification vector generating device, the device comprising:

[0037] A data acquisition module, used to acquire image data to be processed, wherein the image data to be processed includes image data to be processed at multiple rotation angles;

[0038] A multi-angle feature generation module, used for inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed;

[0039] A preset dimension extraction module, used to extract preset dimensions from the feature vectors of the multiple rotation angles respectively according to preset rules;

[0040] The classification vector generation module is used to merge the preset dimensions of the feature vectors of the extracted multiple rotation angles to obtain a comprehensive classification vector, and the comprehensive classification vector is used to classify the image data to be processed to obtain a corresponding classification label.

[0041] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0042] A computer-readable storage medium stores a computer program, which implements the steps of any of the above methods when executed by a processor.

[0043] The above-mentioned classification vector generation method, device, computer equipment and storage medium obtain the feature vectors of multiple rotation angles corresponding to the image data to be processed through the classification network, and merge the feature vectors of multiple rotation angles to obtain a comprehensive classification vector. The classification label is obtained by classifying the image data to be processed through the comprehensive feature vector, which can improve the classification accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A schematic diagram of a flow chart of a classification vector generation method in one embodiment;

[0045] Figure 2 is a schematic diagram of the structure of a classification network in an embodiment;

[0046] Figure 3 is a flow chart of a training process of a classification network in one embodiment;

[0047] Figure 4 for Figure 3 A schematic diagram of an iterative process in the training process of the classification network in the illustrated embodiment;

[0048] Figure 5 A schematic diagram of the structure of a feature vector output by a multi-network head in one embodiment;

[0049] Figure 6 is a flowchart of a method for classifying pictures in one embodiment;

[0050] Figure 7 is a structural block diagram of a classification vector generating device in one embodiment;

[0051] Figure 8 is a structural block diagram of a picture classification device in one embodiment;

[0052] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0054] In one embodiment, Figure 1 As shown, a classification vector generation method is provided. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0055] S102: Acquire image data to be processed, where the image data to be processed includes image data to be processed at multiple rotation angles.

[0056] Specifically, the image data to be processed is an image for which a comprehensive classification vector needs to be extracted, wherein the image data to be processed includes image data to be processed at multiple rotation angles, and specifically, the rotation angle may refer to the rotation angle of the image, such as 0, 90, 180, 270 degrees, etc. In other embodiments, it may also be other rotation angles. The image data to be processed is the image data to be processed at multiple rotation angles obtained together.

[0057] S104: Inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed.

[0058] Specifically, the classification network is pre-trained and may include a feature extraction network for extracting initial classification features of the image data to be processed, and a network head for reducing the dimension of the extracted features. For details, see Figure 2 As shown, the classification network may include a feature extraction network, such as a BN-Inception network, and a multi-network head for reducing the dimension of the extracted features, and each of the multi-network heads may include a fully connected layer and a normalized layer.

[0059] The feature extraction network of the initial classification feature is used to process the image data to be processed to obtain the normalized initial classification feature, such as optimizing the initial classification feature to make the distribution of the initial classification feature more stable in classification, that is, the classification network can learn the feature vectors of the image data to be processed at each rotation angle, so that no matter how the image data to be processed is rotated, the classification label corresponding to the image data to be processed can be accurately obtained. The network head is to reduce the dimension of the initial classification feature to reduce the amount of calculation in the subsequent classification processing. Figure 2As shown, in this embodiment, multiple network heads are used. When the feature extraction network proposes the initial classification features, the initial classification features are split to obtain the split vectors after the splitting, which are equal to the number of network heads, and then they are respectively input into the network heads to obtain the output vectors of the corresponding dimensions. Finally, the output vectors output by each network head are merged and connected to obtain the feature vectors of multiple rotation angles corresponding to the image data to be processed. The corresponding dimension of the feature vector represents the characteristics of the rotation angle. For example, the feature vector corresponds to the feature vector of the image to be processed with a rotation angle of X degrees, and the corresponding dimension of the feature vector with a rotation angle of X degrees is obtained as the final representation of the feature vector of multiple rotation angles corresponding to the image data to be processed. For example, when the feature vector represents the image to be processed with a rotation angle of 0 degrees, the preset dimension of the feature vector is obtained, for example, the first 1 / n dimension is used as the feature corresponding to the image to be processed with a rotation angle of 0 degrees, where n is the number of rotation angles, for example, there are 4 rotation angles, and the feature vector dimension is 512 dimensions, then the first 128 dimensions are the features corresponding to the image to be processed with a rotation angle of 0 degrees, which are used for the classification of subsequent images to be processed.

[0060] The terminal inputs the to-be-processed image data of multiple rotation angles into the pre-trained classification network together, so that the feature vector corresponding to the to-be-processed image data of each rotation angle can be obtained, wherein the specific dimension in the feature vector corresponding to the to-be-processed image data of each rotation angle is used to characterize the characteristics of the rotation angle. Optionally, the classification network can process the to-be-processed image data of multiple rotation angles in serial or in parallel.

[0061] S106: extracting preset dimensions from feature vectors of multiple rotation angles respectively according to preset rules.

[0062] Specifically, the preset rule refers to the extraction rule of the preset dimension of the feature vector in each rotation angle. For example, if the feature vector represents the feature vector corresponding to the image to be processed with a rotation angle of X degrees, the preset dimension of the feature vector is obtained. For example, if there are n rotation angles, and X degrees is arranged at the mth, then the preset dimension can be the dimension of the feature vector / n*(m-1)~the dimension of the feature vector / n*m. For example, assuming that the rotation angle is 0 degree, there are 4 rotation angles, 0 degree is the first one, and the dimension of the feature vector is 512 dimensions, then the preset dimension in the feature vector of the rotation angle is 512 / 4*0~512 / 4*1, that is, 0~128 dimensions.

[0063] S108: merging the preset dimensions of the extracted feature vectors of multiple rotation angles to obtain a comprehensive classification vector, where the comprehensive classification vector is used to classify the image data to be processed to obtain corresponding classification labels.

[0064] Specifically, after the terminal obtains the feature vectors of multiple rotation angles, the preset dimensions in the feature vectors of the multiple rotation angles are merged, for example, multiple feature vectors are sequentially connected in order of rotation angle from small to large to obtain a comprehensive classification vector. For example, the above extracts 0 to 128 dimensions as the dimensions corresponding to 0 degrees, 129 to 256 as the dimensions corresponding to 90 degrees, 257 to 384 as the dimensions corresponding to 180 degrees, and 385 to 512 as the dimensions corresponding to 270 degrees. In this way, the dimensions corresponding to the rotation angles of 0 degrees, 90 degrees, 180 degrees, and 270 degrees corresponding to the same image to be processed are merged to obtain a new 512-dimensional comprehensive classification vector.

[0065] Therefore, the subsequent terminal can classify the image data to be processed according to the comprehensive classification vector to obtain the corresponding classification label.

[0066] The above-mentioned classification vector generation method obtains the feature vectors of multiple rotation angles corresponding to the image data to be processed through the classification network, and merges the feature vectors of multiple rotation angles to obtain a comprehensive classification vector. The classification label is obtained by classifying the image data to be processed through the comprehensive feature vector, which can improve the classification accuracy.

[0067] In one of the embodiments, the image data to be processed is input into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, including: extracting an initial classification vector corresponding to the image data to be processed at each rotation angle; splitting the initial classification vector into multiple grouping vectors corresponding to the number of rotation angles according to a preset grouping rule; performing dimensionality reduction processing on the grouping vectors; and according to the preset grouping rule, reversely merging the grouping vectors after the dimensionality reduction processing to obtain feature vectors of multiple rotation angles corresponding to the image data to be processed.

[0068] Specifically, combined Figure 2As shown, the terminal inputs the image data to be processed into the classification network. The classification network first uses the feature extraction network to extract the initial classification vector corresponding to each rotation angle, such as the initial classification vector of 2048 dimensions, and then obtains the feature vector corresponding to each rotation angle through dimensionality reduction processing, such as reducing the dimension to 512 dimensions, wherein the initial classification vector corresponding to each rotation angle needs to be input into the multi-network head for dimensionality reduction processing, for example, first according to the preset grouping rules, split to obtain multiple split vectors, such as splitting into multiple split vectors according to the number of rotation angles, for example, splitting into multiple split vectors equal to the number of rotation angles, for example, the initial classification vector is divided into dimensions according to the number of rotation angles, such as splitting into 4 512-dimensional vectors, and then respectively pass through the corresponding fully connected layers to obtain the reduced dimension vectors, such as 4 128-dimensional vectors, and then respectively pass through the normalization layer to obtain the corresponding normalized vectors, such as 4 128-dimensional vectors, and finally pass the obtained normalized vectors through the connection layer, such as cat, to merge into a feature vector, that is, a 512-dimensional feature vector.

[0069] In practical applications, the image data to be processed is (a, b, c, d), where a represents the number of rotation angles, and b represents the number of channels. For example, the image to be processed at each rotation angle is represented by three RGB channels, and c and d represent the resolution of the image to be processed. Assuming that there are 4 rotation angles, such as 0, 90, 180, and 270 degrees, each image to be processed can be represented by (4, 3, c, d), and then input into the classification network to obtain an initial classification vector of (4, 2048), where 4 represents the number of rotation angles, and 2048 is the dimension before dimensionality reduction mentioned above. The initial classification vector is then subjected to dimensionality reduction processing to obtain a feature vector corresponding to each rotation angle, that is, (4, 512), where 512 represents the dimension after dimensionality reduction. The dimensionality reduction processing first splits each initial classification vector obtained, such as into 4 512-dimensional vectors, and then passes through the corresponding fully connected layers to obtain the reduced-dimensional vectors, such as 4 128-dimensional vectors. Finally, the obtained standardized vectors are passed through a connection layer, such as cat, to be merged into a feature vector, that is, a 512-dimensional feature vector.

[0070] Optionally, the initial classification vector is subjected to dimensionality reduction processing to obtain a feature vector corresponding to each rotation angle, including: the initial classification vector is sequentially input into a fully connected layer and a normalization layer to perform dimensionality reduction processing on the initial classification vector to obtain a feature vector corresponding to each rotation angle.

[0071] Specifically, combined Figure 2As shown, the terminal inputs the initial classification vector into a fully connected layer to obtain a dimension of 512, that is, a reduced dimension vector after dimensionality reduction, and then inputs the reduced dimension vector into a normalized layer to obtain a feature vector. It should be noted that for each rotation angle, the corresponding feature vector is obtained through the above classification network, so that after obtaining the feature vector, the feature vectors are merged to obtain a comprehensive feature vector, and classification processing is performed based on the comprehensive feature vector to obtain the classification label corresponding to the image data to be processed.

[0072] In the above embodiment, features are first extracted through a feature extraction network and then subjected to dimensionality reduction processing, thereby ensuring that the dimension of the subsequent comprehensive feature vector is not too high, thereby ensuring the improvement of the efficiency of the subsequent classification process.

[0073] In one of the embodiments, before inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, it also includes: splitting the image data to be processed to obtain image data to be processed at multiple rotation angles; and merging the image data to be processed at multiple rotation angles under the batch size dimension.

[0074] Specifically, the image data to be processed can be obtained from a database, in which multiple rotation angles are merged together, such as (n, m, c, d), where m is the number of channels, and n is the number of images to be processed, that is, the batch size dimension. For example, if the number of rotation angles is a, then m=a*3, for example, when a=4, then m is 12, that is, 0-12, and every 3 channels represent a rotation angle.

[0075] Therefore, during processing, the terminal first splits the image data to be processed to obtain image data to be processed at multiple rotation angles. For example, the image data to be processed is split according to the channel dimension to obtain image data to be processed at multiple rotation angles, that is, the image data to be processed is split to obtain a sub-data with a size of (n, m / 3, c, d), and then the image data to be processed at multiple rotation angles are merged under the batch size dimension, that is, (a*n, m / 3, c, d).

[0076] In the above embodiment, before the image data to be processed is input into the classification network, the image data to be processed is first processed to obtain the image data to be processed at multiple rotation angles, which lays a foundation for subsequent processing.

[0077] In one embodiment, see Figure 3 As shown, Figure 3 is a flowchart of a training process of a classification network in one embodiment, Figure 4 for Figure 3The schematic diagram of an iterative process in the training process of the classification network in the illustrated embodiment. In this embodiment, the training method of the classification network obtained by pre-training includes:

[0078] S302: Obtain sample image data, where the sample image data includes sample image data at multiple rotation angles and corresponding sample labels.

[0079] Specifically, the sample image data is collected in advance, wherein the sample image data includes sample image data at multiple rotation angles, such as 0, 90, 180, 270 degrees, etc. mentioned above. The sample label refers to the category to which the sample belongs. In practical applications, the sample image data can be represented by (BS, m, c, d), where BS represents the size of the batch input to the network each time, and can also be simply understood as the number of sample images involved, which is a set hyperparameter. m represents the number of channels of the sample image data, ranging from 0-3x, that is, every 3 channels represent a rotation angle. c and d represent the resolution of the sample image. Based on this data structure, before proceeding forward, the terminal splits the sample image data into 4 sub-data of size (BS, 3, c, d), each sub-data representing a rotation angle of the same batch of images. Then, the terminal merges the 4 sub-data in the first dimension to obtain data of size (4*BS, 3, c, d).

[0080] S304: Input the sample image data into the initial classification network to extract feature vectors of multiple rotation angles corresponding to the sample image data.

[0081] Specifically, the structure of the initial classification network can be found in Figure 2 As shown, the terminal inputs the sample image data into the initial classification network, so as to extract feature vectors of multiple rotation angles corresponding to the sample image data. For example, the above-mentioned (4*BS, 3, c, d) data is input into the initial classification network to obtain a feature vector output of (4*BS, 512).

[0082] S306: Extracting preset dimensions from feature vectors of multiple rotation angles corresponding to the sample image data respectively according to preset rules.

[0083] Specifically, the preset rule refers to the extraction rule of the preset dimension of the feature vector in each rotation angle. For example, if the feature vector represents the feature vector corresponding to the image to be processed with a rotation angle of X degrees, the preset dimension of the feature vector is obtained. For example, if there are n rotation angles, and X degrees is arranged at the mth, then the preset dimension can be the dimension of the feature vector / n*(m-1)~the dimension of the feature vector / n*m. For example, assuming that the rotation angle is 0 degree, there are 4 rotation angles, 0 degree is the first one, and the dimension of the feature vector is 512 dimensions, then the preset dimension in the feature vector of the rotation angle is 512 / 4*0~512 / 4*1, that is, 0~128 dimensions.

[0084] The terminal can pre-initialize the rotation angle corresponding to the feature vector output by the classification network, and then extract the preset dimension corresponding to the rotation angle. For example, the initial classification network outputs a feature vector of (4*BS,512), where 4 represents 4 rotation angles. The rotation angle of the output feature vector can be determined based on this, and then the corresponding preset dimension can be obtained according to the preset rules. For example, 0-128 represents a 0-degree feature, 128-256 represents a 90-degree feature, 256-384 represents a 180-degree feature, and 384-512 represents a 270-degree feature.

[0085] S308: Calculate the angle loss function corresponding to each rotation angle according to preset dimensions in the feature vectors of multiple rotation angles corresponding to the sample label and the sample image data.

[0086] S310: Calculate a comprehensive loss function based on the angle loss function.

[0087] S312: Perform gradient backpropagation through the comprehensive loss function to train the initial classification network until the change of the comprehensive loss function is less than a preset value, and the initial classification network training is completed.

[0088] Specifically, when calculating the loss function, the terminal first splits the obtained feature vector into feature vectors of the number corresponding to the number of rotation angles according to the above-mentioned merging method, for example, into 4 sub-feature vectors of size (BS, 512), and the preset dimension of each sub-feature vector represents the feature vector extracted by the classification network from the same batch of pictures at one angle. The terminal puts them into MS-loss to calculate the loss respectively, and obtains four angle loss functions (l1, l2, l3, l4). The comprehensive loss function is calculated using the four angle loss functions, and back-propagation is performed to complete the one-step update of the classification network training.

[0089] Specifically, see Figure 5 As shown, assuming BS = 2 and the output dimension is 8, the corresponding 4*BS vector is as follows Figure 5As shown in the figure, that is, the structure of the feature vector output by the multi-network head, each part only takes the output of the corresponding preset dimension to calculate the angle loss function, for example, 0-128 dimensions are taken to calculate the angle loss function corresponding to the 0-degree feature, 128-256 dimensions are taken to calculate the angle loss function corresponding to the 90-degree feature, 256-384 dimensions are taken to calculate the angle loss function corresponding to the 180-degree feature, and 384-512 dimensions are taken to calculate the angle loss function corresponding to the 270-degree feature.

[0090] Optionally, a comprehensive loss function is calculated based on the angle loss function, including: calculating an average value corresponding to the angle loss function as the comprehensive loss function.

[0091] The terminal repeats the above steps until the classification network converges, and the classification network training is completed. The condition for the convergence of the classification network may be that the change of the comprehensive loss function is less than a preset value.

[0092] Among them, after the classification network is trained, the terminal can also test the classification network, for example, setting a control group model, which uses the same hyperparameters as the classification network, that is, the batch size is the same as the batch size during training, and the training data used is unrotated, which can also be considered as a data set with a rotation angle of 0 degrees. Then, the control group model is used to test its recall rate performance under the above-mentioned different rotation angles.

[0093] In addition, when testing the classification network, the terminal also tests the recall rate at different rotation angles, and merges the feature vectors extracted by the network at different rotation angles to obtain a vector (BS, 2048), and calculates the recall rate based on the merged vector. The control group model also merges the feature vectors at different rotation angles and tests to obtain the recall rate.

[0094] According to the test, the recall rate of the classification network corresponding to the rotation angle and the merged vector and the recall rate of the control group model are determined. If the recall rate of the classification network is greater than the recall rate of the control group model, it means that the training is successful.

[0095] In one embodiment, see Figure 6 As shown, Figure 6 FIG. 1 is a flowchart of a method for classifying pictures in an embodiment. In this embodiment, the method for classifying pictures may include:

[0096] S602: Generate a comprehensive classification vector by using the classification vector generation method in any of the above embodiments.

[0097] Specifically, the terminal may first obtain the image data to be processed, and then generate a comprehensive classification vector through the above classification vector generation method. For details, please refer to the above and will not be repeated here.

[0098] S604: Match the comprehensive classification vector with the standard vector in the database.

[0099] Specifically, the database stores standard vectors, that is, the database stores various classification labels, and provides standard vectors corresponding to the classification labels, so that the terminal matches the comprehensive classification vector with the standard vector, for example, calculates the distance between the comprehensive classification vector and each standard vector.

[0100] S606: When the comprehensive classification vector successfully matches the standard vector in the database, the classification label corresponding to the successfully matched standard vector is obtained as the classification label of the image data to be processed.

[0101] Specifically, the terminal matches the comprehensive classification vector with the standard vector, for example, the standard vector with the smallest distance to the comprehensive classification vector can be obtained as the successfully matched standard vector, and then the classification label corresponding to the successfully matched standard vector is used as the classification label of the image data to be processed.

[0102] In the above embodiment, feature vectors of multiple rotation angles corresponding to the image data to be processed are obtained through a classification network, and the feature vectors of the multiple rotation angles are merged to obtain a comprehensive classification vector. The image data to be processed is classified by the comprehensive feature vector to obtain a classification label, which can improve the classification accuracy.

[0103] It should be understood that although Figure 1 , Figure 3 and Figure 6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 , Figure 3 and Figure 6 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0104] In one embodiment, Figure 7 As shown, a classification vector generation device is provided, comprising: a data acquisition module 100, a multi-angle feature generation module 200, a preset dimension extraction module 300 and a classification vector generation module 400, wherein:

[0105] The data acquisition module 100 is used to acquire the image data to be processed, wherein the image data to be processed includes the image data to be processed at multiple rotation angles;

[0106] The multi-angle feature generation module 200 is used to input the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed;

[0107] A preset dimension extraction module 300 is used to extract preset dimensions from feature vectors of multiple rotation angles according to preset rules;

[0108] The classification vector generation module 400 is used to merge the preset dimensions of the extracted feature vectors of multiple rotation angles to obtain a comprehensive classification vector, and the comprehensive classification vector is used to classify the image data to be processed to obtain a corresponding classification label.

[0109] In one embodiment, the multi-angle feature generation module 200 may include:

[0110] An extraction unit, used to extract an initial classification vector corresponding to the image data to be processed at each rotation angle;

[0111] A grouping unit, used for splitting the initial classification vector into a plurality of grouping vectors corresponding to the number of rotation angles according to a preset grouping rule;

[0112] A dimension reduction unit, used for performing dimension reduction processing on the grouped vector;

[0113] The output unit is used to reversely merge the grouping vectors after the dimensionality reduction process according to the preset grouping rules to obtain feature vectors of multiple rotation angles corresponding to the image data to be processed.

[0114] In one of the embodiments, the dimension reduction unit is further used to input the grouping vector into a fully connected layer and a normalization layer in sequence to perform dimension reduction processing on the grouping vector.

[0115] In one embodiment, the classification vector generating device may further include:

[0116] A splitting module, used for splitting the image data to be processed to obtain the image data to be processed at multiple rotation angles;

[0117] The merging module is used to merge the image data to be processed at multiple rotation angles in the batch size dimension.

[0118] In one of the embodiments, the splitting module is further used to split the image data to be processed according to the channel dimension to obtain the image data to be processed at multiple rotation angles.

[0119] In one embodiment, the multi-angle feature generation module 200 may include:

[0120] The sample image data acquisition module 100 is used to acquire sample image data, where the sample image data includes sample image data at multiple rotation angles and corresponding sample labels;

[0121] An input module, used to input sample image data into an initial classification network to extract feature vectors of multiple rotation angles corresponding to the sample image data;

[0122] A training extraction module is used to extract preset dimensions from feature vectors of multiple rotation angles corresponding to sample image data according to preset rules;

[0123] An angle loss function calculation module, used to calculate the angle loss function corresponding to each rotation angle according to the preset dimensions in the feature vectors of multiple rotation angles corresponding to the sample label and the sample image data;

[0124] A comprehensive loss function calculation module is used to calculate a comprehensive loss function based on the angle loss function;

[0125] The training module is used to perform gradient backpropagation through the comprehensive loss function to train the initial classification network until the change of the comprehensive loss function is less than the preset value, and the initial classification network training is completed.

[0126] In one of the embodiments, the above-mentioned comprehensive loss function calculation module is also used to calculate the average value corresponding to the angle loss function as the comprehensive loss function.

[0127] In one embodiment, Figure 8 As shown, a picture classification device is provided, including: a comprehensive classification vector generation module 500, a matching module 600 and a classification label acquisition module 700, wherein:

[0128] A comprehensive classification vector generation module 500, configured to generate a comprehensive classification vector by using the classification vector generation method in any of the above embodiments;

[0129] A matching module 600, for matching the comprehensive classification vector with a standard vector in a database;

[0130] The classification label acquisition module 700 is used to obtain the classification label corresponding to the successfully matched standard vector as the classification label of the image data to be processed when the comprehensive classification vector successfully matches the standard vector in the database.

[0131] For the specific definition of the classification vector generating device, please refer to the definition of the classification vector generating method above, which will not be repeated here. Each module in the above classification vector generating device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0132] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a classification vector generation method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0133] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0134] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining image data to be processed, wherein the image data to be processed includes image data to be processed at multiple rotation angles; inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed; extracting preset dimensions from the feature vectors of the multiple rotation angles according to preset rules; merging the preset dimensions of the extracted feature vectors of the multiple rotation angles to obtain a comprehensive classification vector, wherein the comprehensive classification vector is used to classify the image data to be processed to obtain corresponding classification labels.

[0135] In one embodiment, when a processor executes a computer program, the process involves inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, including: extracting an initial classification vector corresponding to the image data to be processed at each rotation angle; according to a preset grouping rule, splitting the initial classification vector into multiple grouping vectors corresponding to the number of rotation angles; performing dimensionality reduction processing on the grouping vectors; according to the preset grouping rule, reversely merging the grouping vectors after the dimensionality reduction processing to obtain feature vectors of multiple rotation angles corresponding to the image data to be processed.

[0136] In one embodiment, the dimensionality reduction processing of the grouping vector involved in the execution of the computer program by the processor includes: inputting the grouping vector into a fully connected layer and a normalization layer in sequence to perform dimensionality reduction processing on the grouping vector.

[0137] In one embodiment, the processor executes a computer program that involves inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, and also includes: splitting the image data to be processed to obtain image data to be processed at multiple rotation angles; and merging the image data to be processed at multiple rotation angles in a batch size dimension.

[0138] In one embodiment, when a processor executes a computer program, splitting the image data to be processed to obtain the image data to be processed at multiple rotation angles includes: splitting the image data to be processed according to a channel dimension to obtain the image data to be processed at multiple rotation angles.

[0139] In one embodiment, the training method of the pre-trained classification network involved in the execution of a computer program by a processor includes: obtaining sample image data, the sample image data including sample image data at multiple rotation angles and corresponding sample labels; inputting the sample image data into the initial classification network to extract feature vectors of multiple rotation angles corresponding to the sample image data; extracting preset dimensions in the feature vectors of multiple rotation angles corresponding to the sample image data according to preset rules; calculating the angle loss function corresponding to each rotation angle according to the preset dimensions in the feature vectors of multiple rotation angles corresponding to the sample labels and the sample image data; calculating a comprehensive loss function based on the angle loss function; and performing gradient backpropagation through the comprehensive loss function to train the initial classification network until the change in the comprehensive loss function is less than a preset value, and the initial classification network training is completed.

[0140] In one embodiment, the processor executes a computer program and obtains a comprehensive loss function based on the angle loss function, including: calculating an average value corresponding to the angle loss function as the comprehensive loss function.

[0141] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: generating a comprehensive classification vector by the classification vector generation method in any of the above embodiments; matching the comprehensive classification vector with a standard vector in a database; when the comprehensive classification vector successfully matches the standard vector in the database, obtaining a classification label corresponding to the successfully matched standard vector as a classification label for image data to be processed.

[0142] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining image data to be processed, the image data to be processed including image data to be processed at multiple rotation angles; inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed; extracting preset dimensions from the feature vectors of the multiple rotation angles according to preset rules; merging the preset dimensions of the extracted feature vectors of the multiple rotation angles to obtain a comprehensive classification vector, which is used to classify the image data to be processed to obtain corresponding classification labels.

[0143] In one embodiment, when a computer program is executed by a processor, the process involves inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, including: extracting an initial classification vector corresponding to the image data to be processed at each rotation angle; according to a preset grouping rule, splitting the initial classification vector into multiple grouping vectors corresponding to the number of rotation angles; performing dimensionality reduction processing on the grouping vectors; according to the preset grouping rule, reversely merging the grouping vectors after the dimensionality reduction processing to obtain feature vectors of multiple rotation angles corresponding to the image data to be processed.

[0144] In one embodiment, the dimensionality reduction processing of the grouping vector involved in the execution of the computer program by the processor includes: inputting the grouping vector into a fully connected layer and a normalization layer in sequence to perform dimensionality reduction processing on the grouping vector.

[0145] In one embodiment, the computer program executed by the processor involves inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, and also includes: splitting the image data to be processed to obtain image data at multiple rotation angles; merging the image data to be processed at multiple rotation angles under the batch size dimension.

[0146] In one embodiment, when a computer program is executed by a processor, splitting the image data to be processed to obtain image data to be processed at multiple rotation angles includes: splitting the image data to be processed according to a channel dimension to obtain image data to be processed at multiple rotation angles.

[0147] In one embodiment, the training method of the pre-trained classification network involved in the execution of the computer program by the processor includes: obtaining sample image data, the sample image data including sample image data at multiple rotation angles and corresponding sample labels; inputting the sample image data into the initial classification network to extract feature vectors of multiple rotation angles corresponding to the sample image data; extracting preset dimensions in the feature vectors of multiple rotation angles corresponding to the sample image data according to preset rules; calculating the angle loss function corresponding to each rotation angle according to the preset dimensions in the feature vectors of multiple rotation angles corresponding to the sample labels and the sample image data; calculating the comprehensive loss function according to the angle loss function; performing gradient backpropagation through the comprehensive loss function to train the initial classification network until the change in the comprehensive loss function is less than the preset value, and the initial classification network training is completed.

[0148] In one embodiment, when the computer program is executed by a processor, the method of calculating a comprehensive loss function based on the angle loss function includes: calculating an average value corresponding to the angle loss function as the comprehensive loss function.

[0149] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: generating a comprehensive classification vector by the classification vector generation method in any of the above embodiments; matching the comprehensive classification vector with a standard vector in a database; when the comprehensive classification vector successfully matches the standard vector in the database, obtaining a classification label corresponding to the successfully matched standard vector as a classification label for the image data to be processed.

[0150] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0151] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0152] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A classification vector generation method, characterized in that: The method comprises: Acquire image data to be processed, wherein the image data to be processed includes image data to be processed at multiple rotation angles; Inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed; Extracting preset dimensions from the feature vectors of the multiple rotation angles respectively according to preset rules, wherein the preset dimensions are the dimension of the feature vector / n*(m-1) to the dimension of the feature vector / n*m, where n represents the number of rotation angles and m represents the order in which the rotation angles are arranged; Combining the preset dimensions of the feature vectors of the extracted multiple rotation angles to obtain a comprehensive classification vector, wherein the comprehensive classification vector is used to classify the image data to be processed to obtain a corresponding classification label; The step of inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed includes: Using a feature extraction network to extract an initial classification vector corresponding to the image data to be processed at each rotation angle; According to a preset grouping rule, the initial classification vector is split into a plurality of grouping vectors corresponding to the number of rotation angles; The grouped vectors are respectively subjected to dimensionality reduction processing by corresponding fully connected layers, and then respectively subjected to normalization layers to obtain corresponding normalized vectors; According to the preset grouping rule, the obtained standardized vectors are reversely merged through a connection layer to obtain feature vectors of multiple rotation angles corresponding to the image data to be processed.

2. The method according to claim 1, characterized in that The performing dimensionality reduction processing on the grouping vector includes: The grouping vector is sequentially input into a fully connected layer and a normalized layer to perform dimensionality reduction processing on the grouping vector.

3. The method according to claim 1 or 2, characterized in that: Before inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed, the method further includes: Splitting the image data to be processed to obtain image data to be processed at multiple rotation angles; Merge the image data to be processed at multiple rotation angles in the batch size dimension.

4. The method according to claim 3, characterized in that The step of splitting the image data to be processed to obtain image data to be processed at multiple rotation angles includes: The image data to be processed is split according to the channel dimension to obtain image data to be processed at multiple rotation angles.

5. The method according to claim 1 or 2, characterized in that: The training method of the pre-trained classification network includes: Acquire sample image data, wherein the sample image data includes sample image data at multiple rotation angles and corresponding sample labels; Inputting the sample image data into an initial classification network to extract feature vectors of multiple rotation angles corresponding to the sample image data; Extracting preset dimensions from feature vectors of multiple rotation angles corresponding to the sample image data respectively according to preset rules; According to the preset dimensions in the feature vectors of the multiple rotation angles corresponding to the sample label and the sample image data, respectively calculate the angle loss function corresponding to each rotation angle; A comprehensive loss function is calculated according to the angle loss function; The initial classification network is trained by performing gradient backpropagation through the comprehensive loss function until the change of the comprehensive loss function is less than a preset value, and the training of the initial classification network is completed.

6. The method according to claim 5, characterized in that The calculating of the comprehensive loss function according to the angle loss function includes: The average value corresponding to the angle loss function is calculated as the comprehensive loss function.

7. A method for classifying images, characterized in that: The method comprises: Generate a comprehensive classification vector by the classification vector generation method according to any one of claims 1 to 6; Matching the comprehensive classification vector with a standard vector in a database; When the comprehensive classification vector successfully matches the standard vector in the database, the classification label corresponding to the successfully matched standard vector is obtained as the classification label of the image data to be processed.

8. A classification vector generating device, characterized in that: The device comprises: A data acquisition module, used to acquire image data to be processed, wherein the image data to be processed includes image data to be processed at multiple rotation angles; A multi-angle feature generation module, used for inputting the image data to be processed into a pre-trained classification network to extract feature vectors of multiple rotation angles corresponding to the image data to be processed; A preset dimension extraction module, used to extract preset dimensions from the feature vectors of the multiple rotation angles according to preset rules, wherein the preset dimensions are the dimension of the feature vector / n*(m-1) to the dimension of the feature vector / n*m, where n represents the number of rotation angles and m represents the order in which the rotation angles are arranged; A classification vector generation module, used for merging the preset dimensions of the feature vectors of the extracted multiple rotation angles to obtain a comprehensive classification vector, wherein the comprehensive classification vector is used for classifying the image data to be processed to obtain a corresponding classification label; Wherein, the multi-angle feature generation module includes: An extraction unit, used for extracting an initial classification vector corresponding to the image data to be processed at each rotation angle by using a feature extraction network; A grouping unit, configured to split the initial classification vector into a plurality of grouping vectors corresponding to the number of rotation angles according to a preset grouping rule; A dimension reduction unit, used to perform dimension reduction processing on the grouped vectors through corresponding fully connected layers, and then obtain corresponding standardized vectors through standardization layers; The output unit is used to reversely merge the obtained standardized vectors through a connection layer according to the preset grouping rule to obtain feature vectors of multiple rotation angles corresponding to the image data to be processed.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 or 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 or 7 are implemented.

Citation Information

Patent Citations

  • Image rotating angle detection method and device

    CN103729649A

  • SAR target identification method based on angle rotation generation network

    CN110245711A

  • Material classification

    US20150219557A1