Method for obtaining an image feature vector

By combining ResNet50, MobileNet_V2, and ConvNeXt_T convolutional network models with the MAMSD model's multi-head attention and multi-scale fusion network, the problems of local information loss and manual feature extraction in existing image retrieval are solved, achieving more accurate and stable image feature extraction and retrieval.

CN117994623BActive Publication Date: 2026-11-20NANJING UNIV OF INFORMATION SCI & TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410299814.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-15
Publication Date
2026-11-20
Estimated Expiration
2044-03-15

AI Technical Summary

Technical Problem

In existing image retrieval technologies, the global descriptor method leads to the loss of local information, while the local feature descriptor method has poor real-time performance and requires manual extraction, making it difficult to accurately extract feature points in complex environments, resulting in low image retrieval accuracy.

Method used

Local feature descriptors are extracted using ResNet50, MobileNet_V2, and ConvNeXt_T convolutional network models. Feature fusion is performed using a multi-head attention network and a multi-scale fusion network of the MAMSD model, and image feature vectors are generated by combining the NetVLAD layer.

Benefits of technology

It improves the accuracy and stability of image feature vector retrieval, solves the limitations of local information loss and manual feature extraction, and enhances the model's autonomous learning ability and information extraction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117994623B_ABST
    Figure CN117994623B_ABST
Patent Text Reader

Abstract

The application discloses a kind of acquisition methods of image feature vector in the field of computer vision, to solve the technical problems of local information loss, image feature is not enough rich and comprehensive and low extraction accuracy.It includes: creatively proposes MAMSD model to solve the limitation of local information loss and manual feature extraction in traditional image retrieval, improves information extraction efficiency through convolutional neural network multi-head attention mechanism and multi-scale feature fusion mechanism;Introduce NetVLAD layer in MAMSD model, more accurately describe the local details of image, improve the retrieval accuracy and stability of image feature vector;Local feature descriptors are extracted by ResNet50 convolution network model, MobileNet_V2 convolution network model and ConvNeXt_T convolution network model, which eliminates the limitation of manual feature extraction and improves the autonomous learning efficiency of the model on features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for obtaining image feature vectors, belonging to the field of computer vision technology. Background Technology

[0002] Image retrieval technology has become a focal point of research in computer vision and Visual Simultaneous Localization and Mapping (VSLAM) systems. The advent of image retrieval has significantly improved query efficiency, allowing for the retrieval of similar images from massive databases based on query images using a series of algorithms, and the indexing of the most similar images.

[0003] The inventors, through implementing existing technologies, discovered that early image retrieval primarily focused on extracting global descriptors. However, this method struggles to achieve the desired results when faced with variations in lighting, deformation, occlusion, and cropping, leading to the loss of local information and resulting in low image retrieval accuracy. This limits the application scope of global descriptor algorithms. For aspects that global descriptor algorithms cannot address, local feature descriptor extraction methods (such as Scale Invariant Feature Transform (SIFT) / Accelerated Robust Feature Rendering (SURF)) have emerged. Although local feature extraction algorithms possess rotation, scale, and brightness invariance and exhibit some stability against viewpoint changes, affine transformations, and noise, their real-time performance is poor, sometimes extracting only a limited number of feature points, making it difficult to accurately extract feature points from objects with smooth edges. Furthermore, these descriptors are hand-designed and cannot learn from input descriptors.

[0004] Therefore, the inventors discovered through research that existing global feature extraction methods result in the loss of local information and insufficient richness and comprehensiveness of image features, while existing local feature extraction methods require manual feature extraction and have low extraction accuracy. Summary of the Invention

[0005] The purpose of this disclosure is to overcome the shortcomings of the prior art and provide a method for obtaining image feature vectors that can comprehensively extract image features, learn input descriptors, and have excellent extraction accuracy.

[0006] To achieve the above objectives, this disclosure employs the following technical solution:

[0007] Firstly, this disclosure provides a method for obtaining image feature vectors, including,

[0008] The image dataset was input into the ResNet50 convolutional network model, the MobileNet_V2 convolutional network model, and the ConvNeXt_T convolutional network model, respectively, and local feature descriptors were obtained from the corresponding convolutional network models.

[0009] Each local feature descriptor is input into the multi-head attention network of the MAMSD model to obtain the feature vector of each attention head, and then fused to obtain the feature vector that combines all attention heads.

[0010] Each local feature descriptor is input into the multi-scale fusion network of the MAMSD model to obtain a multi-scale small module. The multi-scale small module is then input into the NetVLAD layer to obtain the feature vector of each scale. The feature vectors of each scale are then fused to obtain a feature vector that has been fused from all scales.

[0011] The feature vectors from all attention heads and the feature vectors from all scales are fused together again to obtain a feature map, and the image feature vector is obtained based on the feature map.

[0012] In some embodiments of the first aspect, the step of inputting each local feature descriptor into the multi-head attention network of the MAMSD model to obtain the feature vector of each attention head, and then fusing them to obtain a feature vector that fuses all attention heads, including...

[0013] The input local feature descriptor is transformed into a linear form. 3D eigenvectors;

[0014] Will The feature vector of dimension 1 is divided into multiple sub-vectors, the same number as the number of attention heads;

[0015] Each subvector is multiplied by the query matrix, key matrix, and value matrix respectively to obtain the query, key, and value;

[0016] Using the query, key, and value as calculation parameters, a score for each attention head is calculated based on the softmax function;

[0017] Based on the scores, all attention heads are fused to obtain a feature vector that incorporates all attention heads.

[0018] In some embodiments of the first aspect, the calculation of a score for each attention head using the query, key, and value as computational parameters according to the softmax function includes,

[0019] The formula for calculating the score of each attention head is as follows:

[0020] ;

[0021] In the formula, i is the index of the attention head, and h is the number of attention heads. For the score of the i-th attention head, Let i be the query vector for the i-th attention head. Let i be the key vector of the i-th attention head. Let i be the value vector of the attention head. Let T be the dimension of the feature vector, Attention be the attention function, and T be the vector. The transpose operator.

[0022] The process involves fusing all attention heads based on their scores to obtain a feature vector that integrates all attention heads, including:

[0023] The output formula for the feature vector that integrates all attention heads is:

[0024] MutilHead = Concat( , ,..., ) ;

[0025] In the formula, Concat is a string concatenation function, and MutlHead is a multi-head attention mechanism function.

[0026] In some embodiments of the first aspect, the step of inputting each local feature descriptor into the multi-scale fusion network of the MAMSD model to obtain multi-scale small modules, inputting the multi-scale small modules into the NetVLAD layer to obtain feature vectors at each scale, and fusing the feature vectors at each scale to obtain a feature vector fused from all scales, including...

[0027] use This refers to the small module, the size of which is... , where j is the sequence number of the sub-module, This represents the total number of small modules. , , Each of these represents the center coordinate of the j-th sub-module, and the total number of sub-modules is [the coordinates of the sub-modules]. The calculation formula is:

[0028] ;

[0029] In the formula, The stride is set, * represents the multiplication symbol, and H and W are the dimensions of the local feature description, respectively.

[0030] In some embodiments of the first aspect, the NetVLAD layer is constructed using the VLAD algorithm, and the method for obtaining the NetVLAD layer includes:

[0031] Obtain the VLAD algorithm output vector:

[0032] The softmax layer is used to perform differentiable operations on the parameters allocated in the VLAD algorithm to obtain the NetVLAD algorithm, which is then used as the NetVLAD layer.

[0033] In some embodiments of the first aspect, the fusion of feature vectors at each scale includes fusing feature vectors from different scales using a cascade operation based on a selected fusion method, wherein the fusion formula is:

[0034] F = Concat(f1,f2,...,fn);

[0035] In the formula, F is the feature vector that integrates all scales, Concat is a string concatenation function, f1, f2, ..., fn are feature vectors of multiple scales from 1 to n, and n is the number of feature vectors of different scales.

[0036] In some embodiments of the first aspect, obtaining the image feature vector from the feature map includes regularizing the obtained feature map to obtain the image feature vector, wherein the regularization selection includes Intra regularization or L2 regularization.

[0037] Secondly, this disclosure also provides an electronic terminal, including a processor and a memory connected to the processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it performs the steps of the image feature vector acquisition method as described in any one of the embodiments of the first aspect.

[0038] Thirdly, this disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the image feature vector acquisition method described in any one of the first aspect embodiments.

[0039] Fourthly, this disclosure also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the image feature vector acquisition method described in any one of the embodiments of the first aspect.

[0040] Compared with the prior art, the beneficial effects achieved by this disclosure are as follows:

[0041] The image feature vector acquisition method disclosed herein creatively proposes the MAMSD model to address the limitations of local information loss and manual feature extraction in traditional image retrieval. It improves information extraction efficiency through multi-head attention and multi-scale feature fusion mechanisms in convolutional neural networks. The MAMSD model incorporates a NetVLAD layer to more accurately describe local image details, facilitating the extraction of more comprehensive and richer image features, thereby improving the accuracy and stability of image feature vector retrieval. Furthermore, it extracts local feature descriptors using ResNet50, MobileNet_V2, and ConvNeXt_T convolutional network models, eliminating the limitations of manual feature extraction and improving the model's autonomous feature learning efficiency. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 This is a flowchart of the method for obtaining image feature vectors provided in the embodiments of this disclosure;

[0044] Figure 2 This is a schematic diagram of the ResNet50 convolutional network model in the image feature vector acquisition method provided in this embodiment of the disclosure;

[0045] Figure 3 This is a schematic diagram of the MobileNet_V2 convolutional network model in the image feature vector acquisition method provided in this embodiment of the disclosure;

[0046] Figure 4 This is a schematic diagram of the ConvNeXt_T convolutional network model in the image feature vector acquisition method provided in this embodiment of the disclosure;

[0047] Figure 5 This is a schematic diagram illustrating the principle of the MAMSD model in the image feature vector acquisition method provided in this embodiment. Detailed Implementation

[0048] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments and specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations thereof. In the absence of conflict, the embodiments and technical features in the embodiments can be combined with each other.

[0049] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0050] Example 1

[0051] Figure 1 This is a flowchart illustrating a method for obtaining image feature vectors according to Embodiment 1 of the present invention. This flowchart merely shows the logical order of the method described in this embodiment. Provided there are no conflicts, different methods may be used in other possible embodiments of the present invention. Figure 1 Complete the steps shown or described in the order indicated.

[0052] The image feature vector acquisition method provided in this embodiment can be applied to a terminal and can be executed by an electronic device. This device can be implemented in software and / or hardware and can be integrated into the terminal, such as any smartphone, tablet, or computer device with communication capabilities. See also... Figure 1 The method implemented in this way specifically includes the following steps:

[0053] The image dataset was input into the ResNet50 convolutional network model, the MobileNet_V2 convolutional network model, and the ConvNeXt_T convolutional network model, respectively, and local feature descriptors were extracted from the three convolutional network models. The local feature descriptors were then input into the multi-head attention network and the multi-scale fusion network of the MAMSD model.

[0054] refer to Figure 2 ResNet addresses the vanishing gradient and representation bottleneck problems in deep neural networks by introducing residual blocks. ResNet50 contains 50 layers, omitting average pooling layers and fully connected layers, and typically exhibits good performance and generalization ability. (Reference) Figure 3 MobileNetV2 retains the first convolutional layer and all inverse residual layers of the original MobileNet model, while pruning the last two convolutional layers and the max-pooling layer. MobileNet_V2 uses depthwise separable convolutions and linear bottlenecks to reduce computation and model size while maintaining performance. (Reference) Figure 3ConvNeXt is a modern network architecture based on regular convolutions. ConvNeXt_T is a smaller version of this series of models, suitable for use in resource-constrained environments. ConvNeXt_T retains the first convolutional layer and all ConNeXt modules of the original ConvNeXt model, while pruning the last max-pooling layer and layer-based normalization. Image content can be effectively represented using ResNet50, MobileNet_V2, and ConvNeXt_T convolutional network models. Furthermore, they can autonomously learn end-to-end by extracting local features containing both low-level information and high-level semantic features. Extracting local descriptors requires low computational resources and satisfies the requirement for autonomous local feature extraction.

[0055] Feature vectors from each attention head are obtained through a multi-head attention network, and then fused together. The multi-head attention mechanism allows the model to simultaneously focus on information from different representation subspaces, concentrating each attention head on different subspaces of the input to capture multiple relationships. Each attention head can independently learn different feature representations, increasing the diversity and richness of information. Therefore, obtaining feature vectors from each attention head provides more comprehensive information, helping the model better understand and analyze images. Fusing the feature vectors from all attention heads integrates the feature information learned by different heads into a more comprehensive feature representation. This integration helps the model capture multiple features in the image and combine them to form a more powerful feature representation. This feature representation is generally more discriminative and robust, contributing to improved model performance on various visual tasks.

[0056] Multi-scale fusion networks are used to obtain multi-scale modules. Feature vectors for each scale are obtained from the NetVLAD layers, and feature vectors from all scales are fused. This fusion of multiple features from different scales improves the model's representation and generalization capabilities. Small-scale feature vectors may focus more on details and texture, while large-scale feature vectors may focus more on overall structure and layout. By fusing these feature vectors from different scales, a more comprehensive and representative feature representation can be generated. This representation combines the advantages of different scales, improving the expressive power of the features. Fusing feature vectors from multiple scales can also reduce the risk of overfitting. Overfitting refers to a situation where a model performs well on training data but poorly on test data. By fusing features from multiple scales, the model can learn more information from a wider range of data, thus reducing the possibility of overfitting.

[0057] The feature vectors from all attention heads and the feature vectors from all scales are fused again to obtain a feature map, and then the image feature vector is derived from the feature map. The feature vectors generated by the attention heads and the feature vectors at different scales each capture different aspects of the image. The attention heads focus on different parts of the image, while multi-scale features reflect information about the image at different scales. Fusing these features together produces a more comprehensive and richer image representation, containing complementary information from different sources. By fusing feature vectors from different sources, the model can utilize more information to make decisions, thereby improving its performance. This fusion strategy allows the model to consider more contextual information and details when handling complex tasks, thus making more accurate predictions.

[0058] In summary, it is evident that the image feature vector acquisition method provided in this embodiment creatively proposes the MAMSD model to address the limitations of local information loss and manual feature extraction in traditional image retrieval. It improves information extraction efficiency through multi-head attention and multi-scale feature fusion mechanisms in convolutional neural networks. The introduction of a NetVLAD layer into the MAMSD model more accurately describes local image details, facilitating the extraction of more comprehensive and richer image features, thereby improving the accuracy and stability of image feature vector retrieval. Furthermore, the extraction of local feature descriptors through ResNet50, MobileNet_V2, and ConvNeXt_T convolutional network models eliminates the limitations of manual feature extraction and improves the model's autonomous feature learning efficiency.

[0059] Example 2

[0060] This embodiment provides a method for obtaining image feature vectors, which is an improvement on Embodiment 1. See also the following: Figure 1 For details not covered in the steps shown, please refer to Example 1.

[0061] This embodiment further refines the method for obtaining image feature vectors:

[0062] Example 1 mentions extracting local feature descriptors from three convolutional network models, optionally referencing Figure 2 , Figure 3 and Figure 4 Suppose that the dimensions (C,H,W) of the local feature descriptors extracted from a certain image dataset using the ResNet50 convolutional network model, the MobileNet_V2 convolutional network model, and the ConvNeXt_T convolutional network model are (2048,7,7), (320,7,7), and (7,7,768), respectively, where C, H, and W are the three dimensions of the local feature descriptor.

[0063] refer to Figure 5The three local feature descriptors are input into the MAMSD model. Example 1 mentions obtaining the feature vector of each attention head through a multi-head attention network and fusing the feature vectors of all attention heads. Optionally, in a further preferred but non-limiting embodiment of this application, at least the following step is included: for ease of processing, the input local feature descriptors are transformed to a linear transformation. A feature vector of dimension; specifically, within a multi-head attention network, local feature descriptors are used as input vectors. Change to 3D eigenvectors The calculation formula is:

[0064] ;

[0065] In the formula, It is a parameter matrix, where R is the real number field, N is the number of descriptors, and D is the descriptor dimension.

[0066] Will The feature vector of dimension is divided into multiple sub-vectors, the same number as the number of attention heads; specifically, the feature vector is divided into... 3D eigenvectors Divide into h equal parts to obtain h word vectors , where i is the index of the attention head.

[0067] Each subvector is multiplied by the query matrix, key matrix, and value matrix to obtain the query, key, and value, respectively. Specifically, for each attention head, the subvectors are multiplied by the query matrix, key, and value. Multiply by the three parameter matrices to obtain three The formulas for calculating the dimensional vector, query vector, key vector, and value vector are as follows:

[0068] ;

[0069] in, For querying the matrix, The key matrix, For value matrices, For query vector, For key vectors, For value vectors, , , , , , .

[0070] Using the query, key, and value as calculation parameters, the score for each attention head is calculated using the softmax function. Specifically, for each attention head, the attention score is calculated by taking the dot product of the query vector and the key vector, and then applying the softmax function. The formula for calculating the score for each attention head is as follows:

[0071] ;

[0072] In the formula, i is the index of the attention head, and h is the number of attention heads. For the score of the i-th attention head, Let i be the query vector for the i-th attention head. Let i be the key vector of the i-th attention head. Let i be the value vector of the attention head. T is one dimension of the feature vector, Attention is an attention function, and T is a vector. The transpose operator.

[0073] Based on the scores, all attention heads are fused to obtain a feature vector that incorporates all attention heads; specifically, the output formula for the fused feature vector of all attention heads is:

[0074] MutilHead = Concat( , ,..., ) ;

[0075] In the formula, Concat is a string concatenation function, and MutlHead is a multi-head attention mechanism function.

[0076] As mentioned in Example 1, multi-scale small modules are obtained through a multi-scale fusion network, and feature vectors at each scale are obtained according to the NetVLAD layer. Feature vectors at all scales are then fused. Optionally, in a further preferred but non-limiting embodiment of this application, this step further includes at least using local feature descriptors as input feature maps within the multi-scale fusion network. H and W are the two dimensions of the local feature descriptor, D is the descriptor dimension, and R is the real number field. The stride is set to... The resulting size is small modules, then use Let j represent a small module, where j is the module number. This represents the total number of small modules. , , These are the center coordinates of the j-th sub-module and the total number of sub-modules, respectively. The calculation formula is:

[0077] .

[0078] Example 1 also mentions using the NetVLAD layer to obtain the feature vector for each scale. Since the traditional VLAD algorithm output vector allocation parameter method is hard allocation, in order to embed the VLAD algorithm into the convolutional neural network model NetVLAD layer for end-to-end training, the NetVLAD algorithm uses a softmax layer to perform differentiable operations on the allocation parameters to achieve soft allocation of the allocation parameters.

[0079] After obtaining the feature vectors fused from all attention heads and the feature vectors fused from all scales, the feature vectors fused from all attention heads and the feature vectors fused from all scales are fused again. This includes using a cascade operation based on the selected fusion method to fuse feature vectors from different scales. The fusion formula is as follows:

[0080] F = Concat(f1,f2,...,fn);

[0081] In the formula, F is the feature vector that integrates all scales, Concat is a string concatenation function, f1, f2, ..., fn are feature vectors of multiple scales from 1 to n, and n is the number of feature vectors of different scales.

[0082] To improve robustness, generalization ability, and stability, and to avoid overfitting, the obtained feature maps are regularized to obtain image feature vectors. Regularization options include Intra regularization or L2 regularization.

[0083] The image feature vector acquisition method provided in this embodiment creatively combines a MAMSD model. Through recall comparison experiments, the recall-25 value of the image feature vector acquisition method provided in this embodiment increased by 17.6% compared to the traditional VLAD method, by 2.62% compared to the traditional NetVLAD method, and by 1.56% compared to the patch-NetVLAD method. Therefore, the image feature vector acquisition method provided in this embodiment improves the accuracy and stability of image retrieval. Since this embodiment involves a NetVLAD layer, it can more accurately describe the local details of the image. Combining the image feature vector acquisition method with AR technology can more accurately distinguish road conditions; the creatively proposed MAMSD model can further improve the accuracy of image feature extraction and matching.

[0084] Example 3

[0085] This embodiment provides an electronic terminal, including a processor and a memory connected to the processor. The memory stores a computer program, which, when executed by the processor, can be referenced... Figure 1 Perform the steps of the image feature vector acquisition method as described in either Embodiment 1 or 2.

[0086] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, which can be referred to. Figure 1 When the program is executed by the processor, it implements the steps of the image feature vector acquisition method of either Embodiment 1 or 2.

[0087] This embodiment also provides a computer program product, including a computer program / instructions, which can be referred to. Figure 1 When the computer program / instruction is executed by the processor, it implements the steps of the image feature vector acquisition method of either Embodiment 1 or 2.

[0088] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0089] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0090] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0091] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0092] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

[0093] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for obtaining image feature vectors, characterized in that, The image dataset was input into the ResNet50 convolutional network model, the MobileNet_V2 convolutional network model, and the ConvNeXt_T convolutional network model, respectively, and local feature descriptors were obtained from the corresponding convolutional network models. Each local feature descriptor is input into the multi-head attention network of the MAMSD model to obtain the feature vector of each attention head, and then fused to obtain the feature vector that combines all attention heads. Each local feature descriptor is input into the multi-scale fusion network of the MAMSD model to obtain a multi-scale small module. The multi-scale small module is then input into the NetVLAD layer to obtain the feature vector of each scale. The feature vectors of each scale are then fused to obtain a feature vector that has been fused from all scales. The feature vectors from all attention heads and the feature vectors from all scales are fused together again to obtain a feature map, and the image feature vector is obtained based on the feature map. Specifically, the process involves inputting each local feature descriptor into the multi-head attention network of the MAMSD model to obtain the feature vector of each attention head, and then fusing them to obtain a feature vector that integrates all attention heads, including... The input local feature descriptor is transformed into a linear form. 3D eigenvectors; Will The feature vector of dimension 1 is divided into multiple sub-vectors, the same number as the number of attention heads; Each subvector is multiplied by the query matrix, key matrix, and value matrix respectively to obtain the query, key, and value; Using the query, key, and value as calculation parameters, a score for each attention head is calculated based on the softmax function; Based on the scores, all attention heads are fused to obtain a feature vector that fuses all attention heads; Specifically, the process involves inputting each local feature descriptor into the multi-scale fusion network of the MAMSD model to obtain multi-scale small modules. These small modules are then input into the NetVLAD layer to obtain feature vectors for each scale. Finally, the feature vectors from each scale are fused to obtain a feature vector that integrates all scales, including... use This refers to the small module, the size of which is... , where j is the sequence number of the sub-module, This represents the total number of small modules. , , Each of these represents the center coordinate of the j-th sub-module, and the total number of sub-modules is [the coordinates of the sub-modules]. The calculation formula is: ; In the formula, The stride is set, * is the multiplication symbol, and H and W are the dimensions of the local feature description, respectively. The NetVLAD layer is constructed using the VLAD algorithm, and the method for obtaining the NetVLAD layer includes: Obtain the VLAD algorithm output vector: The softmax layer is used to perform differentiable operations on the parameters allocated in the VLAD algorithm to obtain the NetVLAD algorithm, which is then used as the NetVLAD layer.

2. The method for obtaining image feature vectors according to claim 1, characterized in that, The process involves using query, key, and value as calculation parameters, and calculating the score for each attention head based on the softmax function, including... The formula for calculating the score of each attention head is as follows: ; In the formula, i is the index of the attention head, and h is the number of attention heads. For the score of the i-th attention head, Let i be the query vector for the i-th attention head. Let i be the key vector of the i-th attention head. Let i be the value vector of the attention head. Let T be the dimension of the feature vector, Attention be the attention function, and T be the vector. The transpose operator; The process involves fusing all attention heads based on their scores to obtain a feature vector that integrates all attention heads, including: The output formula for the feature vector that integrates all attention heads is: MutilHead = Concat( , ,..., ) ; In the formula, Concat is a string concatenation function, and MutlHead is a multi-head attention mechanism function.

3. The method for obtaining image feature vectors according to claim 1, characterized in that, The fusion of feature vectors at each scale includes fusing feature vectors from different scales using a cascade operation based on the selected fusion method, with the fusion formula as follows: F = Concat(f1,f2,...,fn); In the formula, F is the feature vector that integrates all scales, Concat is a string concatenation function, f1, f2, ..., fn are feature vectors of multiple scales from 1 to n, and n is the number of feature vectors of different scales.

4. The method for obtaining image feature vectors according to claim 1, characterized in that, The step of obtaining the image feature vector from the feature map includes regularizing the obtained feature map to obtain the image feature vector, wherein the regularization option includes Intra regularization or L2 regularization.

5. An electronic terminal, characterized in that, The device includes a processor and a memory connected to the processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the image feature vector acquisition method as described in any one of claims 1 to 4 are performed.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the image feature vector acquisition method according to any one of claims 1 to 4.

7. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the method for obtaining the image feature vector as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Pathological image quality control method and device based on deep learning, equipment and medium

    CN115115876A

  • Fine-grained image recognition method based on attention

    CN116580289A