Ship image classification method based on multi-dimensional feature embedding

By introducing multi-dimensional feature embedding technology into the ship image classification method, the image features are expanded to four-dimensional, and the problem of insufficient three-dimensional features in the existing technology is solved, which significantly improves the accuracy of ship image classification.

CN118196619BActive Publication Date: 2025-02-18NAVAL AVIATION UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410272375.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-11
Publication Date
2025-02-18
Estimated Expiration
2044-03-11

AI Technical Summary

Technical Problem

In the prior art, ship image classification methods only focus on three-dimensional features, and it is difficult to obtain features at higher latitudes, thereby affecting the accuracy of classification.

Method used

A ship image classification method based on multi-dimensional feature embedding is proposed. Through multi-dimensional feature extraction branches and Transformer network branches, the image features are expanded to four-dimensional and the richness of feature representation is improved.

Benefits of technology

By increasing the dimension of ship images, richer image representation can be obtained, thereby significantly improving the accuracy of ship image classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118196619B_ABST
    Figure CN118196619B_ABST
Patent Text Reader

Abstract

The present invention discloses a ship image classification method based on multi-dimensional feature embedding, which belongs to the field of data recognition. The present invention uses a classification model based on multi-dimensional feature embedding to classify ship images; the classification model includes a multi-dimensional feature extraction branch, a Transformer network branch and a classification output module; the multi-dimensional feature extraction branch is used to extract the multi-dimensional features of the input image, and the multi-dimensional features are used to be embedded in several series-connected Transformer encoders in the Transformer network branch; the classification output module outputs the classification result according to the result of the Transformer network branch. Based on the three-dimensional features of width, height and channel, the present invention expands the image features to four dimensions, and obtains a richer image representation by increasing the dimension of the ship image, thereby improving the accuracy of ship image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of data recognition, and in particular relates to a ship image classification method. Background Art

[0002] Ships are maritime transport carriers and important military targets. Automatic identification of ships is of great significance in both military and civilian fields. In the military, by monitoring the distribution of ships in key sea areas, we can assess the enemy's combat strength, form combat intelligence, and conduct effective and precise strikes. In the civil field, ship detection can assist in maritime traffic supervision, maritime search and rescue, combating illegal fishing and anti-smuggling. Therefore, it is of great practical significance to improve the accuracy and efficiency of automatic interpretation of remote sensing image data and accurately, robustly and quickly detect and locate the target area of ​​ships on the sea surface.

[0003] The existing ship image classification solutions are all based on deep learning methods, with ResNet and VIT (Vision Transformer) as representative model methods with significant effects. However, such methods only focus on the three-dimensional features of the image from the perspective of width, height, and channel, and limit the image features to three dimensions, making it difficult to obtain features of higher dimensions, thus affecting the accuracy of ship image classification. Summary of the invention

[0004] The present invention proposes a ship image classification method based on multi-dimensional feature embedding, the purpose of which is to improve the accuracy of ship image classification.

[0005] The technical solution of the present invention is as follows:

[0006] A ship image classification method based on multi-dimensional feature embedding, using a classification model based on multi-dimensional feature embedding to classify ship images;

[0007] The classification model includes a multidimensional feature extraction branch, a Transformer network branch and a classification output module; the multidimensional feature extraction branch is used to extract the multidimensional features of the input image, and the multidimensional features are used to be embedded in a plurality of serially connected Transformer encoders in the Transformer network branch; the classification output module outputs the classification result according to the result of the Transformer network branch.

[0008] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the multi-dimensional feature extraction branch includes a dimension expansion module, a multi-dimensional feature extraction module and a multi-dimensional feature convolution layer.

[0009] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the input image of the classification model is assumed to be , H Indicates the image height,W Indicates the image width, C Indicates the number of image channels;

[0010] The specific processing of the multidimensional feature extraction branch includes:

[0011] Step A1: The dimension expansion module takes the input image X Perform convolution and dimensional expansion operations to generate two features A 1 , A 2 :

[0012] ;

[0013] in, represents the convolution operation, represents the dimension-raising operation, ;

[0014] Step A2: Multidimensional feature extraction module extracts features A 1 , A 2 Obtaining initial multidimensional features A , and then the initial multidimensional features A Pooling operations are performed along the height, width, and channel dimensions to obtain features A H , A W , A C , then for the features A H , A W , A C Perform addition operation to obtain features A' ;

[0015] Step A3: The multi-dimensional feature convolution layer is used to transform the features A' Perform convolution operation to obtain the output result of the multidimensional feature extraction branch, that is, the multidimensional feature A t :

[0016] ;

[0017] in, represents the convolution operation, .

[0018] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the specific process of step A2 is as follows:

[0019] Step A2-1: Set the featureA 1 , A 2 Splicing is performed along the first dimension, and then the spliced ​​features are processed using 3D convolution and activation functions to obtain the initial multidimensional features A :

[0020] ;

[0021] ;

[0022] in, Represents the splicing operation, features Represents the features after splicing, represents the activation function, represents a 3D convolution operation, ;

[0023] Step A2-2: Set the feature A Average pooling and global pooling operations are performed along the height dimension respectively, and then the two pooled features are spliced ​​along the height dimension, and then the Permute operation is used to adjust the dimension, and then the feature extraction is performed through the 3D convolution operation to obtain the feature A H :

[0024] ;

[0025] in, represents an average pooling operation along the height dimension, The table performs the maximum pooling operation along the height dimension. Represents the splicing operation along the height dimension, Represents a dimension adjustment operation, represents a 3D convolution operation, , , ;

[0026] Step A2-3: A Average pooling and global pooling operations are performed along the width dimension respectively, and then the two pooled features are spliced ​​along the width dimension, and then the Permute operation is used to adjust the dimension, and then the feature extraction is performed through the 3D convolution operation to obtain the feature A W :

[0027] ;

[0028] in, represents an average pooling operation along the width dimension, Represents the maximum pooling operation along the width dimension, Represents a splicing operation along the width dimension, Represents a dimension adjustment operation, represents a 3D convolution operation, ;

[0029] Step A2-4: Set the feature A Average pooling and global pooling operations are performed along the channel dimension respectively, and then the two pooled features are spliced ​​along the channel dimension, and then the dimension is adjusted by Permute operation, and then the feature extraction is performed through 3D convolution operation to obtain the feature A C :

[0030] ;

[0031] in, represents the average pooling operation along the channel dimension, Represents the maximum pooling operation along the channel dimension, represents the splicing operation along the channel dimension, Represents a dimension adjustment operation, represents a 3D convolution operation, ;

[0032] Step A2-5: Features A H , A W , A C Perform addition operation to obtain features A' :

[0033] .

[0034] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the Transformer network branch includes an image block embedding module, a feature sequence generation module and a Transformer feature extractor.

[0035] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the specific processing process of the Transformer network branch is as follows:

[0036] Step B1: The image block embedding module takes the input image X Embedding is performed to obtain features B' , the image block embedding module consists of a convolution layer and an activation function, and the embedding process is as follows:

[0037] ;

[0038] in, represents the activation function, represents the convolution operation, ;

[0039] Step B2: The feature sequence generation module generates a learnable classification tag With features B' Splice and get features B 0 :

[0040] ;

[0041] in, Represents a splicing operation, ;

[0042] Step B3: Transformer feature extractor includes L A series of Transformer encoders, which extract the multidimensional features output by the multidimensional feature extraction branch A t Embedded into the processing process, so as to output results with multi-dimensional features B L .

[0043] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the specific process of step B3 is as follows:

[0044] For Transformer encoders, , whose input is the feature B l , , the output is the feature , ;when hour, , Represents a splicing operation; B 0 Is the input of the first Transformer encoder;

[0045] Each Transformer encoder sets three learnable parameter matrices: For the Transformer encoder, whose output features The way to obtain is:

[0046] The parameter matrix W Q ,W K,W V Distinction and characteristics B l The normalized results are multiplied to obtain three feature matrices :

[0047] ;

[0048] in, represents the normalization operation;

[0049] Set up three more learnable positional encodings , using the broadcast mechanism to encode the position P h and P w Add and position code P l Splice to get features P ,The above process can be expressed by the following formula:

[0050] ;

[0051] in, Represents a splicing operation, ;

[0052] Then, the feature is calculated by the following formula :

[0053] ;

[0054] in, represents the activation function, , represents the normalization operation, represents a multi-layer perceptron, ;

[0055] The output of the Transformer feature extractor is: , .

[0056] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the processing process of the classification output module is as follows:

[0057] Step C: Output features of the Transformer network branch B L After normalization, the classification marks are extracted cls , and then mark the classification cls Perform linear transformation to obtain the classification result:

[0058] ;

[0059] in, represents the activation function, Represents a linear transformation; vector The category represented by the item with the largest median value is the predicted category of the model.

[0060] As a further improvement of the ship image classification method based on multi-dimensional feature embedding, the classification model is trained in the following manner:

[0061] Step T1: Obtain ship images with image labels to form a sample data set. Each image and its corresponding category are recorded as ,in, Indicates i Ship images, Y i Represents a ship image X i The corresponding true label is the true category, , Z Indicates the number of ship images;

[0062] Step T2: Input the images in the sample data set into the local global multi-head attention classification model to obtain the corresponding classification results; X i The corresponding classification results are recorded as ;

[0063] Step T3: Calculate the cross entropy loss between the classification result and the true label:

[0064] ;

[0065] Step T4: adjust the parameters of the local-global multi-head attention classification model according to the cross entropy loss;

[0066] Step T5: Repeat steps T1 to T4 until the cross entropy loss is less than a preset value or the number of repetitions reaches a preset value.

[0067] Compared with the prior art, the present invention has the following beneficial effects:

[0068] Based on the three-dimensional features of width, height and channel, the present invention expands the image features to four dimensions, and obtains richer image representation by increasing the dimension of ship images, thereby improving the accuracy of ship image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 is a flow chart of the method of the present invention;

[0070] Figure 2 It is the flowchart of the multi-dimensional feature extraction module;

[0071] Figure 3 Flowchart of the Transformer encoder. DETAILED DESCRIPTION

[0072] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.

[0073] like Figure 1 As shown, this embodiment provides a ship image classification method based on multi-dimensional feature embedding, establishes a classification model based on multi-dimensional feature embedding, and uses the model to classify ship images.

[0074] The classification model includes a multidimensional feature extraction branch, a Transformer network branch and a classification output module. The multidimensional feature extraction branch is used to extract the multidimensional features of the input image, and the multidimensional features are used to be embedded in a plurality of series-connected Transformer encoders in the Transformer network branch, so that the Transformer network branch can output a result with multidimensional features, and the classification output module outputs a classification result according to the result of the Transformer network branch.

[0075] Suppose the input image of the classification model is , H Indicates the image height, W Indicates the image width, C Indicates the number of image channels.

[0076] The multidimensional feature extraction branch includes a dimension expansion module, a multidimensional feature extraction module and a multidimensional feature convolution layer. The specific processing process of the multidimensional feature extraction branch is as follows:

[0077] Step A1: The dimension expansion module takes the input image X Perform convolution and dimensional expansion operations to generate two features A 1 , A 2 :

[0078] ;

[0079] in, represents the convolution operation, represents the dimension-raising operation, .

[0080] Step A2: Multidimensional feature extraction module extracts features A 1 ,A 2 Obtaining initial multidimensional features A , and then the initial multidimensional features A Pooling operations are performed along the height, width, and channel dimensions to obtain features A H , A W , A C , then for the features A H , A W , A C Perform addition operation to obtain features A' .

[0081] like Figure 2 , specifically including:

[0082] Step A2-1: Set the feature A 1 , A 2 Splicing is performed along the first dimension, and then the spliced ​​features are processed using 3D convolution and activation functions to obtain the initial multidimensional features A :

[0083] ;

[0084] ;

[0085] in, Represents the splicing operation, features Represents the features after splicing, represents the activation function, represents a 3D convolution operation, .

[0086] Step A2-2: Set the feature A Average pooling and global pooling operations are performed along the height dimension respectively, and then the two pooled features are spliced ​​along the height dimension, and then the Permute operation is used to adjust the dimension, and then the feature extraction is performed through the 3D convolution operation to obtain the feature A H :

[0087] ;

[0088] in, represents an average pooling operation along the height dimension, Represents the maximum pooling operation along the height dimension, Represents the splicing operation along the height dimension, Represents a dimension adjustment operation, represents a 3D convolution operation, , , .

[0089] Step A2-3: A Average pooling and global pooling operations are performed along the width dimension respectively, and then the two pooled features are spliced ​​along the width dimension, and then the Permute operation is used to adjust the dimension, and then the feature extraction is performed through the 3D convolution operation to obtain the feature A W :

[0090] ;

[0091] in, represents an average pooling operation along the width dimension, Represents the maximum pooling operation along the width dimension, Represents a splicing operation along the width dimension, Represents a dimension adjustment operation, represents a 3D convolution operation, .

[0092] Step A2-4: Set the feature A Average pooling and global pooling operations are performed along the channel dimension respectively, and then the two pooled features are spliced ​​along the channel dimension, and then the dimension is adjusted by Permute operation, and then the feature extraction is performed through 3D convolution operation to obtain the feature A C :

[0093] ;

[0094] in, represents the average pooling operation along the channel dimension, Represents the maximum pooling operation along the channel dimension, represents the splicing operation along the channel dimension, Represents a dimension adjustment operation, represents a 3D convolution operation, .

[0095] Step A2-5: Features A H , A W , A C Perform addition operation to obtain features A' :

[0096] .

[0097] Step A3: The multi-dimensional feature convolution layer is used to transform the features A' Perform convolution operation to obtain the output result of the multidimensional feature extraction branch, that is, the multidimensional feature A t :

[0098] ;

[0099] in, represents the convolution operation, .

[0100] The Transformer network branch includes an image block embedding module, a feature sequence generation module and a Transformer feature extractor. The specific processing process of the Transformer network branch is as follows:

[0101] Step B1: The image block embedding module takes the input image X Embedding is performed to obtain features B' , the image block embedding module consists of a convolution layer and an activation function, and the embedding process is as follows:

[0102] ;

[0103] in, represents the activation function, represents the convolution operation, .

[0104] Step B2: The feature sequence generation module generates a learnable classification tag With features B' Splice and get features B 0 :

[0105] ;

[0106] in, Represents a splicing operation, .

[0107] Step B3: Transformer feature extractor includes L A series of Transformer encoders are connected, which embeds multi-dimensional features into the processing process, thereby outputting results with multi-dimensional features. The specific processing process is as follows:

[0108] For Transformer encoders, , whose input is the feature Bl , , the output is the feature , .

[0109] when hour, , Represents a splicing operation. B 0 is the input of the first Transformer encoder.

[0110] like Figure 3 , each Transformer encoder sets three learnable parameter matrices:

[0111] For the Transformer encoder, whose output features The way to obtain is:

[0112] The parameter matrix W Q ,W K ,W V Distinction and characteristics B l The normalized results are multiplied to obtain three feature matrices :

[0113] ;

[0114] in, Represents a normalization operation.

[0115] Set up three more learnable positional encodings , using the broadcast mechanism to encode the position P h and P w Add and position code P l Splice to get features P ,The above process can be expressed by the following formula:

[0116] ;

[0117] in, Represents a splicing operation, .

[0118] Then, the feature is calculated by the following formula :

[0119] ;

[0120] in, represents the activation function, , represents the normalization operation, represents a multi-layer perceptron, .

[0121] The output of the Transformer feature extractor is: , .

[0122] The processing process of the classification output module is:

[0123] Step C: Output features of the Transformer network branch B L After normalization, the classification marks are extracted , and then mark the classification cls Perform linear transformation to obtain the classification result:

[0124] ;

[0125] in, represents the activation function, Represents a linear transformation. Vector The category represented by the item with the largest median value is the predicted category of the model.

[0126] Furthermore, the classification model is trained in the following manner:

[0127] Step T1: Obtain ship images with image labels to form a sample data set. Each image and its corresponding category are recorded as ,in, Indicates i Ship images, Y i Represents a ship image X i The corresponding true label is the true category, , Z Indicates the number of ship images.

[0128] Step T2: Input the images in the sample data set into the local global multi-head attention classification model to obtain the corresponding classification results. X i The corresponding classification results are recorded as .

[0129] Step T3: Calculate the cross entropy loss between the classification result and the true label:

[0130] .

[0131] Step T4: Adjust the parameters of the local-global multi-head attention classification model according to the cross entropy loss.

[0132] Step T5: Repeat steps T1 to T4 until the cross entropy loss is less than a preset value or the number of repetitions reaches a preset value.

[0133] In this embodiment, the Adam optimizer is used to optimize and solve the loss function.

[0134] It is obvious to those skilled in the art that the embodiments of the present invention are not limited to the details of the above exemplary embodiments, and that the embodiments of the present invention can be implemented in other specific forms without departing from the spirit or basic features of the embodiments of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the embodiments of the present invention is limited by the attached claims rather than the above description, so it is intended to include all changes that fall within the meaning and scope of the equivalent elements of the claims in the embodiments of the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units, modules or devices stated in the system, device or terminal claims can also be implemented by the same unit, module or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0135] Finally, it should be noted that the above implementation modes are only used to illustrate the technical solutions of the embodiments of the present invention and are not intended to limit them. Although the embodiments of the present invention have been described in detail with reference to the above preferred implementation modes, those skilled in the art should understand that the technical solutions of the embodiments of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A ship image classification method based on multi-dimensional feature embedding, characterized by: Ship image classification using a classification model based on multi-dimensional feature embedding; The classification model includes a multidimensional feature extraction branch, a Transformer network branch and a classification output module; the multidimensional feature extraction branch is used to extract multidimensional features of the input image, and the multidimensional features are used to be embedded in a plurality of serially connected Transformer encoders in the Transformer network branch; The classification output module outputs the classification results according to the results of the Transformer network branch; The multidimensional feature extraction branch includes a dimension expansion module, a multidimensional feature extraction module and a multidimensional feature convolution layer; Let the input image of the classification model be X∈R H×W×C , H represents the image height, W represents the image width, and C represents the number of image channels; The specific processing of the multidimensional feature extraction branch includes: Step A1: The dimension expansion module performs convolution and dimension expansion operations on the input image X to generate two features A1 and A2: A1,A2=Expand(Conv(X)); Among them, Conv(·) represents the convolution operation, Expand(·) represents the dimension increase operation, A1,A2∈R 1×H×W×C ; Step A2: The multidimensional feature extraction module obtains the initial multidimensional feature A according to features A1 and A2, and then performs pooling operations on the initial multidimensional feature A along the height, width and channel dimensions to obtain feature A. H ,A W ,A C , then for feature A H ,A W ,A C Perform the addition operation to obtain the feature A′; the specific process of step A2 is: Step A2-1: Concatenate features A1 and A2 along the first dimension, and then process the concatenated features using 3D convolution and activation function to obtain the initial multidimensional feature A: A″=Concat(A1,A2); A=Sigmoid(Conv 3D (A′)); Among them, Concat(·) represents the concatenation operation, and the feature A″∈R 2×H×W×C represents the concatenated features, Sigmoid(·) represents the activation function, Conv 3D (·) represents a 3D convolution operation, A∈R T×H×W×C ; Step A2-2: Perform average pooling and global pooling operations on feature A along the height dimension, then concatenate the two pooled features along the height dimension, use the Permute operation to adjust the dimension, and then perform feature extraction through the 3D convolution operation to obtain feature A. H : Among them, Avgpool H (·) represents the average pooling operation along the height dimension, Maxpool H (·) represents the maximum pooling operation along the height dimension, Concat H (·) represents concatenation along the height dimension, Permute(·) represents dimension adjustment, Conv 3D (·) represents a 3D convolution operation, A H ∈R 1 ×H×W×C ; Step A2-3: Perform average pooling and global pooling operations on feature A along the width dimension, then concatenate the two pooled features along the width dimension, use the Permute operation to adjust the dimension, and then perform feature extraction through the 3D convolution operation to obtain feature A. W : Among them, Avgpool W (·) represents the average pooling operation along the width dimension, Maxpool W (·) represents the maximum pooling operation along the width dimension, Concat W (·) represents concatenation along the width dimension, Permute(·) represents dimension adjustment, Conv 3D (·) represents a 3D convolution operation, A W ∈R 1 ×H×W×C ; Step A2-4: Perform average pooling and global pooling operations on feature A along the channel dimension, then concatenate the two pooled features along the channel dimension, use the Permute operation to adjust the dimension, and then perform feature extraction through 3D convolution operation to obtain feature A. C : Among them, Avgpool C (·) represents the average pooling operation along the channel dimension, Maxpool C (·) represents the maximum pooling operation along the channel dimension, Concat C (·) represents concatenation along the channel dimension, Permute(·) represents dimension adjustment, Conv 3D (·) represents a 3D convolution operation, A C ∈R 1 ×H×W×C ; Step A2-5: For feature A H ,A W ,A C Perform the addition operation to obtain the feature A′: A ′ =A H +A W +A C ; Step A3: The multidimensional feature convolution layer performs a convolution operation on feature A′ to obtain the output result of the multidimensional feature extraction branch, i.e., the multidimensional feature A t : A t =Conv(A′); Among them, Conv(·) represents the convolution operation, A t ∈R 1×D .

2. The ship image classification method based on multi-dimensional feature embedding according to claim 1, characterized in that: The Transformer network branch includes an image block embedding module, a feature sequence generation module and a Transformer feature extractor.

3. The ship image classification method based on multi-dimensional feature embedding according to claim 2, characterized in that: The specific processing process of the Transformer network branch is as follows: Step B1: The image block embedding module embeds the input image X to obtain feature B ′ , the image block embedding module consists of a convolution layer and an activation function, and the embedding process is as follows: B′=Relu(Conv(X)); Among them, Relu(·) represents the activation function, Conv(·) represents the convolution operation, and B′∈R N×D ; Step B2: The feature sequence generation module generates a learnable classification label cls∈R 1×D With feature B ′ After splicing, we get feature B0: B0 = Concat(B′,cls); Among them, Concat(·) represents the concatenation operation, B0∈R (N+1)×D ; Step B3: The Transformer feature extractor includes L series-connected Transformer encoders, which extract the multidimensional feature A output by the multidimensional feature extraction branch. t Embedded into the processing process, so as to output the result B with multi-dimensional features L .

4. The ship image classification method based on multi-dimensional feature embedding according to claim 3 is characterized in that: The specific process of step B3 is: For the l+1th Transformer encoder, l=0,1,2…L-1, its input is feature B l , B l ∈R (N+1+l)×D , the output is feature B′ l+1 ,B l ′ +1 ∈R (N+1+l)×D ; When l>0, B l =Concat(B′ l ,A t ), Concat(·) represents the concatenation operation; B0 is the input of the first Transformer encoder; Each Transformer encoder sets three learnable parameter matrices: W Q ,W K ,W V ∈R D×D ; For the l+1th Transformer encoder, its output feature B′ l+1 The way to obtain is: The parameter matrix W Q ,W K ,W V Respectively and Feature B l The normalized result is multiplied to obtain three feature matrices Q, K, V∈R (N+1+l)×D : Q=LN(B l )·W Q ; K=LN(B l )·W K ; V=LN(B l )·W V ; Where LN(·) represents the normalization operation; Set up three more learnable positional encodings P l ∈R (l+1)×D , using the broadcast mechanism to encode the position P h and P w Add and add to the position code P l Splicing is performed to obtain feature P. The above process can be expressed by the following formula: P=Concat((P h +P w ),P l ); Among them, Concat(·) represents the concatenation operation, P∈R (N+1+l)×D ; Then, the feature B′ is calculated by the following formula: l+1 : B′ l+1 =MLP(LN(B″ l+1 ))+B″ l+1 ; Among them, Softmax(·) represents the activation function, d k =D, LN(·) represents the normalization operation, MLP(·) represents the multi-layer perceptron, B″ l+1 ∈R (N+1+l)×D ; The output of the Transformer feature extractor is: B L =Concat(B′ L ,A t ), B L ∈R (N+1+L)×D .

5. The ship image classification method based on multi-dimensional feature embedding according to claim 1, characterized in that: The processing process of the classification output module is: Step C: Output feature B of the Transformer network branch L After normalization, the classification mark cls is extracted, and then the classification mark cls is linearly transformed to obtain the classification result: Among them, Softmax(·) represents the activation function, Linear(·) represents the linear transformation; vector The category represented by the item with the largest median value is the predicted category of the model.

6. The ship image classification method based on multi-dimensional feature embedding according to any one of claims 1 to 5, characterized in that: The classification model is trained in the following way: Step T1: Obtain ship images with image labels to form a sample data set. Each image and its corresponding category are recorded as Among them, X i ∈R H×W×C represents the i-th ship image, Y i Represents the ship image X i The corresponding true label is the true category, i = 1, 2, ..., Z, where Z represents the number of ship images; Step T2: Input the images in the sample data set into the local global multi-head attention classification model to obtain the corresponding classification results; input image X i The corresponding classification results are recorded as Step T3: Calculate the cross entropy loss between the classification result and the true label: Step T4: adjust the parameters of the local-global multi-head attention classification model according to the cross entropy loss; Step T5: Repeat steps T1 to T4 until the cross entropy loss is less than a preset value or the number of repetitions reaches a preset value.

Citation Information

Patent Citations

  • Video pedestrian re-identification method based on channel attention mechanism and application

    CN112836646A

  • Ship image classification method based on local features and global features

    CN117523294A