Image recognition method and device, electronic equipment and storage medium

By performing feature extraction and multiple recognition processes on the image to be recognized, and by using the RPN network and object recognition model to perform multiple matching of the person bounding box feature map and classification results, the problem of low person recognition accuracy in end-to-end algorithms is solved, and higher recognition accuracy is achieved.

CN118052990BActive Publication Date: 2026-11-27TCL TECHNOLOGY GROUP CORPORATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211428180.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-15
Publication Date
2026-11-27
Estimated Expiration
2042-11-15

AI Technical Summary

Technical Problem

Existing end-to-end people search algorithms suffer from low accuracy in detecting and identifying people.

Method used

By extracting features from the image to be recognized, initial recognition processing is performed using the first recognition model. Based on the initial recognition results, multiple recognition processing is performed, including region feature aggregation operations and multiple recognition stages, to gradually improve the recognition accuracy. The RPN network and the preset object recognition model are used to perform multiple matching and recognition of person bounding box feature maps and classification results.

Benefits of technology

It improves the recognition accuracy of end-to-end people search algorithms, enabling accurate identification of people's location and identity in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118052990B_ABST
    Figure CN118052990B_ABST
Patent Text Reader

Abstract

An image recognition method and device, electronic equipment and storage medium are disclosed. The method comprises feature extraction on a to-be-recognized image to obtain a first convolution feature image, recognition processing of the first convolution feature image by using a first recognition model to obtain an initial recognition result, the initial recognition result representing position recognition and category recognition of a to-be-recognized object in the to-be-recognized image, and multiple times of recognition processing of the first convolution feature image based on the initial recognition result to obtain a target recognition result. The embodiment of the present application can improve the recognition accuracy of an end-to-end character search algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing and machine learning technology, and in particular to an image recognition method, apparatus, electronic device and storage medium. Background Technology

[0002] The goal of people search is to locate a specific target person from a set of scene images, which is a challenging fine-grained recognition and retrieval problem. A people search system must include two tasks: separating the person from the background and distinguishing the identities of different people. In real-world applications, people search systems must detect people of various image sizes and maintain recognition even when resolution, viewpoint, and occlusion conditions change significantly.

[0003] Currently, the mainstream algorithms mainly include two-step search and end-to-end search. The latter is relatively more efficient, but it also faces the problem of conflict between detecting people and identifying their identities. Therefore, the recognition accuracy of existing end-to-end people search algorithms needs to be improved. Summary of the Invention

[0004] The purpose of this invention is to provide an image recognition method, apparatus, electronic device, and storage medium to solve the technical problem of low recognition accuracy in existing end-to-end person search algorithms.

[0005] In a first aspect, embodiments of the present invention provide an image recognition method, comprising:

[0006] Feature extraction is performed on the image to be recognized to obtain the first convolutional feature image;

[0007] The first recognition model is used to perform recognition processing on the first convolutional feature image to obtain an initial recognition result; the initial recognition result represents the location recognition and category recognition of the object to be recognized in the image to be recognized.

[0008] Based on the initial recognition result, the first convolutional feature image is subjected to multiple recognition processes to obtain the target recognition result.

[0009] In a second aspect, embodiments of the present invention provide an image recognition device, comprising:

[0010] The feature extraction module is used to extract features from the image to be recognized to obtain the first convolutional feature image;

[0011] The first recognition module is used to process the first convolutional feature image using a first recognition model to obtain an initial recognition result; the initial recognition result represents the location recognition and category recognition of the object to be recognized in the image to be recognized.

[0012] The second recognition module is used to perform multiple recognition processes on the first convolutional feature image based on the initial recognition result to obtain the target recognition result.

[0013] Thirdly, embodiments of the present invention provide an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the image recognition method described above.

[0014] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above-described image recognition methods.

[0015] This invention provides an image recognition method, apparatus, electronic device, and storage medium. The method first extracts features from the image to be recognized to obtain a first convolutional feature image. Then, it uses a first recognition model to process the first convolutional feature image to obtain an initial recognition result representing the location and category of the object to be recognized in the image. Based on the initial recognition result, the first convolutional feature image is processed multiple times to improve the recognition accuracy of the first convolutional feature image. This enables accurate recognition of the target object in the image, improving the recognition accuracy of the end-to-end person search algorithm. Attached Figure Description

[0016] Figure 1 This is a schematic flowchart of an image recognition method provided in an embodiment of the present invention;

[0017] Figure 2 This is a schematic diagram of a method for learning embedding vectors in the first recognition stage of a preset object recognition model provided in an embodiment of the present invention;

[0018] Figure 3 This is another schematic flowchart of the image recognition method provided in an embodiment of the present invention;

[0019] Figure 4 This is a schematic flowchart of an image recognition method with three recognition stages provided in an embodiment of the present invention;

[0020] Figure 5 This is a schematic diagram of the structure of an image recognition device provided in an embodiment of the present invention;

[0021] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention;

[0022] Figure 7 This is another structural schematic diagram of the electronic device provided in the embodiment of the present invention. Detailed Implementation

[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0024] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0025] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0026] In related technologies, the main approach is to perform person recognition processing on target persons in the image to be identified through end-to-end search. However, end-to-end search faces the problem of conflict between detecting persons and recognizing their identities. Therefore, the recognition accuracy of image search methods in related technologies needs to be improved.

[0027] To address the technical problems existing in related technologies, embodiments of the present invention provide an image recognition method. Please refer to [link to relevant documentation]. Figure 1 , Figure 1 This is a schematic flowchart of an image recognition method provided in an embodiment of the present invention, the image recognition method including steps 101 to 103;

[0028] Step 101: Extract features from the image to be recognized to obtain the first convolutional feature image.

[0029] In this embodiment, the image to be recognized is input into a preset feature extraction network to obtain the convolutional feature image of the image to be recognized. Specifically, the preset feature extraction network can be any trained image recognition network model. This network model can be pre-trained or can directly use an existing image recognition network model; no specific limitation is made here.

[0030] Step 102: Use the first recognition model to perform recognition processing on the first convolutional feature image to obtain the initial recognition result.

[0031] The initial recognition result represents the location and category recognition of the object to be identified in the image to be identified. The first recognition model includes an RPN (Region Proposal Network), and the object to be identified can be a person or a specified object. This embodiment mainly uses a person as an example for further explanation.

[0032] Specifically, in this embodiment, the first convolutional feature image is input into the RPN network to identify the position and category of the object to be identified in the image to be identified, so as to classify the object to be identified as a person, animal or other object, and generate the identification box of the object to be identified. Since this embodiment mainly identifies people, the feature map of the person box and the initial identification result of the classification result can be obtained through the RPN network. The working principle of the RPN network is as follows: based on the input original image, after a series of convolutions or pooling by the backbone network, a feature map of size m*n is obtained, which divides the original image into m*n regions. The center of each region of the original image is represented by the coordinates of a pixel on this feature map. Through the anchor mechanism, k candidate boxes that may contain the target are identified and generated in the region of the original image corresponding to each pixel, that is, the initial identification result of candidate boxes containing people is generated.

[0033] Step 103: Based on the initial recognition result, the first convolutional feature image is subjected to multiple recognition processes to obtain the target recognition result.

[0034] The multiple recognition processes can be performed twice, three times, or more. Specifically, this embodiment, by performing multiple recognition processes on the first convolutional feature image, can progressively learn the features in the first convolutional feature image, thereby gradually improving the recognition accuracy during the recognition process and obtaining a more accurate target recognition result.

[0035] It should be noted that this embodiment mainly uses the example of performing two recognition processes on the first convolutional feature image for explanation. Specifically, the step of performing multiple recognition processes on the first convolutional feature image based on the initial recognition result to obtain the target recognition result includes: matching the initial recognition result and the first convolutional feature image to obtain a second convolutional feature image; using a second recognition model to perform recognition processing on the second convolutional feature image to obtain a first recognition result; matching the first recognition result and the second convolutional feature image to obtain a third convolutional feature image; and using the second recognition model to perform recognition processing on the third convolutional feature image to obtain the target recognition result.

[0036] The first recognition result is superior to the initial recognition result in recognizing the object to be identified. The recognition effect can refer to the accuracy of the recognition process or the accuracy of the final recognition result.

[0037] In this embodiment, after obtaining the initial recognition result and the first convolutional feature image, a region feature aggregation operation is performed to match the person bounding box feature image from the initial recognition result to the first convolutional feature image, thereby obtaining a second convolutional feature image containing the person bounding box. Specifically, the region feature aggregation operation provided in this embodiment includes the RolAlign operation, which mainly uses bilinear interpolation to obtain the image values ​​at pixel points with floating-point coordinates, thus transforming the entire feature aggregation process into a continuous operation and effectively ensuring spatial accuracy.

[0038] Optionally, the second recognition model includes a preset object recognition model. Since this embodiment mainly performs two recognition processes on the first convolutional feature image, the preset object recognition model mainly learns the embedding vectors for person detection and person identification through two recognition stages. The granularity of the embedding vectors learned in each recognition stage is different. By refining the granularity of the embedding vectors through two recognition stages, more accurate image recognition can be achieved through finer-grained embedding vectors.

[0039] Specifically, the first recognition stage involves processing the second convolutional feature image. This stage primarily involves encoding the second convolutional feature image using the first encoding processing module within a preset object recognition model, thereby completing the learning of the embedding vector for the first recognition stage and obtaining a coarse-grained embedding vector. Based on the coarse-grained embedding vector, a first recognition result is obtained. The second recognition stage involves processing the third convolutional feature image. This stage primarily involves encoding the third convolutional feature image using the second encoding processing module within a preset object recognition model, thereby completing the learning of the embedding vector for the second recognition stage and obtaining a fine-grained embedding vector. Based on the fine-grained embedding vector, a more accurate target recognition result is obtained.

[0040] In some embodiments, the second recognition model includes a first object classifier and a first bounding box regressor. Specifically, the step of using the second recognition model to perform recognition processing on the second convolutional feature image to obtain a first recognition result includes: based on the first object classifier and the first bounding box regressor, performing object / background classification processing and bounding box regression processing on the second convolutional feature image to obtain the first recognition result.

[0041] In this process, the first encoding module in the preset object recognition model encodes the second convolutional feature image to obtain a coarse-grained embedding vector. Then, the first target classifier and the first target box regressor process the coarse-grained embedding vector to achieve object / background classification and target box regression of the second convolutional feature image, thereby obtaining the first recognition result.

[0042] Specifically, after obtaining the first recognition result, in order to integrate the learned features into the next recognition process, this embodiment also needs to perform matching processing between the first recognition result and the second convolutional feature image to obtain a third convolutional feature image containing the learned features.

[0043] In this embodiment, the matching process is a region feature aggregation operation, specifically the RolAlign operation. The RolAlign operation matches the first recognition result containing the learned features into the second convolutional feature image, thereby obtaining a third convolutional feature image. This allows for a second stage of processing on the third convolutional feature image to further learn a refined embedding vector.

[0044] In other embodiments, the second recognition model further includes a second bounding box regressor and a first category recognizer. Specifically, the step of using the second recognition model to perform recognition processing on the third convolutional feature image to obtain the target recognition result includes: based on the second bounding box regressor and the first category recognizer, performing bounding box regression processing and category recognition processing on the third convolutional feature image to obtain the target recognition result.

[0045] In this process, the second encoding module in the preset object recognition model encodes the third convolutional feature image to obtain a fine-grained embedding vector. Then, the fine-grained embedding vector is processed by the second target classifier and the first category recognizer to achieve target bounding box regression processing and target category recognition processing of the object to be recognized in the third convolutional feature image, resulting in a more accurate target recognition result.

[0046] It should be noted that the category recognizer provided in this embodiment is mainly used for identifying people. Specifically, after obtaining the coarse-grained embedding vector, the category recognizer is not used for predicting people's identities. This is mainly to allow the preset object recognition model to focus on detecting all human objects in the image in the first recognition stage, i.e., before refining the embedding vector, so that its capabilities are mainly focused on classifying people and backgrounds. After obtaining the refined fine-grained embedding vector, the first category recognizer is used to identify people. This is to allow the preset object recognition model to focus its capabilities on identifying people in the second recognition stage. This not only improves the preset object recognition model's ability to classify people and backgrounds but also improves the accuracy of the preset object recognition model's identification of people.

[0047] As an optional embodiment, the second recognition model further includes an attention mechanism encoding layer. The step of performing object / background classification and object bounding box regression processing on the second convolutional feature image based on the first target classifier and the first target bounding box regressor to obtain a first recognition result specifically includes: performing multi-scale convolution processing on the second convolutional feature image to obtain multiple convolutional feature images at different scales; performing block processing on the convolutional feature image at each scale to obtain multiple blocks corresponding to the convolutional feature image at each scale, and determining the target block containing the object to be recognized from the multiple blocks; and further processing the... The target blocks at the target location in the convolutional feature image at each scale are swapped to obtain the swapped convolutional feature image at each scale. The swapped convolutional feature image at each scale is compressed to obtain a one-dimensional feature vector at each scale. The one-dimensional feature vector at each scale is input into the attention mechanism encoding layer for encoding to obtain the embedding vector corresponding to the second convolutional feature image. Based on the first target classifier and the first target bounding box regressor, the embedding vector is subjected to object / background classification and object bounding box regression to obtain the first recognition result.

[0048] The step of performing multi-scale convolution processing on the second convolutional feature image to obtain multiple convolutional feature images at different scales specifically involves: distributing the feature image containing the object to be identified in the second convolutional feature image evenly to multiple channels of the attention mechanism coding layer; and performing convolution processing on the feature image at the corresponding scale through each channel of the attention mechanism coding layer to obtain multiple convolutional feature images at different scales, with each channel containing a different convolution kernel.

[0049] In this embodiment, the block processing mainly involves tokenizing the convolutional feature image at each scale, dividing the convolutional feature image at each scale into several tokens. Here, the height of the convolutional feature image at each scale is set to h, the width to w, and the length and width of each token are both d. Then the number of tokens N is:

[0050] In related technologies, there is still a technical problem that identity recognition is difficult under occlusion conditions. To solve this problem, this invention introduces a token-level occlusion attention mechanism to simulate occlusion encountered in real-world applications. Please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram of a method for learning embedding vectors in the first recognition stage of a preset object recognition model provided in this embodiment of the invention. Specifically, as shown... Figure 2 As shown, firstly, multi-scale convolution processing is performed on the second convolution feature image. Then, tokens are collected from the convolution feature images at each scale, denoted as the tokens library X = {x1, x2, ..., x}. P}, where x i Let P represent the number of tokens contained in the i-th person object, and P be the number of person objects detected in an image. Then, target tokens at target locations in the convolutional feature image at each scale are swapped. The target location can be one or multiple, and can be pre-defined or randomly selected. The swapped tokens correspond to semantically consistent sub-regions in the convolutional feature image. Assuming the set of token regions swapped for the i-th person object is M, the i-th convolutional feature image composed of the swapped tokens is represented as:

[0051] x i ={x i (M - ),x j (M)}

[0052] Where, x j M represents the tokens contained in another character object randomly selected from the tokens library. - Let M represent the complement region. The swapped convolutional feature maps are compressed into a one-dimensional vector, with the number of channels remaining unchanged and the vector length h×w. The compressed feature vector is then fed into the attention mechanism encoding layer. This layer consists of six identical layers, each containing two sub-layers: a multi-head attention layer followed by a fully connected layer. Residual connections and normalization operations are used between each sub-layer. Thus, through... Figure 2 The method shown can be used to obtain the coarse-grained embedding vector learned in the first recognition stage.

[0053] As an optional embodiment, the loss function L used by the preset object recognition model during training is:

[0054]

[0055] Among them, L det The loss function L is used when identifying the object to be identified. OIM To match the loss function for online instances, L ID Let t represent the loss function for classifying the object to be identified, where t represents the loss when the identification result is obtained for the tth time, T is the total number of identification results obtained, and the coefficient α is the loss function for classifying the object to be identified. OIM and β ID I(t>1) is an indicator function used to balance the two loss terms for classifying the object to be identified. It represents the loss generated by the classifying process of the object to be identified when the identification result is obtained for the first time, without considering the loss generated by the first classifying process.

[0056] Specifically, the loss function L det The loss consists of a regression loss term and a classification loss term. The former is the L1 smoothing loss of the regression vector between the ground truth and predicted bounding boxes of the object to be identified, while the latter is the cross-entropy loss used to calculate the predicted classification probability of the object to be identified. To supervise the category identification of the object to be identified, i.e., identity recognition, this embodiment uses the classic nonparametric online instance matching (OIM) loss L... OIM And another cross-entropy loss function L was added. ID To predict the identity of an object for additional identity supervision.

[0057] As an optional embodiment, to further improve the recognition accuracy of the person search algorithm, this embodiment may add one or more additional recognition stages between the first and second recognition stages mentioned in the above embodiments, so as to further refine the granularity of the embedding vectors for the person detection task and the person identity recognition task. To explain the technical solution of adding additional recognition stages in detail, this embodiment mainly uses adding one additional recognition stage as an example. Specifically, to add an additional recognition stage, the second recognition model also includes a second object classifier, a third object box regressor, and a second category recognizer. Please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is another schematic flowchart of the image recognition method provided in this embodiment of the invention, such as... Figure 3 As shown, the image recognition method provided in this embodiment of the invention includes steps 301 to 308;

[0058] Step 301: Extract features from the image to be recognized to obtain the first convolutional feature image.

[0059] In this embodiment, the image to be identified is input into a preset feature extraction network to obtain the convolutional feature image of the image to be identified. Specifically, the preset feature extraction network provided in this embodiment mainly uses two 3*3 convolutional layers to extract low-level features of the input image, and then feeds the extracted features into a module composed of four stacked residual units to gradually learn high-level features. Memory connections are provided between each residual unit to achieve the final fusion of features at different levels.

[0060] Step 302: Use the first recognition model to perform recognition processing on the first convolutional feature image to obtain the initial recognition result.

[0061] The initial recognition result represents the location and category recognition of the object to be recognized in the image to be recognized.

[0062] Step 303: Perform matching processing on the initial recognition result and the first convolutional feature image to obtain the second convolutional feature image.

[0063] In this embodiment, the second recognition model includes a first target classifier, a first target bounding box regressor, a second target bounding box regressor, a first category recognizer, a second target classifier, a third target bounding box regressor, and a second category recognizer.

[0064] Step 304: Based on the first target classifier and the first target bounding box regressor, perform object / background classification processing and target bounding box regression processing on the second convolutional feature image to obtain the first recognition result.

[0065] The first recognition result is better than the initial recognition result in recognizing the object to be identified.

[0066] In this embodiment, the process of processing the second convolutional feature image is the first recognition stage. This recognition stage mainly learns the coarse-grained embedding vector in the convolutional feature image, and then performs object / background classification processing and object bounding box regression processing on the coarse-grained embedding vector according to the first target classifier and the first target bounding box regressor to obtain the first recognition result.

[0067] Step 305: Perform matching processing on the first recognition result and the second convolutional feature image to obtain the third convolutional feature image.

[0068] In this embodiment, the first recognition result is matched to the second convolutional feature image through the RolAlign operation to obtain the third convolutional feature image, thereby enabling the subsequent second-stage recognition processing of the third convolutional feature image to refine the coarse-grained embedding vector.

[0069] Step 306: Based on the second target classifier, the third target bounding box regressor, and the second category recognizer, the third convolutional feature image is subjected to object / background classification processing, target bounding box regression processing, and object category recognition processing to obtain the third recognition result.

[0070] The third recognition result represents the location recognition, category recognition, and classification of the object to be recognized / background in the image to be recognized.

[0071] In this embodiment, the process of processing the third convolutional feature image is the second recognition stage. This recognition stage mainly learns the medium-granularity embedding vector in the convolutional feature image. Then, based on the second target classifier, the third target box regressor, and the second category recognizer, the medium-granularity embedding vector is subjected to object / background classification processing, target box regression processing, and object category recognition processing to obtain the third recognition result.

[0072] Since the first recognition stage focuses on the classification of people / backgrounds, the second recognition stage added in this embodiment continues to classify people / backgrounds and simultaneously performs category recognition, i.e., the recognition of people's identities, thereby further improving the accuracy of both the recognition of people / backgrounds and the recognition of people's identities.

[0073] Step 307: Perform matching processing on the third recognition result and the third convolutional feature image to obtain the matched third convolutional feature image.

[0074] Similarly, in this embodiment, the third recognition result is matched to the third convolutional feature image through the RolAlign operation to obtain the matched third convolutional feature image, which enables the subsequent third stage of recognition processing on the matched third convolutional feature image to refine the medium-granularity embedding vector.

[0075] Step 308: Based on the second bounding box regressor and the first category recognizer, the bounding box regression processing and category recognition processing of the object to be recognized are performed on the third convolutional feature image after the matching processing to obtain the object recognition result.

[0076] The recognition effect corresponding to the third recognition result is better than the recognition effect of the first recognition result, but worse than the recognition effect of the target recognition result.

[0077] In this embodiment, the process of processing the third convolutional feature image after matching is the third recognition stage. This recognition stage mainly learns the fine-grained embedding vector in the convolutional feature image, and then performs target box regression processing and target category recognition processing on the fine-grained embedding vector according to the second target box regressor and the first category recognizer, so as to obtain a more accurate target recognition result.

[0078] Specifically, for a better explanation of the object recognition method with three recognition stages provided in this embodiment, please refer to [link to relevant documentation]. Figure 4 , Figure 4 This is a flowchart illustrating an image recognition method with three recognition stages provided in an embodiment of the present invention, as shown below. Figure 4As shown, the second recognition model provided in this embodiment includes three cascaded attention encoders, each representing a recognition stage. Specifically, firstly, the image to be recognized X is input into a feature extraction network to extract a convolutional feature image X1 of the image to be recognized. Then, the extracted convolutional feature image X1 is input into an RPN network to obtain the feature image of the person bounding box and the initial recognition result of the classification result of the convolutional feature image X1. Next, the obtained feature image of the person bounding box is matched to the convolutional feature image X1 using the RolAlign operation. Then, the matched feature image (denoted as the first-stage matched feature map) is input into the cascaded attention encoder of the first recognition stage for encoding processing of the first recognition stage, to obtain a coarse-grained embedding vector for person detection. Then, the obtained coarse-grained embedding vector is fed into a person / background classifier and a person bounding box regressor. The result is then matched to the convolutional feature map X1 again using the RolAlign operation to update the prediction result. The updated matching feature image (denoted as the second-stage matching feature map) is then input into the cascaded attention encoder in the second recognition stage to learn medium-granularity embedding vectors for person detection and person identification. The cascading process primarily aims to progressively refine the granularity by updating the feature map from the first stage and then performing a similar operation in the second stage. Therefore, the operations in the second stage are identical to those in the first stage, resulting in medium-granularity embedding vectors. These medium-granularity embedding vectors are then fed into a person / background classifier, a person bounding box regressor, and a person identification detector. Unlike the first stage, the second stage adds a person identification detector because it was intentionally removed in the first stage, allowing the network to focus on detecting all people in the scene before refining the representation. The resulting image is then matched to the convolutional feature map X1 using the RolAlign operation to update the prediction results. Then, the updated prediction matching feature image (denoted as the third-stage matching feature map) is input into the cascaded attention encoder of the third recognition stage for the same operation to obtain the final fine-grained embedding vector. This fine-grained embedding vector is then fed into the person bounding box regressor and the person identity recognizer to obtain the final person recognition result. It should be noted that the person / background classifier is removed in the third stage. This is because it is assumed that the network, after refinement, already possesses the ability to classify people and backgrounds, and the network primarily focuses on the person identity recognition task in the third stage, thereby improving the recognition accuracy of the person search algorithm.

[0079] In summary, this invention provides an image recognition method. The method includes extracting features from an image to be recognized to obtain a first convolutional feature image; processing the first convolutional feature image using a first recognition model to obtain an initial recognition result; the initial recognition result characterizes the location and category of the object to be recognized in the image; and based on the initial recognition result, performing multiple recognition processes on the first convolutional feature image to obtain a target recognition result. Using this invention improves the recognition accuracy of end-to-end person search algorithms.

[0080] Based on the method described in the above embodiments, this embodiment will be further described from the perspective of an image recognition device. The image recognition device can be implemented as an independent entity or integrated into an electronic device, such as a terminal, which may include mobile phones, tablets, etc.

[0081] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an image recognition device provided in an embodiment of the present invention, such as... Figure 5 As shown, the image recognition device 500 provided in this embodiment of the invention includes:

[0082] The feature extraction module 501 is used to extract features from the image to be recognized to obtain the first convolutional feature image.

[0083] The first recognition module 502 is used to perform recognition processing on the first convolutional feature image using a first recognition model to obtain an initial recognition result.

[0084] The initial recognition result represents the location and category recognition of the object to be recognized in the image to be recognized.

[0085] The second recognition module 503 is used to perform multiple recognition processes on the first convolutional feature image based on the initial recognition result to obtain the target recognition result.

[0086] In this embodiment, the second recognition module 503 is specifically used for: matching the initial recognition result and the first convolutional feature image to obtain a second convolutional feature image; using a second recognition model to perform recognition processing on the second convolutional feature image to obtain a first recognition result; the first recognition result has a better recognition effect on the object to be recognized than the initial recognition result; matching the first recognition result and the second convolutional feature image to obtain a third convolutional feature image; and using the second recognition model to perform recognition processing on the third convolutional feature image to obtain a target recognition result.

[0087] In some embodiments, the second recognition model includes a first object classifier and a first bounding box regressor. The second recognition module 503 is further configured to: perform object / background classification processing and bounding box regression processing on the second convolutional feature image based on the first object classifier and the first bounding box regressor, to obtain a first recognition result.

[0088] In other embodiments, the second recognition model includes a second bounding box regressor and a first category recognizer. The second recognition module 503 is further configured to: perform bounding box regression processing and category recognition processing on the third convolutional feature image based on the second bounding box regressor and the first category recognizer, to obtain a target recognition result.

[0089] As an optional embodiment, the second recognition model further includes a second object classifier, a third object bounding box regressor, and a second category recognizer. Specifically, the second recognition module 503 is further configured to: perform object / background classification processing, object bounding box regression processing, and object category recognition processing on the third convolutional feature image based on the second object classifier, the third object bounding box regressor, and the second category recognizer, to obtain a third recognition result; the third recognition result characterizes the location recognition, category recognition, and object / background classification of the object to be recognized in the image to be recognized; and perform matching processing on the third recognition result and the third convolutional feature image to obtain a matched third convolutional feature image.

[0090] As an optional embodiment, the second recognition model further includes an attention mechanism encoding layer. The second recognition module 503 is specifically used for: performing multi-scale convolution processing on the second convolutional feature image to obtain multiple convolutional feature images at different scales; performing block processing on the convolutional feature image at each scale to obtain multiple blocks corresponding to the convolutional feature image at each scale, and determining the target block containing the object to be recognized from the multiple blocks; performing swap processing on the target blocks at the target position in the convolutional feature image at each scale to obtain the swapped convolutional feature image at each scale; performing compression processing on the swapped convolutional feature image at each scale to obtain a one-dimensional feature vector corresponding to each scale; inputting the one-dimensional feature vector corresponding to each scale into the attention mechanism encoding layer for encoding processing to obtain the embedding vector corresponding to the second convolutional feature image; and performing object / background classification processing and object bounding box regression processing on the embedding vector based on the first target classifier and the first target box regressor to obtain a first recognition result.

[0091] Specifically, the second recognition module 503 is further configured to: distribute the feature image containing the object to be recognized in the second convolutional feature image evenly to multiple channels of the attention mechanism coding layer; and perform convolution processing on the feature image at a corresponding scale through each channel of the attention mechanism coding layer to obtain multiple convolutional feature images at different scales, each channel containing a different convolution kernel.

[0092] Optionally, the loss function L used by the preset object recognition model during training is:

[0093]

[0094] Among them, L det The loss function L is used when identifying the object to be identified. OIM To match the loss function for online instances, L ID Let t represent the loss function for classifying the object to be identified, where t represents the loss when the identification result is obtained for the tth time, T is the total number of identification results obtained, and the coefficient α is the loss function for classifying the object to be identified. OIM and β ID I(t>1) is an indicator function used to balance the two loss terms for classifying the object to be identified. It represents the loss generated by the classifying process of the object to be identified when the identification result is obtained for the first time, without considering the loss generated by the first classifying process.

[0095] In specific implementation, the above modules and / or units can be implemented as independent entities, or they can be arbitrarily combined and implemented as the same or several entities. For the specific implementation of the above modules and / or units, please refer to the previous method embodiments. For the specific beneficial effects that can be achieved, please also refer to the beneficial effects in the previous method embodiments, which will not be repeated here.

[0096] Additionally, please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device can be a mobile terminal such as a smartphone, tablet computer, or other similar device. Figure 6 As shown, the electronic device 600 includes a processor 601 and a memory 602. The processor 601 and the memory 602 are electrically connected.

[0097] The processor 601 is the control center of the electronic device 600. It connects various parts of the electronic device through various interfaces and lines. By running or loading the application program stored in the memory 602 and calling the data stored in the memory 602, it performs various functions of the electronic device 600 and processes data, thereby monitoring the electronic device 600 as a whole.

[0098] In this embodiment, the processor 601 in the electronic device 600 loads the instructions corresponding to the processes of one or more applications into the memory 602 according to the following steps, and the processor 601 runs the applications stored in the memory 602 to realize various functions.

[0099] The electronic device 600 can implement the steps of any embodiment of the image recognition method provided in the embodiments of the present invention. Therefore, it can achieve the beneficial effects that any image recognition method provided in the embodiments of the present invention can achieve. For details, please refer to the previous embodiments, which will not be repeated here.

[0100] Please see Figure 7 , Figure 7 This is another structural schematic diagram of the electronic device provided in the embodiments of the present invention, such as... Figure 7 As shown, Figure 7 A specific structural block diagram of an electronic device provided in an embodiment of the present invention is shown. This electronic device can be used to implement the image recognition method provided in the above embodiments. The electronic device 700 can be a mobile terminal such as a smartphone or a laptop computer.

[0101] RF circuit 710 is used to receive and transmit electromagnetic waves, converting electromagnetic waves into electrical signals and vice versa, thereby enabling communication with communication networks or other devices. RF circuit 710 may include various existing circuit elements used to perform these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, Subscriber Identity Module (SIM) cards, memory, etc. RF circuit 710 can communicate with various networks such as the Internet, corporate intranets, and wireless networks, or communicate with other devices via wireless networks. The aforementioned wireless networks may include cellular telephone networks, wireless local area networks (WLANs), or metropolitan area networks (MANs). The aforementioned wireless networks may use various communication standards, protocols, and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (WCDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wi-Fi) (such as IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, and / or IEEE 802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access (Wi-Max), other protocols for email, instant messaging, and short messages, and any other suitable communication protocols, including those that have not yet been developed.

[0102] The memory 720 can be used to store software programs and modules, such as the program instructions / modules corresponding to the image recognition method in the above embodiment. The processor 780 executes various functional applications and object recognition by running the software programs and modules stored in the memory 720.

[0103] Memory 720 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, memory 720 may further include memory remotely located relative to processor 780, which can be connected to electronic device 700 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0104] The input unit 730 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, the input unit 730 may include a touch-sensitive surface 731 and other input devices 732. The touch-sensitive surface 731, also known as a touch display screen or touchpad, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch-sensitive surface 731), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface 731 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 780, and can receive and execute commands sent by the processor 780. In addition, the touch-sensitive surface 731 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 731, the input unit 730 may also include other input devices 732. Specifically, other input devices 732 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0105] Display unit 740 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of electronic device 700. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 740 may include display panel 741, optionally configured as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or other similar forms. Further, touch-sensitive surface 731 may cover display panel 741. When touch-sensitive surface 731 detects a touch operation on or near it, it transmits the information to processor 780 to determine the type of touch event. Subsequently, processor 780 provides corresponding visual output on display panel 741 according to the type of touch event. Although in the figures, touch-sensitive surface 731 and display panel 741 are implemented as two separate components to achieve input and output functions, in some embodiments, touch-sensitive surface 731 and display panel 741 can be integrated to achieve input and output functions.

[0106] The electronic device 700 may also include at least one sensor 750, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 741 according to the ambient light level, and the proximity sensor can generate an interruption when the flip is closed or shut down. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the electronic device 700, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0107] Audio circuitry 760, speaker 761, and microphone 762 provide an audio interface between the user and electronic device 700. Audio circuitry 760 converts received audio data into electrical signals and transmits them to speaker 761, where speaker 761 converts them into sound signals for output. Conversely, microphone 762 converts collected sound signals into electrical signals, which are then received by audio circuitry 760, converted back into audio data, and processed by processor 780. The audio data is then transmitted via RF circuitry 710 to, for example, another terminal, or output to memory 720 for further processing. Audio circuitry 760 may also include an earphone jack to facilitate communication between peripheral headphones and electronic device 700.

[0108] Electronic device 700, through transmission module 770 (e.g., Wi-Fi module), can help users receive requests, send information, etc., providing users with wireless broadband internet access. Although transmission module 770 is shown in the figure, it is understood that it is not an essential component of electronic device 700 and can be omitted as needed without changing the essence of the invention.

[0109] The processor 780 is the control center of the electronic device 700. It connects to various parts of the phone via various interfaces and lines, and performs various functions and processes data of the electronic device 700 by running or executing software programs and / or modules stored in the memory 720, and by calling data stored in the memory 720, thereby providing overall monitoring of the electronic device. Optionally, the processor 780 may include one or more processing cores; in some embodiments, the processor 780 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 780.

[0110] The electronic device 700 also includes a power supply 790 (such as a battery) that supplies power to various components. In some embodiments, the power supply may be logically connected to the processor 780 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. The power supply 790 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0111] Although not shown, the electronic device 700 also includes cameras (such as front-facing cameras and rear-facing cameras), Bluetooth modules, etc., which will not be described in detail here. Specifically, in this embodiment, the display unit of the electronic device is a touch screen display, and the mobile terminal also includes a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors. One or more programs contain instructions for performing operations.

[0112] In practice, the above modules can be implemented as independent entities or combined in any way to be implemented as the same or several entities. For the specific implementation of the above modules, please refer to the previous method implementation examples, which will not be repeated here.

[0113] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, embodiments of the present invention provide a storage medium storing multiple instructions that can be loaded by a processor to execute the steps of any embodiment of the image recognition method provided by the present invention.

[0114] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0115] Since the instructions stored in the storage medium can execute the steps in any embodiment of the image recognition method provided in the embodiments of the present invention, the beneficial effects that any image recognition method provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0116] The foregoing has provided a detailed description of an image recognition method, apparatus, electronic device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application. Moreover, those skilled in the art can make several improvements and modifications without departing from the principles of this invention, and these improvements and modifications are also considered to be within the scope of protection of this invention.

Claims

1. An image recognition method, characterized in that, include: Feature extraction is performed on the image to be recognized to obtain the first convolutional feature image; The first recognition model is used to process the first convolutional feature image to obtain an initial recognition result; The initial recognition result represents the location and category recognition of the object to be identified in the image to be identified; Based on the initial recognition result, the first convolutional feature image is subjected to multiple recognition processes to obtain the target recognition result; The step of performing multiple recognition processes on the first convolutional feature image based on the initial recognition result to obtain a target recognition result includes: matching the initial recognition result and the first convolutional feature image to obtain a second convolutional feature image; using a second recognition model to perform recognition processing on the second convolutional feature image to obtain a first recognition result; the first recognition result has a better recognition effect on the object to be recognized than the initial recognition result; matching the first recognition result and the second convolutional feature image to obtain a third convolutional feature image; and using the second recognition model to perform recognition processing on the third convolutional feature image to obtain a target recognition result. The second recognition model includes three cascaded attention encoders. The second convolutional feature image is input into the attention encoder of the first recognition stage. The coarse-grained embedding vector output by the attention encoder of the first recognition stage is fed into the object / background classifier and the object bounding box regressor. The result is used to update the prediction result, resulting in a second-stage matching feature map. The second-stage matching feature map is input into the attention encoder of the second recognition stage. The medium-grained embedding vector output by the attention encoder of the second recognition stage is fed into the object / background classifier, the object bounding box regressor, and the object identity recognizer. The result is used to update the prediction result, resulting in a third-stage matching feature map. The third-stage matching feature map is input into the attention encoder of the third recognition stage. The fine-grained embedding vector output by the attention encoder of the third recognition stage is fed into the object bounding box regressor and the object identity recognizer to obtain the target recognition result.

2. The image recognition method as described in claim 1, characterized in that, The second recognition model includes a first target classifier, a first target bounding box regressor, a second target bounding box regressor, and a first category recognizer; The step of using the second recognition model to perform recognition processing on the second convolutional feature image to obtain the first recognition result includes: Based on the first target classifier and the first target bounding box regressor, the second convolutional feature image is subjected to object / background classification processing and target bounding box regression processing to obtain the first recognition result; The step of using the second recognition model to perform recognition processing on the third convolutional feature image to obtain the target recognition result includes: Based on the second bounding box regressor and the first category recognizer, the third convolutional feature image is subjected to bounding box regression processing and category recognition processing of the object to be recognized, so as to obtain the object recognition result.

3. The image recognition method as described in claim 2, characterized in that, The second recognition model also includes a second object classifier, a third object box regressor, and a second category recognizer; Before performing recognition processing on the third convolutional feature image using the second recognition model to obtain the target recognition result, the image recognition method further includes: Based on the second target classifier, the third target bounding box regressor, and the second category recognizer, the third convolutional feature image is subjected to object / background classification processing, object bounding box regression processing, and object category recognition processing to obtain a third recognition result; the third recognition result represents the location recognition, category recognition, and object / background classification of the object to be recognized in the image to be recognized. The third recognition result and the third convolutional feature image are matched to obtain the third convolutional feature image after matching. The recognition effect corresponding to the third recognition result is better than the recognition effect of the first recognition result, but worse than the recognition effect of the target recognition result.

4. The image recognition method as described in claim 2, characterized in that, The second recognition model further includes an attention mechanism encoding layer; the step of performing object / background classification processing and object bounding box regression processing on the second convolutional feature image based on the first target classifier and the first target bounding box regressor to obtain the first recognition result includes: The second convolutional feature image is subjected to multi-scale convolution processing to obtain multiple convolutional feature images at different scales; The convolutional feature image at each scale is segmented to obtain multiple segments corresponding to the convolutional feature image at each scale, and the target segment containing the object to be identified is determined from the multiple segments. The target blocks at the target locations in the convolutional feature images at each scale are swapped to obtain the swapped convolutional feature images at each scale. The convolutional feature images after swapping at each scale are compressed to obtain a one-dimensional feature vector corresponding to each scale. The one-dimensional feature vector corresponding to each scale is input into the attention mechanism encoding layer for encoding processing to obtain the embedding vector corresponding to the second convolutional feature image; Based on the first target classifier and the first target bounding box regressor, the embedding vector is subjected to object / background classification processing and object bounding box regression processing to obtain the first recognition result.

5. The image recognition method as described in claim 4, characterized in that, The process of performing multi-scale convolution on the second convolutional feature image to obtain multiple convolutional feature images at different scales includes: The feature images containing the object to be identified in the second convolutional feature image are evenly distributed to multiple channels of the attention mechanism coding layer; Through each channel of the attention mechanism encoding layer, the feature image is convolved at a corresponding scale to obtain multiple convolutional feature images at different scales, and each channel contains a different convolution kernel.

6. The image recognition method as described in claim 1, characterized in that, The loss function L used by the second recognition model during training is: L= ; in, The loss function used when identifying the object to be identified. Match loss functions to online instances. Let t represent the loss function for classifying the object to be identified, where t represents the loss when the identification result is obtained for the tth time, T is the total number of identification results obtained, and the coefficients are... and I(t>1) is an indicator function used to balance the two loss terms for classifying the object to be identified. It represents the loss generated by the classifying process of the object to be identified when the identification result is obtained for the first time, without considering the loss generated by the first classifying process.

7. An image recognition device, characterized in that, include: The feature extraction module is used to extract features from the image to be recognized to obtain the first convolutional feature image; The first recognition module is used to process the first convolutional feature image using a first recognition model to obtain an initial recognition result; the initial recognition result represents the location recognition and category recognition of the object to be recognized in the image to be recognized. The second recognition module is used to perform multiple recognition processes on the first convolutional feature image based on the initial recognition result to obtain the target recognition result; The second recognition module, based on the initial recognition result, performs multiple recognition processes on the first convolutional feature image to obtain a target recognition result, including: matching the initial recognition result and the first convolutional feature image to obtain a second convolutional feature image; using a second recognition model to perform recognition processing on the second convolutional feature image to obtain a first recognition result; the first recognition result has a better recognition effect on the object to be recognized than the initial recognition result; matching the first recognition result and the second convolutional feature image to obtain a third convolutional feature image; and using the second recognition model to perform recognition processing on the third convolutional feature image to obtain a target recognition result. The second recognition model includes three cascaded attention encoders. The second convolutional feature image is input into the attention encoder of the first recognition stage. The coarse-grained embedding vector output by the attention encoder of the first recognition stage is fed into the object / background classifier and the object bounding box regressor. The result is used to update the prediction result, resulting in a second-stage matching feature map. The second-stage matching feature map is input into the attention encoder of the second recognition stage. The medium-grained embedding vector output by the attention encoder of the second recognition stage is fed into the object / background classifier, the object bounding box regressor, and the object identity recognizer. The result is used to update the prediction result, resulting in a third-stage matching feature map. The third-stage matching feature map is input into the attention encoder of the third recognition stage. The fine-grained embedding vector output by the attention encoder of the third recognition stage is fed into the object bounding box regressor and the object identity recognizer to obtain the target recognition result.

8. An electronic device, characterized in that, The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the image recognition method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the image recognition method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Target detection method, target detection model and target detection system based on cascade detector

    CN109886286A

  • Image recognition method, intelligent terminal and storage medium

    CN112036455A