Image recognition method, device, equipment and storage medium

By performing initial semantic recognition on images, adjusting target semantic features and combining historical image correlations, using the attention mechanism and multiple target network processing, the problem of low image recognition accuracy is solved and the accuracy of target semantic recognition is improved.

CN112069892BActive Publication Date: 2024-09-10TSINGHUA UNIVERSITY +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010766862.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-03
Publication Date
2024-09-10
Estimated Expiration
2040-08-03

AI Technical Summary

Technical Problem

The accuracy of image recognition in the prior art is low, especially when identifying whether the image contains target semantics. Recognition errors often occur because the characteristics of the target object do not fully reflect the target semantics.

Method used

By performing initial semantic recognition of the image to be recognized, the target semantic features are obtained, and adjusted based on non-target semantic features. Combined with the preset historical image recognition semantic features and the correlation degree of the image type, the probability parameters of the target semantics in the image are estimated. The attention mechanism and multiple target networks are used to weight the target semantic features and integrate the processing to improve the recognition accuracy.

Benefits of technology

It significantly improves the recognition accuracy of target semantics in images, takes into account the relationship between target semantic features and non-target semantic features, and enhances the accuracy of probability parameter estimation for images containing target semantics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112069892B
    Figure CN112069892B
Patent Text Reader

Abstract

The present disclosure provides an image recognition method, device, equipment and storage medium, which relates to the field of computer technology and is used to improve the recognition accuracy of images. The method includes: recognizing an image to be recognized to obtain image semantic features; obtaining target semantic features from the image semantic features, the target semantic features including features for target semantics in the image semantic features; adjusting the target semantic features based on the impact value of non-target semantic features in the image semantic features on the target semantic features; obtaining recognition semantic features based on the adjusted target semantic features; using the recognition semantic features of preset historical images and the first correlation degree of the image type, estimating the probability parameter that the image to be recognized contains the target semantics, the image type is determined according to whether the historical image contains the target semantics; in this method, the image is recognized based on the correlation between the image semantic features and the target semantic features, thereby improving the accuracy of recognizing the target semantics in the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to an image recognition method, device, equipment and storage medium. Background Art

[0002] In the related art, when identifying whether an image contains target semantics (such as a person or object with a specified identity), the target object (such as a person or object) in the image that may be the target semantics is often identified through the features of the target object (such as each person or object), and then based on the features of the target object, the result of whether the image contains the target semantics is identified, that is, the specific features of the target object in the image are used to identify whether the target object belongs to the target semantics, but the target object in the image that belongs to the target semantics does not necessarily include the above-mentioned specific features; if the target semantics in an image does not include the above-mentioned specific features, the recognition result of the image is that it does not contain the target semantics (recognition error), that is, the accuracy of identifying whether the image contains the target semantics based on the features of the target object in the image is low. Therefore, how to improve the recognition accuracy of the target semantics in the image becomes a problem that needs to be considered. Summary of the invention

[0003] The embodiments of the present disclosure provide an image recognition method, apparatus, device and storage medium for improving the recognition accuracy of an image.

[0004] In a first aspect, the present disclosure provides an image recognition method, comprising:

[0005] Performing initial semantic recognition on the image to be recognized to obtain image semantic features; and obtaining target semantic features from the image semantic features, wherein the target semantic features include features for target semantics in the image semantic features;

[0006] adjusting the target semantic feature based on an influence value of a non-target semantic feature on the target semantic feature, wherein the non-target semantic feature includes semantic features other than the target semantic feature in the image semantic features; and

[0007] Based on the adjusted target semantic features, obtaining recognition semantic features for the target semantics in the image to be recognized;

[0008] By using the first correlation between the recognition semantic features of the preset historical images and the image type, the second correlation between the recognition semantic features of the image to be recognized and the image type is estimated, and the estimated second correlation is converted into a probability parameter that the image to be recognized contains the target semantics, wherein the image type is determined based on whether the historical image contains the target semantics.

[0009] In a possible implementation, the image to be identified includes a video frame in a video to be identified, and after the step of converting the estimated second association degree into a probability parameter that the image to be identified includes the target semantics, the following step further includes:

[0010] The maximum value of the probability parameter that the video frames in the to-be-recognized video contain the target semantics is determined as the probability parameter that the to-be-recognized video contains the target semantics.

[0011] In a possible implementation, the step of obtaining a recognition semantic feature for the target semantics in the image to be recognized based on the adjusted target semantic feature includes:

[0012] Determine the adjusted target semantic feature as a recognition semantic feature for the target semantics in the image to be recognized; or

[0013] The adjusted target semantic features and the image semantic features are integrated to obtain recognition semantic features for the target semantics in the image to be recognized.

[0014] In a possible implementation, the step of adjusting the target semantic feature based on the impact value of the non-target semantic feature on the target semantic feature includes:

[0015] Through each conversion unit in the target network, the target semantic features are adjusted by performing the following steps:

[0016] Determine the influence value of each non-target semantic feature on the target semantic feature through an attention mechanism;

[0017] Using the influence values ​​of the non-target semantic features on the target semantic feature, weighted summing processing is performed on the non-target semantic features to obtain a weighted semantic feature;

[0018] The weighted semantic features and the target semantic features are integrated to obtain

[0019] The adjusted target semantic features corresponding to the image to be recognized;

[0020] Wherein, the target network includes at least one conversion unit. If the target network includes multiple conversion units connected in series, the target semantic vector used by the i-th conversion unit is the adjusted target semantic feature obtained by the i-1-th conversion unit; the adjusted target semantic feature corresponding to the image to be identified is the adjusted target semantic feature obtained by the last conversion unit among the multiple conversion units, and i is an integer greater than 1.

[0021] In a possible implementation, the step of determining the influence value of each non-target semantic feature on the target semantic feature through an attention mechanism includes:

[0022] The result of performing a dot product of the semantic weight vector of each non-target semantic feature and the target semantic vector of the target semantic feature is determined as the influence value of each non-target semantic feature on the target semantic feature;

[0023] The step of performing weighted sum processing on each non-target semantic feature by using the influence value of each non-target semantic feature on the target semantic feature to obtain a weighted semantic feature comprises:

[0024] By using the influence values ​​of the non-target semantic features on the target semantic feature, a weighted sum process is performed on the semantic feature vectors of the non-target semantic features to obtain a weighted semantic feature.

[0025] In a possible implementation, before the step of determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the step further includes:

[0026] The target semantic feature is processed by a first basic neural network to obtain the target semantic vector used in a first conversion unit, wherein the first basic neural network includes a convolution layer with a first set convolution kernel size.

[0027] In a possible implementation, before the step of determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the step further includes:

[0028] The semantic feature map is processed by the second basic neural network to obtain the semantic weight vector and the semantic feature vector of each non-target semantic feature used in each conversion unit in the one target network; the semantic feature map corresponds to the image semantic feature and the semantic feature map is obtained by processing the image to be identified by the third basic neural network; wherein:

[0029] The second basic neural network includes a convolution layer with a second set convolution kernel size; and the third basic neural network includes a convolution layer with a third set convolution kernel size.

[0030] In a possible implementation, the target network includes a plurality of network elements, and the step of adjusting the target semantic feature based on the influence value of the non-target semantic feature on the target semantic feature includes:

[0031] Through multiple target networks respectively, based on the influence value of the non-target semantic feature on the target semantic feature, the target semantic feature is adjusted to obtain the adjusted target semantic feature corresponding to each target network; and the adjusted target semantic feature corresponding to each target network is integrated to obtain the adjusted target semantic feature corresponding to the image to be identified.

[0032] In a possible implementation, the step of performing initial semantic recognition on the image to be recognized to obtain the semantic features of the image includes:

[0033] Performing initial semantic recognition on the image to be processed by using a fourth basic neural network to obtain image semantic features of the image to be recognized, wherein the fourth basic neural network includes a convolution layer with a fourth set convolution kernel size;

[0034] The step of acquiring target semantic features from the image semantic features comprises:

[0035] Using a target object detection network, obtaining position information of a target object in the to-be-identified image, wherein the target object includes an object corresponding to the target semantics;

[0036] From the image semantic features, a semantic feature corresponding to the position information of the target object is obtained as the target semantic feature.

[0037] In a possible implementation, the step of estimating a second degree of association between the recognition semantic feature of the image to be recognized and the image type by using the first degree of association between the recognition semantic feature of the preset historical image and the image type, and converting the estimated second degree of association into a probability parameter that the image to be recognized contains the target semantics includes:

[0038] A trained classifier model is used, the recognition semantic features of the image to be recognized are input, and the probability parameters of the image to be recognized output by the classifier model are obtained, that is, the probability parameters that the image to be recognized contains the target semantics. The classifier model is based on a machine learning method, and is trained using the recognition semantic features of each historical image and the image type of each historical image as training samples.

[0039] According to a second aspect of the present disclosure, there is provided an image recognition device, comprising:

[0040] A feature extraction unit is configured to perform initial semantic recognition on the image to be recognized to obtain image semantic features; and obtain target semantic features from the image semantic features, wherein the target semantic features include features for target semantics in the image semantic features;

[0041] A first feature processing unit is configured to adjust the target semantic feature based on an influence value of a non-target semantic feature on the target semantic feature, wherein the non-target semantic feature includes a semantic feature other than the target semantic feature in the image semantic feature; and

[0042] A second feature processing unit is configured to obtain a recognition semantic feature for the target semantics in the image to be recognized based on the adjusted target semantic feature;

[0043] The image recognition unit is configured to execute a first correlation between the recognition semantic features of preset historical images and the image type, estimate a second correlation between the recognition semantic features of the image to be recognized and the image type, and convert the estimated second correlation into a probability parameter that the image to be recognized contains the target semantics, wherein the image type is determined based on whether the historical image contains the target semantics.

[0044] In a possible implementation, the image to be recognized includes a video frame in a video to be recognized, and the image recognition unit is further configured to execute:

[0045] After converting the estimated second association degree into a probability parameter that the image to be identified contains the target semantics, the maximum value of the probability parameter that the video frames in the video to be identified contain the target semantics is determined as the probability parameter that the video to be identified contains the target semantics.

[0046] In a possible implementation manner, the second feature processing unit is specifically configured to execute:

[0047] Determine the adjusted target semantic feature as a recognition semantic feature for the target semantics in the image to be recognized; or

[0048] The adjusted target semantic features and the image semantic features are integrated to obtain recognition semantic features for the target semantics in the image to be recognized.

[0049] In a possible implementation, the first feature processing unit is specifically configured to execute:

[0050] Through each conversion unit in the target network, the target semantic features are adjusted by performing the following steps:

[0051] Determine the influence value of each non-target semantic feature on the target semantic feature through an attention mechanism;

[0052] Using the influence values ​​of the non-target semantic features on the target semantic feature, weighted summing processing is performed on the non-target semantic features to obtain a weighted semantic feature;

[0053] The weighted semantic features and the target semantic features are integrated to obtain

[0054] The adjusted target semantic features corresponding to the image to be recognized;

[0055] Wherein, the target network includes at least one conversion unit. If the target network includes multiple conversion units connected in series, the target semantic vector used by the i-th conversion unit is the adjusted target semantic feature obtained by the i-1-th conversion unit; the adjusted target semantic feature corresponding to the image to be identified is the adjusted target semantic feature obtained by the last conversion unit among the multiple conversion units, and i is an integer greater than 1.

[0056] In a possible implementation, the first feature processing unit is specifically configured to execute:

[0057] The result of performing a dot product of the semantic weight vector of each non-target semantic feature and the target semantic vector of the target semantic feature is determined as the influence value of each non-target semantic feature on the target semantic feature;

[0058] The step of performing weighted sum processing on each non-target semantic feature by using the influence value of each non-target semantic feature on the target semantic feature to obtain a weighted semantic feature comprises:

[0059] By using the influence values ​​of the non-target semantic features on the target semantic feature, a weighted sum process is performed on the semantic feature vectors of the non-target semantic features to obtain a weighted semantic feature.

[0060] In a possible implementation, the first feature processing unit is further configured to execute:

[0061] Before determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the target semantic feature is processed through a first basic neural network to obtain the target semantic vector used in the first conversion unit, and the first basic neural network includes a convolution layer with a first set convolution kernel size.

[0062] In a possible implementation, the first feature processing unit is further configured to execute:

[0063] Before determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the semantic feature map is processed by the second basic neural network to obtain the semantic weight vector and semantic feature vector of each non-target semantic feature used in each conversion unit in the one target network; the semantic feature map corresponds to the image semantic feature and the semantic feature map is obtained by processing the image to be identified through the third basic neural network; wherein:

[0064] The second basic neural network includes a convolution layer with a second set convolution kernel size; and the third basic neural network includes a convolution layer with a third set convolution kernel size.

[0065] In a possible implementation manner, the target network includes multiple networks, and the first feature processing unit is specifically configured to execute:

[0066] Through multiple target networks respectively, based on the influence value of the non-target semantic feature on the target semantic feature, the target semantic feature is adjusted to obtain the adjusted target semantic feature corresponding to each target network; and the adjusted target semantic feature corresponding to each target network is integrated to obtain the adjusted target semantic feature corresponding to the image to be identified.

[0067] In a possible implementation, the feature extraction unit is specifically configured to perform:

[0068] Performing initial semantic recognition on the image to be processed by using a fourth basic neural network to obtain image semantic features of the image to be recognized, wherein the fourth basic neural network includes a convolution layer with a fourth set convolution kernel size;

[0069] Using a target object detection network, obtaining position information of a target object in the to-be-identified image, wherein the target object includes an object corresponding to the target semantics;

[0070] From the image semantic features, a semantic feature corresponding to the position information of the target object is obtained as the target semantic feature.

[0071] In a possible implementation, the image recognition unit is specifically configured to execute:

[0072] A trained classifier model is used, the recognition semantic features of the image to be recognized are input, and the probability parameters of the image to be recognized output by the classifier model are obtained, that is, the probability parameters that the image to be recognized contains the target semantics. The classifier model is based on a machine learning method, and is trained using the recognition semantic features of each historical image and the image type of each historical image as training samples.

[0073] In one possible implementation, the image to be identified includes video frames in a video to be identified, and the classifier model is trained through a multi-instance learning method, using the recognition semantic features of the video frames in each historical video and the video type of each historical video as training samples. The video type is determined based on whether each historical video contains a target frame, and the target frame includes a video frame containing the target semantics.

[0074] According to a third aspect of the present disclosure, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the first aspect and any one of the possible implementation modes is implemented.

[0075] In a fourth aspect of the present disclosure, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various possible implementations of the first aspect above.

[0076] In a fifth aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect and any one of the possible implementations.

[0077] The solution disclosed herein brings at least the following beneficial effects:

[0078] In the method provided by the present invention, the target semantic features are adjusted based on the influence values ​​of non-target semantic features on the target semantic features, and then the probability parameters of the target semantics contained in the image to be identified are estimated according to the adjusted target semantic features; that is, according to the relationship between the non-target semantic features and the target semantic features in the image to be identified, the parameter probability of the target semantics contained in the image to be identified is estimated, which takes into account both the target semantic features and the influence of the non-target semantic features on the target semantics, thereby improving the recognition accuracy of the target semantics in the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0080] Figure 1 A schematic diagram of an image recognition process provided for an exemplary embodiment of the present disclosure;

[0081] Figure 2A schematic diagram of adjusting target semantic features through multiple target networks provided by an exemplary embodiment of the present disclosure;

[0082] Figure 3 A schematic diagram of a process of adjusting a target semantic feature by using a conversion unit provided by an exemplary embodiment of the present disclosure;

[0083] Figure 4 A schematic diagram of the relationship between multiple conversion units in a target network provided by an exemplary embodiment of the present disclosure;

[0084] Figure 5 A schematic diagram of an adjustment process of adjusting target semantics of multiple conversion units provided by an exemplary embodiment of the present disclosure;

[0085] Figure 6 A schematic diagram of a training architecture for a classifier model based on multi-instance learning provided for an exemplary embodiment of the present disclosure;

[0086] Figure 7 A schematic diagram of a method for estimating the probability value of a video to be identified containing target semantics by a classifier model provided for an exemplary embodiment of the present disclosure is a principle diagram;

[0087] Figure 8 A schematic diagram of a neural network structure for video recognition provided by an exemplary embodiment of the present disclosure;

[0088] Fig. 9 A schematic diagram of the structure of an image recognition device provided by an exemplary embodiment of the present disclosure;

[0089] Fig.10 A schematic structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0090] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0091] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein.

[0092] In order to help those skilled in the art better understand the technical solutions of the present disclosure, the technical names involved in the present disclosure are explained below.

[0093] Target semantics: In the embodiments of the present disclosure, target semantics may include but are not limited to target objects of set categories; wherein target objects may include but are not limited to people, plants, animals, industrial products, buildings, etc.; target objects of set categories may include but are not limited to people of set categories such as police, soldiers, doctors, etc., plants of set categories such as flower plants, food plants, etc., animals of set categories such as cats, dogs, etc., buildings of set categories such as hospitals, schools, bus stations, etc., and technicians in this field can also set target semantics according to other actual needs.

[0094] The design concept of the present disclosure is described below.

[0095] Internet images and videos have become one of the largest information carriers today, and it is very beneficial for us to effectively identify these images and videos. Taking videos containing soldiers and police (hereinafter referred to as "military and police") as an example, if the videos containing soldiers and police can be quickly and accurately identified, it will be helpful for security maintenance and danger warning; however, most of the current video review on the Internet is done manually, which is very inefficient.

[0096] In the related art, when identifying whether a video contains target semantics (such as a person or object with a specified identity) by other means, it is usually done by identifying whether the target semantics is contained in the video frame image in the video; when identifying whether an image contains target semantics, it is often identified by the features of the target object in the image that may be the target semantics, and then the result of identifying whether the image contains the target semantics is determined based on the features of the target object. However, in the above identification process, it is often found that the features of the target object cannot reflect that it is the target semantics; for example, when identifying the target semantics of a policeman in an image, determining whether a person is a policeman depends largely on whether the person is wearing a police uniform. If a person in the image is a policeman but is not wearing a police uniform, the probability of identifying the person as a policeman based on the features of the person's clothing in the image is very low. Therefore, how to improve the accuracy of identifying target semantics in images becomes a problem that needs to be considered.

[0097] In view of this, the present disclosure designs an image recognition method, apparatus, device and storage medium to improve the accuracy of image recognition, taking into account that the recognition accuracy of whether a target object is a target semantic only based on its features is low, and taking into account that some other features in the image may also reflect whether the target object is a target semantic, such as the type of vehicle near the position of a person can reflect the identity of the person to a certain extent. For example, if there is a police car next to a person, it can be estimated that the person is very likely to be a policeman based on the police car. Therefore, in the embodiments of the present disclosure, it is considered to predict whether the image contains the target semantics based on the relationship between the target semantic features for the target semantics and the non-target semantic features in the image; specifically, the target semantic features can be adjusted based on the influence value of the non-target semantic features in the image on the target semantic features, and then based on the adjusted target semantic features, it is predicted whether the image contains the target semantics.

[0098] The solution of the present disclosure is described in detail below with reference to the accompanying drawings.

[0099] See also Figure 1 The present disclosure provides an image recognition method, which specifically includes the following steps:

[0100] Step S101 , performing initial semantic recognition on the image to be recognized to obtain image semantic features; and obtaining target semantic features from the image semantic features, wherein the target semantic features include features for the target semantics in the above-mentioned image semantic features.

[0101] In order to improve the accuracy and recognition efficiency of the image semantic features of the acquired image, a neural network can be used to recognize the image to be recognized. Specifically, a fourth basic neural network can be used to perform initial semantic recognition on the image to be processed to obtain the image semantic features of the image to be recognized. The fourth basic neural network includes a convolution layer with a fourth set convolution kernel size.

[0102] Furthermore, the target object detection network can be used to obtain the position information of the target object in the image to be identified, where the target object includes an object corresponding to the target semantics; and the semantic features corresponding to the position information of the target object are obtained from the image semantic features as the target semantic features.

[0103] If the target object is a person and the target semantics is military or police, the human body detection network can be used to obtain the position information of each person in the image to be identified, and the semantic features corresponding to the position information of each person can be obtained from the image semantic features as the target semantic features.

[0104] In the above process, the target semantic features are determined according to the position information of the target object, so as to improve the accuracy of adjusting the target semantic features according to the image semantic features, and the position information of the target object is obtained by using the target object detection network, which can improve the accuracy of the obtained position information and further improve the accuracy of the obtained target semantic features.

[0105] Step S102: adjusting the target semantic feature based on the influence value of the non-target semantic feature on the target semantic feature, wherein the non-target semantic feature includes the semantic features of the image semantic feature except the target semantic feature.

[0106] Specifically, a target semantic feature can be adjusted through a target network based on the influence value of the non-target semantic feature on the target semantic feature to obtain the adjusted target semantic feature corresponding to the image to be recognized;

[0107] Furthermore, considering that increasing the dimension of feature processing can improve the richness of adjustment of the target semantic features, the target semantic features can be adjusted through multiple target networks of different depths. Specifically, the target semantic features can be adjusted through multiple target networks based on the influence values ​​of non-target semantic features on the target semantic features to obtain the adjusted target semantic features corresponding to each target network; and then the adjusted target semantic features corresponding to each target network are integrated to obtain the adjusted target semantic features corresponding to the image to be identified.

[0108] See also Figure 2 , a schematic diagram of adjusting the target semantic features through multiple target networks (Head networks) is given. The figure shows that the target semantic features are adjusted using three Head networks respectively to obtain the adjusted target semantic features corresponding to the image to be recognized.

[0109] Step S103: obtaining recognition semantic features for the target semantics in the image to be recognized based on the adjusted target semantic features.

[0110] Taking into account that currently the accuracy of estimating the probability parameters of the target semantics contained in the image based only on the target semantic features before adjustment is low, the presently disclosed embodiment considers adjusting the target semantic features based on the correlation between the target semantic features and the image semantic features, thereby improving the precision of the target semantic features, so as to improve the accuracy of estimating the probability parameters of the target semantics contained in the image based on the adjusted target semantic features. Specifically, the adjusted target semantic features can be determined as recognition semantic features for the target semantics in the image to be recognized.

[0111] In order to further improve the accuracy of estimating the probability parameters of the target semantics contained in the image based on the adjusted target semantic features, the adjusted target semantic features and the image semantic features can also be integrated to obtain recognition semantic features for the target semantics in the image to be identified; for example, the adjusted target semantic features and the image features can be spliced ​​to obtain recognition semantic features for the target semantics in the image to be identified.

[0112] Step S104, using the preset recognition semantic features of the historical image and the first correlation between the image type, estimate the second correlation between the recognition semantic features of the image to be recognized and the image type, and convert the estimated second correlation into a probability parameter that the image to be recognized contains the target semantics, wherein the image type is determined based on whether the historical image contains the target semantics.

[0113] Specifically, the above-mentioned probability parameters may include probability values, and may also include some parameters that characterize the probability values. Those skilled in the art may set the probability parameters according to actual needs.

[0114] Furthermore, when the probability parameter includes a probability value, after step S104, the probability value of the image to be identified containing the target semantics can be compared with the first probability threshold. If the probability value of the image to be identified containing the target semantics is greater than the first probability threshold, the image to be identified is determined to be an image containing the target semantics; otherwise, the image to be identified is determined to be an image not containing the target semantics.

[0115] As an embodiment, taking into account the increasing demand for identifying whether a video contains target semantics, in order to improve the accuracy and efficiency of identifying whether a video contains target semantics, the image to be identified in the embodiment of the present disclosure may include video frames in the video to be identified, and the probability parameters of each video frame in the video to be identified containing the target semantics can be estimated through the above-mentioned steps S101 to S104, and then the maximum value of the probability parameters of the video frames in the video to be identified containing the target semantics can be determined as the probability parameters of the video to be identified containing the target semantics.

[0116] Further, when the probability parameter includes a probability value, after determining the probability value that the video to be identified contains the target semantics, the probability value that the video to be identified contains the target semantics can be compared with the second probability threshold. If the probability value that the video to be identified contains the target semantics is greater than the second probability threshold, the video to be identified is determined to be a video containing the target semantics; otherwise, the video to be identified is determined to be a video not containing the target semantics. The above-mentioned first probability threshold and the second probability threshold can be the same value or different values. Technical personnel in this field can set the values ​​of the above-mentioned first probability threshold and the second probability threshold according to actual needs.

[0117] As an embodiment, the process of adjusting the target semantic features by the target network in step S102 of the embodiment of the present disclosure is described below.

[0118] Specifically, for a target network, the target network may include a conversion Transformer unit and multiple conversion units, and then the target semantic features are adjusted by each conversion unit in the target network, which is explained in detail below.

[0119] Case 1: A target network includes a Transformer unit.

[0120] See also Figure 3 , through the Transformer unit, perform the following steps S301 to S303 to adjust the target semantic features.

[0121] Step S301, determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism.

[0122] Specifically, the result of the dot product of the semantic weight vector K of each non-target semantic feature and the target semantic vector q of the target semantic feature can be determined as the influence value of each non-target semantic feature on the target semantic feature.

[0123] That is, referring to the following formula 1, if the image semantic features include 10 semantic features, one of which is the target semantic feature and 9 are non-target semantic features, then in this step, the influence values ​​of the 9 non-target semantic features on the target semantic feature are obtained.

[0124] Formula 1: W(j)=K(j)×q;

[0125] In Formula 1, j is the identification information of the non-target semantic feature, q is the target semantic vector of the target semantic feature, K(j) is the semantic weight vector of the non-target semantic feature with identification information j, and W(j) is the influence value of the non-target semantic feature with identification information j on the target semantic feature vector.

[0126] Step S302 , using the influence value of each non-target semantic feature on the target semantic feature, weighted summing processing is performed on each non-target semantic feature to obtain a weighted semantic feature.

[0127] Specifically, the influence value of each non-target semantic feature on the target semantic feature can be used to perform weighted sum processing on the semantic feature vector V of each non-target semantic feature to obtain a weighted semantic feature; see the following formula 2:

[0128] Formula 2:

[0129] In Formula 2, j is the identification information of the non-target semantic feature, W(j) is the influence value of the non-target semantic feature with identification information j on the target semantic feature vector, V(j) is the semantic feature vector of the non-target semantic feature with identification information j, n is the number of non-target semantic features and n is an integer; C is the weighted semantic feature mentioned above.

[0130] Step S303: Integrate the weighted semantic features and the target semantic features to obtain the adjusted target semantic features corresponding to the image to be recognized.

[0131] Specifically, the weighted semantic feature C and the target semantic vector q can be spliced ​​together to obtain the adjusted target semantic feature corresponding to the image to be identified, or the weighted semantic feature C and the target semantic vector q can be subjected to other processing to obtain the adjusted target semantic feature corresponding to the image to be identified. Technical personnel in this field can set the above-mentioned integration processing according to actual needs.

[0132] As an embodiment, in order to improve the accuracy of the acquired target semantic vector, before the above-mentioned step S301, the target semantic feature can be processed by a first basic neural network to obtain the target semantic vector q used in the conversion unit. The above-mentioned first basic neural network may include a convolution layer with a first set convolution kernel size.

[0133] As an embodiment, in order to improve the accuracy of the acquired semantic weight vector and semantic feature vector, the semantic feature map can be processed by the second basic neural network before step S301 to obtain the semantic weight vector K(j) and semantic feature vector V(j) of each non-target semantic feature used in the Transformer unit; wherein the above-mentioned semantic feature map corresponds to the semantic feature of the image and the semantic feature map is obtained after processing the image to be recognized by the third basic neural network.

[0134] The above-mentioned second basic neural network includes a convolution layer with a second set convolution kernel size; the above-mentioned third basic neural network includes a convolution layer with a third set convolution kernel size. Technical personnel in this field can set the above-mentioned second set convolution kernel size and the first set convolution kernel size according to actual needs.

[0135] In the above process, the target semantic features are adjusted according to the influence values ​​of each non-target semantic feature in the image semantic features on the target semantic features through the attention mechanism in the conversion unit, so that the adjusted target semantic features can include features associated with the target object in the image to be identified, thereby improving the accuracy of the probability parameters of identifying that the image to be identified contains the target semantics according to the adjusted target semantic features, and the target semantic features are adjusted through the above-mentioned semantic weight vector K, target semantic vector q, semantic feature vector V and other vectors, thereby improving the efficiency of adjusting the target semantic features, thereby improving the efficiency of image recognition.

[0136] Case 2: A target network includes multiple Transformer units.

[0137] In this case, multiple Transformer units in a target network are connected in series, see Figure 4 , illustrating a target network consisting of N Transformer units, where N is an integer greater than 1.

[0138] In this case, the target semantic features are adjusted by each Transformer unit, wherein the process of each Transformer unit adjusting the target semantic features can be referred to the above steps S301 to S303, which will not be repeated here.

[0139] As an embodiment, in this case, the target semantic vector used by the first Transformer unit in step S301 is obtained by processing the target semantic feature through a first basic neural network, wherein the first basic neural network includes a convolution layer with a first set convolution kernel size; the target semantic vector used by the i-th Transformer unit is the adjusted target semantic feature obtained by the i-1-th Transformer unit, where i is an integer greater than 1; Figure 4 The target semantic vector q(1) of the target semantic feature obtained by the first Transformer unit is transmitted to the second Transformer unit as the target semantic vector used by the second Transformer unit in step S201.

[0140] In this case, the adjusted target semantic feature corresponding to the image to be recognized is the adjusted target semantic feature obtained by the last Transformer unit in the above multiple Transformer units, such as Figure 4 As shown, the target semantic vector q(N) obtained by the Nth Transformer unit is the adjusted target semantic feature corresponding to the image to be recognized.

[0141] See also Figure 5, a schematic diagram of the adjustment process of adjusting target semantics of multiple Transformer units is given.

[0142] As an embodiment, before adjusting the target semantic features using a target network including multiple Transformer units, the semantic feature map can be processed by, but is not limited to, a second basic neural network to obtain a semantic weight vector K(j) and a semantic feature vector V(j) of each non-target semantic feature used in the Transformer unit of the target network; the semantic feature map corresponds to the image semantic feature, and the semantic feature map is obtained by processing the image to be recognized by a third basic neural network; wherein the semantic weight vector K(j) and the semantic feature vector V(j) of each non-target semantic feature used by each Transformer unit in the multiple Transformer units are the same; the second basic neural network includes a convolution layer with a second set convolution kernel size; the third basic neural network includes a convolution layer with a third set convolution kernel size.

[0143] In the above process, the target semantic features after adjustment of multiple Transformer units are richer in content, and have more correlation information with the global features (image semantic features) of the image to be identified. Therefore, when the adjusted target semantic features are used for image recognition, the accuracy of the probability parameters that the image to be identified contains the target semantics can be improved.

[0144] As an embodiment, if the target semantic feature is adjusted using multiple target networks in step S102, the semantic weight vector K(j) and the semantic feature vector V(j) of each non-target semantic feature used in each target network may be different.

[0145] As an embodiment, in order to improve the accuracy and recognition efficiency of the probability parameter of the target semantics contained in the recognition image, in step S104, the probability parameter of the image to be recognized containing the target semantics can be estimated based on the recognition semantic features of the image to be recognized by the trained classifier model. Specifically, the trained classifier model can be used to input the recognition semantic features of the image to be recognized, and the probability parameter of the image to be recognized containing the target semantics output by the classifier model can be obtained; wherein:

[0146] The above classifier model is obtained by training based on a machine learning method, using the recognition semantic features of each historical image and the image type of each historical image as training samples.

[0147] When the above-mentioned classifier is used to estimate the probability parameters of the target semantics contained in the video to be identified, if the recognition semantic features of historical video frames and the image types of each historical video frame are used as training samples, it is necessary to determine the image type of each historical video frame and set a label for characterizing the image type for each historical video frame. Usually, a video contains many video frames. When training the classifier model, it is necessary to set labels for a huge number of historical video frames, which is very resource-consuming, inefficient, and time-consuming. Therefore, in order to improve the training efficiency of the classifier model in the present disclosure, the classifier model is directly trained through the recognition semantics of each historical video and the video type of the historical videos, and a label characterizing the video type is directly set for the historical videos.

[0148] Specifically, the image to be identified includes video frames in the video to be identified, and the classifier model is trained through a multi-instance learning method, using the recognition semantic features of the video frames in each historical video and the video type of each historical video as training samples. The video type is determined based on whether each historical video contains a target frame, and the target frame includes a video frame containing target semantics.

[0149] The following is an explanation of the process of training the above classifier model using a multi-instance learning method.

[0150] Therefore, in the embodiment of the present disclosure, labels of training samples are set in the entire video dimension, and a multi-instance learning mechanism is used to optimize the training process of the classifier model; specifically, during the training process, a paired sample group including a positive sample video and a negative sample video is given, where the positive sample video is a video including the above target frame, and the negative sample video is a video not including the above target frame; for the above sample group, an objective function shown in the following formula 3 is designed:

[0151] Formula 3:

[0152] In the above formula 3, V p is a positive sample video, and Vn is a negative sample video, and N p is the number of video frames in the positive sample video, N n is the number of video frames in the negative sample video, i is the identification information of the video frame in the positive sample video, and j is the identification information of the video frame in the negative sample video; the value range of f() is between 0 and 1 and includes 0 and 1, and f() represents the probability value of the target semantics contained in the video; Indicates the maximum value of the probability value of the target semantics contained in the video frame of the positive sample video; Indicates the maximum value of the probability value of the target semantics contained in the video frame of the negative sample video.

[0153] The training goal represented by the objective function illustrated in the above formula 3 is to make the estimation results of the video frames of the positive sample video and the video frames of the negative sample video gradually move away from each other.

[0154] In addition, using the above objective function has the following two advantages:

[0155] Advantage 1: The requirement for the granularity of the labels of the training samples is low. In some cases, the labels of the videos are set at the video level rather than the video frame level, which makes it impossible to train the network in a fully supervised manner. However, the objective function illustrated in Formula 3 above makes the training process of the classifier model feasible.

[0156] Advantage 2: The labels of the training samples have a high tolerance for noise, and thus during the start of optimization, the video frame with the maximum probability value for the video containing the target semantics may not contain the target semantics; therefore, we need an objective function that is insensitive to the noise in the training samples to optimize the network, and the objective function illustrated in the above formula 3 can achieve this effect because its gradient is linear.

[0157] Specifically, see Figure 6 , a schematic diagram of a training architecture for training a classifier model based on multi-instance learning is given, for which, in the embodiments of the present disclosure, the loss function illustrated by the following formulas 4 to 6 can also be used to optimize the network of the classifier model.

[0158] Formula 4:

[0159] Formula 5:

[0160] Formula 6:

[0161] Among them, in the above formulas 4 to 6, V p is a positive sample video, and Vn is a negative sample video, and N p is the number of video frames in the positive sample video, N n is the number of video frames in the negative sample video, i is the identification information of the video frame in the positive sample video, and j is the identification information of the video frame in the negative sample video; the value range of f() is between 0 and 1 and includes 0 and 1, and f() represents the probability value of the target semantics contained in the video; Indicates the maximum value of the probability value of the target semantics contained in the video frame of the positive sample video; Indicates the maximum value of the probability value of the target semantics contained in the video frame of the negative sample video; l rank It is based on the idea of ​​the above objective function, which is expressed in the form of ranking loss; negIt is designed for negative sample videos without target semantics. All frames in this type of video do not contain target semantic information. ln() means using the cross entropy loss function to optimize it. smooth Characterizing this loss function is used to constrain that the probability values ​​should change smoothly between adjacent video frames in a video.

[0162] The classifier model in the disclosed embodiment may include one layer of fully connected network or multiple layers of fully connected network. Those skilled in the art may set the number of layers of the fully connected network in the classifier model according to the requirements of recognition accuracy.

[0163] See also Figure 7 , a schematic diagram of the principle of estimating the probability value of the to-be-recognized video containing the target semantics through the above-mentioned classifier model is provided, wherein the classifier model is used to recognize video frame 1, video frame 2 to video frame n in the to-be-recognized video, and the corresponding probability values ​​f(1), probability value f(2) to probability value f(n) containing the target semantics are output respectively, and finally the maximum probability value maxf() is determined as the probability value of the to-be-recognized video containing the target semantics.

[0164] The following is a specific example of image recognition.

[0165] In this example, people are taken as the target object, soldiers and police (hereinafter referred to as "military and police") are taken as the target semantics, and the example of identifying whether a video contains military and police is used to illustrate.

[0166] See also Figure 8 ,First, a schematic diagram of the neural network structure for video recognition is provided.

[0167] For the backbone network, we use ResNet-50 pre-trained with ImageNet as the backbone network to encode video frames. For a video frame of size H×W, a semantic feature map is extracted from each of the last three conv blocks (i.e., the three basic neural networks Conv3_x, Conv4_x, and Conv5_x). The basic neural network here can be but not limited to the third basic neural network mentioned above, where H is the height of the video frame and W is the width of the video frame; the sizes of the semantic feature maps extracted from Conv3_x, Conv4_x, and Conv5_x are (W / 8)×(W / 8), (W / 16)×(W / 16), and (W / 32)×(W / 32), respectively. Those skilled in the art can also set the size of the feature maps extracted from the above target networks according to other actual needs.

[0168] In this example, H(i)×W(i) is used to represent the feature map size at the conv block Convi_x, where i is the identification information of different target networks. Experiments have found that the semantic feature maps extracted using multiple basic neural networks (conv blocks) of different depths have richer data than those extracted using only one basic neural network. The semantic feature maps obtained using multiple basic neural networks have richer data, and the probability values ​​of the target semantics in the video frames estimated by them are more accurate.

[0169] After obtaining the semantic feature map through different conv blocks, the RoiPool operation is used to extract the target semantic features of the human body according to the position information of the human body in the video frame. The target semantic features are used to represent the image features of the human body position part. Specifically, in this example, the position information of the human body in the video frame can be obtained through the trained human body detection network;

[0170] The input of the above RoiPool is a target semantic feature map of size r·H(i)×r·W(i) containing target semantic features, and the ratio of the target semantic feature map to the original semantic feature map H(i)×W(i) is r.

[0171] For the target semantic features output by RoiPool at Convi_x, in this example, three Head networks are used to adjust the target semantic features obtained by different Convi_x respectively to generate the adjusted target semantic features h(i) corresponding to the video frame (i is the identification information of the above three basic neural networks Conv3_x, Conv4_x and Conv5_x), and the above different Head networks have different numbers of convolutional layers.

[0172] Each Head network in this example is composed of multiple Transformer units spliced ​​together. In the input part of the Head network, it is necessary to obtain the query feature q(i), key feature K(i) and value feature V(i) corresponding to the target semantic feature respectively; the query feature q(i) in this example is the target semantic vector q of the above target semantic feature, the key feature K(i) is the semantic weight vector K of the above non-target semantic feature, and the value feature V(i) is the semantic feature vector V of the above non-target semantic feature. The i in the query feature q(i), key feature K(i) and value feature V(i) is the identification information of the above three basic neural networks Conv3_x, Conv4_x and Conv5_x.

[0173] In this example, the query feature q(i), key feature K(i), and value feature V(i) corresponding to Convi_x are obtained in the following way.

[0174] 1) Get the query feature q(i) used by the Head network corresponding to Convi_x.

[0175] Given a target semantic feature of shape C×r·H(i)×r·W(i) obtained by RoiPool, a first basic neural network including a convolutional layer with a convolution kernel size of r·H(i)×r·W(i) is used to encode the target semantic feature to obtain a query feature q(i). The dimension of the above convolutional layer is D×1×1, where D is the output channel of the convolutional layer.

[0176] 2) Obtain the key feature K(i) and value feature V(i) used by the Head network corresponding to Convi_x.

[0177] Since different Head networks have different numbers of convolutional layers, the specific methods for obtaining the key features K(i) and value features V(i) used by the Head networks corresponding to different Convi_x are slightly different. The details are as follows:

[0178] For the head network in Conv4_x, we also use a second basic neural network containing a convolutional layer with a convolution kernel size of r×H(4)×r×W(4) to encode the semantic feature map extracted by Conv4_x and obtain the key feature K(4) and value feature V(4) used by the Head network in Conv4_x.

[0179] For the Head network located in Conv5_x, we also use the second basic neural network containing a convolution layer with a convolution kernel size of r×H(5)×r×W(5) to encode the semantic feature map extracted by Conv5_x, and obtain the key feature K(5) and value feature V(5) used by the Head network in Conv5_x; when obtaining the key feature K(i) and value feature V(i) used by the head networks located in Conv4_x and Conv5_x, the same second basic neural network can be used to encode the corresponding semantic feature map.

[0180] However, for the Head network of Conv3_x, this example uses a second basic neural network consisting of two convolutional layers to encode the semantic feature map corresponding to Conv3_x to obtain the key feature K(3) and value feature V(3) used by the Head network of Conv3_x; the convolution kernel size of each convolutional layer in the above two convolutional layers can be {[(r×H(i)+1) / 2]+[(r×W(i)+1) / 2]}, where i is the identification information 3 of Conv3_x, to ensure that for the output features of the convolutional layer, the receptive field of each feature point (the image range covered by each feature point) is the same as the RoiPool feature size.

[0181] In addition, the reason why the second basic neural network containing two convolutional layers is applied at Conv3_x in this example is that the size of the semantic feature map at Conv3_x is relatively large, and only one convolutional layer may not be able to encode the semantic features well here, so one convolutional layer is added to improve the semantic encoding ability. Then, through the convolutional layer, we can get the key feature K(i) and value feature V(i) at Convi_x. The shapes of the key feature and the value feature are both D×H(i)'×W(i)' feature size.

[0182] After obtaining the query feature q(i), key feature K(i) and value feature V(i) used by the Head network in Convi_x, each Head network is used to process the target semantic features. Here, please refer to the above description, which mainly includes the following contents:

[0183] For a Transformer unit in a Head network, the influence value of the non-target semantic feature on the target semantic feature is first obtained, which can be obtained by the above formula 1 or by the following formula 7.

[0184] Formula 7:

[0185] W in formula 7 x,y (i) is the matrix of the influence values ​​of each non-target semantic feature on the target semantic feature, and i is the identification information of Convi_x.

[0186] After obtaining the matrix of influence values ​​based on Formula 7, W can be transformed into x,y (i) Normalize and use the following formula 8 based on W x,y (i) Perform weighted sum processing on the corresponding value feature V(i) to obtain the weighted semantic feature corresponding to the Transformer unit.

[0187] Formula 8: c(i) = ∑ x,y[Softmax(W(i))] x,y V x,y (i);

[0188] In Formula 8, i is the identification information of Convi_x, and c(i) is the weighted semantic feature corresponding to the Transformer unit.

[0189] After obtaining c(i), c(i) is dropout to reduce the overfitting of the encoding network; then c(i) is added to the query feature q(i) input to the Transformer unit to obtain c(i)′, and then c(i)′ is input into the two-layer perceptron network after layer normalization (LayerNorm). The obtained features can be used to obtain the non-query feature q(i)′ that serves as the next Transformer unit input. Among them, c(i) contains the most relevant spatial context information with q(i). In this way, the information of q(i) is enriched. The above operations can be expressed as the following formulas 9 and 10.

[0190] Formula 9: c(i)′=LayerNorm(q(i))+Dropout(c(i));

[0191] Formula 10: q(i)′=LayerNorm(q(i)′)+Dropout(MLP(c(i)′));

[0192] q(i)′, K(i) and V(i) will be input into the next Transformer unit, and the above steps will be repeated until the complete adjusted target semantic feature h(i) is obtained from the last Transformer unit of the Head network.

[0193] As an embodiment, if there are multiple target semantic features in a video frame, h(i) will be the mean of all adjusted target semantic features.

[0194] Then, by using the Head network in Conv3_x, Conv4_x and Conv5_x to obtain the corresponding h(3), h(4) and h(5), h(3), h(4) and h(5) can be connected in series with the image semantic features as the recognition semantic features of the video frame, or the average of h(3), h(4) and h(5) can be connected in series with the image semantic features as the recognition semantic features of the video frame, or h(3), h(4) and h(5) can be connected in series with the image semantic features as the recognition semantic features of the video frame, or the average of h(3), h(4) and h(5) can be used as the recognition semantic features of the video frame; then, the recognition semantic features of the video frame are input into the trained classifier model to obtain the probability value that the video frame contains military police; wherein:

[0195] The above classifier model is pre-trained by a multi-instance learning method. The specific training method can be found in the above content and will not be repeated here.

[0196] Experiments show that the probability value of containing military police in the video is estimated by the method provided by the embodiment of the present invention. On a single-card GPU GeForce RTX 1080Ti, the AUC accuracy of video recognition is not less than 82%, which is 2 to 3 percentage points higher than other image recognition methods, significantly improving the recognition accuracy of the target semantics in the image.

[0197] In summary, in the embodiments of the present disclosure, the target semantic features are adjusted based on the influence value of non-target semantic features on the target semantic features. That is, the parameter probability of containing the target semantics in the image to be identified is estimated according to the relationship between the non-target semantic features and the target semantic features in the image to be identified. This takes into account both the target semantic features and the influence of the non-target semantic features on the target semantics, thereby improving the recognition accuracy of the target semantics in the image.

[0198] like Fig. 9 As shown, based on the same inventive concept, the embodiment of the present disclosure further provides an image recognition device 900, which includes:

[0199] The feature extraction unit 901 is configured to perform initial semantic recognition on the image to be recognized to obtain image semantic features; and obtain target semantic features from the image semantic features, wherein the target semantic features include features for target semantics in the image semantic features;

[0200] A first feature processing unit 902 is configured to adjust the target semantic feature based on an influence value of a non-target semantic feature on the target semantic feature, wherein the non-target semantic feature includes a semantic feature other than the target semantic feature in the image semantic feature; and

[0201] The second feature processing unit 903 is configured to execute, based on the adjusted target semantic feature, obtaining a recognition semantic feature for the target semantic in the image to be recognized;

[0202] The image recognition unit 904 is configured to execute a first correlation between the recognition semantic features of preset historical images and the image type, estimate a second correlation between the recognition semantic features of the image to be recognized and the image type, and convert the estimated second correlation into a probability parameter that the image to be recognized contains the target semantics, wherein the image type is determined based on whether the target semantics is contained in the historical image.

[0203] As an embodiment, the above-mentioned image to be identified includes a video frame in a video to be identified, and the image identification unit 904 is further configured to perform:

[0204] After converting the estimated second association degree into the probability parameter that the image to be identified contains the target semantics, the maximum value of the probability parameter that the video frames in the video to be identified contain the target semantics is determined as the probability parameter that the video to be identified contains the target semantics.

[0205] As an embodiment, the second feature processing unit 903 is specifically configured to execute:

[0206] Determine the adjusted target semantic feature as the recognition semantic feature for the target semantic in the image to be recognized; or

[0207] The adjusted target semantic features and the image semantic features are integrated to obtain recognition semantic features for the target semantics in the image to be recognized.

[0208] As an embodiment, the first feature processing unit 902 is specifically configured to execute:

[0209] Through each conversion unit in the target network, the following steps are performed to adjust the above target semantic features:

[0210] Through the attention mechanism, determine the influence value of each non-target semantic feature on the above target semantic feature;

[0211] Using the influence values ​​of the above non-target semantic features on the above target semantic features, weighted summing processing is performed on the above non-target semantic features to obtain a weighted semantic feature;

[0212] The weighted semantic features and the target semantic features are integrated to obtain

[0213] The adjusted target semantic features corresponding to the above-mentioned image to be recognized;

[0214] Among them, the above-mentioned target network includes at least one conversion unit. If the above-mentioned target network includes multiple conversion units connected in series, the target semantic vector used by the i-th conversion unit is the adjusted target semantic feature obtained by the i-1-th conversion unit; the adjusted target semantic feature corresponding to the above-mentioned image to be recognized is the adjusted target semantic feature obtained by the conversion unit at the last position among the above-mentioned multiple conversion units, and the above-mentioned i is an integer greater than 1.

[0215] As an embodiment, the first feature processing unit 902 is specifically configured to execute:

[0216] The result of performing a dot product of the semantic weight vector of each of the non-target semantic features and the target semantic vector of the target semantic feature is determined as the influence value of each of the non-target semantic features on the target semantic feature;

[0217] The step of performing weighted sum processing on the non-target semantic features using the influence values ​​of the non-target semantic features on the target semantic features to obtain the weighted semantic features includes:

[0218] By using the influence values ​​of the above non-target semantic features on the above target semantic features, a weighted sum process is performed on the semantic feature vectors of the above non-target semantic features to obtain a weighted semantic feature.

[0219] As an embodiment, the first feature processing unit 902 is further configured to execute:

[0220] Before determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the target semantic feature is processed through the first basic neural network to obtain the target semantic vector used in the first conversion unit, and the first basic neural network includes a convolution layer with a first set convolution kernel size.

[0221] As an embodiment, the first feature processing unit 902 is further configured to execute:

[0222] Before determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the semantic feature map is processed by the second basic neural network to obtain the semantic weight vector and semantic feature vector of each non-target semantic feature used in each conversion unit in the target network; the semantic feature map corresponds to the image semantic feature and the semantic feature map is obtained by processing the image to be identified through the third basic neural network; wherein:

[0223] The second basic neural network includes a convolution layer with a second set convolution kernel size; the third basic neural network includes a convolution layer with a third set convolution kernel size.

[0224] As an embodiment, the target network includes multiple networks, and the first feature processing unit 902 is specifically configured to execute:

[0225] Through multiple target networks respectively, based on the influence value of the non-target semantic features on the target semantic features, the target semantic features are adjusted to obtain the adjusted target semantic features corresponding to each target network; and the adjusted target semantic features corresponding to each target network are integrated to obtain the adjusted target semantic features corresponding to the image to be identified.

[0226] As an embodiment, the feature extraction unit 901 is specifically configured to perform:

[0227] Performing initial semantic recognition on the image to be processed by using a fourth basic neural network to obtain image semantic features of the image to be recognized, wherein the fourth basic neural network includes a convolution layer with a fourth set convolution kernel size;

[0228] Using a target object detection network, obtaining location information of a target object in the above-mentioned image to be identified, wherein the above-mentioned target object includes an object corresponding to the above-mentioned target semantics;

[0229] From the above image semantic features, a semantic feature corresponding to the position information of the above target object is obtained as the above target semantic feature.

[0230] As an embodiment, the image recognition unit 904 is specifically configured to perform:

[0231] A trained classifier model is used, the recognition semantic features of the above-mentioned image to be recognized are input, and the probability parameters of the above-mentioned image to be recognized output by the above-mentioned classifier model are obtained. The above-mentioned classifier model is based on a machine learning method, and is trained using the recognition semantic features of each historical image and the image type of each historical image as training samples.

[0232] As an embodiment, the above-mentioned image to be identified includes video frames in the video to be identified, and the above-mentioned classifier model is obtained by training through a multi-instance learning method, using the recognition semantic features of the video frames in each historical video and the video type of the above-mentioned historical videos as training samples. The above-mentioned video type is determined based on whether the above-mentioned historical videos contain target frames, and the above-mentioned target frames include video frames containing the above-mentioned target semantics.

[0233] like Fig.10 As shown, the present disclosure provides an electronic device 1000, including a processor 1001, and a memory 1002 for storing instructions executable by the processor;

[0234] Among them, the above-mentioned processor is configured to execute any one of the image recognition methods in the embodiments of the present disclosure.

[0235] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs an image recognition method provided by an embodiment of the present disclosure.

[0236] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by a processor of the electronic device to complete the method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0237] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0238] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image recognition method, characterized in that: include: Perform initial semantic recognition on the image to be identified to obtain the semantic features of the image; and obtaining a target semantic feature from the image semantic feature, wherein the target semantic feature includes a feature for the target semantics in the image semantic feature; Adjusting the target semantic feature based on an influence value of a non-target semantic feature on the target semantic feature, wherein the non-target semantic feature includes semantic features other than the target semantic feature in the image semantic features; as well as Based on the adjusted target semantic features, obtaining recognition semantic features for the target semantics in the image to be recognized; Using a preset first degree of association between the recognition semantic features of the historical image and the image type, a second degree of association between the recognition semantic features of the image to be recognized and the image type is estimated, and the estimated second degree of association is converted into a probability parameter that the image to be recognized contains the target semantics, wherein the image type is determined according to whether the historical image contains the target semantics; The step of adjusting the target semantic feature based on the impact value of the non-target semantic feature on the target semantic feature includes: Through each conversion unit in the target network, the target semantic features are adjusted by performing the following steps: Determine the influence value of each non-target semantic feature on the target semantic feature through an attention mechanism; Using the influence values ​​of the non-target semantic features on the target semantic feature, weighted summing processing is performed on the non-target semantic features to obtain a weighted semantic feature; Integrate the weighted semantic features and the target semantic features to obtain an adjusted target semantic feature corresponding to the image to be identified; Wherein, the target network includes at least one conversion unit. If the target network includes multiple conversion units connected in series, the target semantic vector used by the i-th conversion unit is the adjusted target semantic feature obtained by the i-1-th conversion unit; the adjusted target semantic feature corresponding to the image to be identified is the adjusted target semantic feature obtained by the last conversion unit among the multiple conversion units, and i is an integer greater than 1.

2. The method according to claim 1, characterized in that The image to be identified includes a video frame in the video to be identified. After the step of converting the estimated second association degree into a probability parameter that the image to be identified includes the target semantics, the method further includes: The maximum value of the probability parameter that the video frames in the to-be-recognized video contain the target semantics is determined as the probability parameter that the to-be-recognized video contains the target semantics.

3. The method according to claim 1, characterized in that The step of obtaining the recognition semantic features for the target semantics in the image to be recognized based on the adjusted target semantic features includes: Determine the adjusted target semantic feature as a recognition semantic feature for the target semantics in the image to be recognized; or The adjusted target semantic features and the image semantic features are integrated to obtain recognition semantic features for the target semantics in the image to be recognized.

4. The method according to any one of claims 1 to 3, characterized in that: The step of determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism includes: The result of performing a dot product of the semantic weight vector of each non-target semantic feature and the target semantic vector of the target semantic feature is determined as the influence value of each non-target semantic feature on the target semantic feature; The step of performing weighted sum processing on each non-target semantic feature by using the influence value of each non-target semantic feature on the target semantic feature to obtain a weighted semantic feature comprises: By using the influence values ​​of the non-target semantic features on the target semantic feature, a weighted sum process is performed on the semantic feature vectors of the non-target semantic features to obtain a weighted semantic feature.

5. The method according to claim 4, characterized in that Before the step of determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the step also includes The target semantic feature is processed by a first basic neural network to obtain the target semantic vector used in a first conversion unit, wherein the first basic neural network includes a convolution layer with a first set convolution kernel size.

6. The method according to claim 4, characterized in that Before the step of determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the method further includes: The semantic feature map is processed by the second basic neural network to obtain the semantic weight vector and the semantic feature vector of each non-target semantic feature used in each conversion unit in the one target network; the semantic feature map corresponds to the image semantic feature and the semantic feature map is obtained by processing the image to be identified by the third basic neural network; wherein: The second basic neural network includes a convolution layer with a second set convolution kernel size; and the third basic neural network includes a convolution layer with a third set convolution kernel size.

7. The method according to any one of claims 1 to 3, characterized in that: The target network includes a plurality of network elements, and the step of adjusting the target semantic feature based on the influence value of the non-target semantic feature on the target semantic feature includes: Through multiple target networks respectively, based on the influence value of the non-target semantic feature on the target semantic feature, the target semantic feature is adjusted to obtain the adjusted target semantic feature corresponding to each target network; and the adjusted target semantic feature corresponding to each target network is integrated to obtain the adjusted target semantic feature corresponding to the image to be identified.

8. The method according to any one of claims 1 to 3, characterized in that: The step of performing initial semantic recognition on the image to be recognized to obtain the semantic features of the image comprises: Performing initial semantic recognition on the image to be recognized by using a fourth basic neural network to obtain image semantic features of the image to be recognized, wherein the fourth basic neural network includes a convolution layer with a fourth set convolution kernel size; The step of acquiring target semantic features from the image semantic features comprises: Using a target object detection network, obtaining position information of a target object in the image to be identified, wherein the target object includes an object corresponding to the target semantics; From the image semantic features, a semantic feature corresponding to the position information of the target object is obtained as the target semantic feature.

9. The method according to any one of claims 1 to 3, characterized in that: The step of using the preset recognition semantic features of the historical images and the first association degree of the image type to estimate the second association degree between the recognition semantic features of the image to be recognized and the image type, and converting the estimated second association degree into a probability parameter that the image to be recognized contains the target semantics, comprises: A trained classifier model is used, the recognition semantic features of the image to be recognized are input, and the probability parameters of the image to be recognized output by the classifier model are obtained, that is, the probability parameters that the image to be recognized contains the target semantics. The classifier model is based on a machine learning method, and is trained using the recognition semantic features of each historical image and the image type of each historical image as training samples.

10. An image recognition device, characterized in that: include: A feature extraction unit is configured to perform initial semantic recognition on the image to be recognized to obtain image semantic features; and obtaining a target semantic feature from the image semantic feature, wherein the target semantic feature includes a feature for the target semantics in the image semantic feature; A first feature processing unit is configured to adjust the target semantic feature based on an influence value of a non-target semantic feature on the target semantic feature, wherein the non-target semantic feature includes a semantic feature other than the target semantic feature in the image semantic feature; as well as A second feature processing unit is configured to obtain a recognition semantic feature for the target semantics in the image to be recognized based on the adjusted target semantic feature; The image recognition unit is configured to use a preset first correlation between the recognition semantic feature of the historical image and the image type to estimate a second correlation between the recognition semantic feature of the image to be recognized and the image type, and convert the estimated second correlation into a probability parameter that the image to be recognized contains the target semantics, wherein the image type is determined according to whether the historical image contains the target semantics; The first feature processing unit is specifically configured to execute: Through each conversion unit in the target network, the target semantic features are adjusted by performing the following steps: Determine the influence value of each non-target semantic feature on the target semantic feature through an attention mechanism; Using the influence values ​​of the non-target semantic features on the target semantic feature, weighted summing processing is performed on the non-target semantic features to obtain a weighted semantic feature; Integrate the weighted semantic features and the target semantic features to obtain an adjusted target semantic feature corresponding to the image to be identified; Wherein, the target network includes at least one conversion unit. If the target network includes multiple conversion units connected in series, the target semantic vector used by the i-th conversion unit is the adjusted target semantic feature obtained by the i-1-th conversion unit; the adjusted target semantic feature corresponding to the image to be identified is the adjusted target semantic feature obtained by the last conversion unit among the multiple conversion units, and i is an integer greater than 1.

11. The device according to claim 10, characterized in that The image to be identified includes a video frame in a video to be identified, and the image identification unit is further configured to execute: After converting the estimated second association degree into a probability parameter that the image to be identified contains the target semantics, the maximum value of the probability parameter that the video frames in the video to be identified contain the target semantics is determined as the probability parameter that the video to be identified contains the target semantics.

12. The device according to claim 10, characterized in that The second feature processing unit is specifically configured to execute: Determine the adjusted target semantic feature as a recognition semantic feature for the target semantics in the image to be recognized; or The adjusted target semantic features and the image semantic features are integrated to obtain recognition semantic features for the target semantics in the image to be recognized.

13. The device according to any one of claims 10 to 12, characterized in that: The first feature processing unit is specifically configured to execute: The result of performing a dot product of the semantic weight vector of each non-target semantic feature and the target semantic vector of the target semantic feature is determined as the influence value of each non-target semantic feature on the target semantic feature; The step of performing weighted sum processing on each non-target semantic feature by using the influence value of each non-target semantic feature on the target semantic feature to obtain a weighted semantic feature comprises: By using the influence values ​​of the non-target semantic features on the target semantic feature, a weighted sum process is performed on the semantic feature vectors of the non-target semantic features to obtain a weighted semantic feature.

14. The device according to claim 13, characterized in that The first feature processing unit is further configured to execute: Before determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the target semantic feature is processed through a first basic neural network to obtain the target semantic vector used in the first conversion unit, and the first basic neural network includes a convolution layer with a first set convolution kernel size.

15. The device according to claim 13, characterized in that The first feature processing unit is further configured to execute: Before determining the influence value of each non-target semantic feature on the target semantic feature through the attention mechanism, the semantic feature map is processed by the second basic neural network to obtain the semantic weight vector and semantic feature vector of each non-target semantic feature used in each conversion unit in the one target network; the semantic feature map corresponds to the image semantic feature and the semantic feature map is obtained by processing the image to be identified through the third basic neural network; wherein: The second basic neural network includes a convolution layer with a second set convolution kernel size; and the third basic neural network includes a convolution layer with a third set convolution kernel size.

16. The device according to any one of claims 10 to 12, characterized in that: The target network includes a plurality of networks, and the first feature processing unit is specifically configured to execute: Through multiple target networks respectively, based on the influence value of the non-target semantic feature on the target semantic feature, the target semantic feature is adjusted to obtain the adjusted target semantic feature corresponding to each target network; and the adjusted target semantic feature corresponding to each target network is integrated to obtain the adjusted target semantic feature corresponding to the image to be identified.

17. The device according to any one of claims 10 to 12, characterized in that: The feature extraction unit is specifically configured to perform: Performing initial semantic recognition on the image to be recognized by using a fourth basic neural network to obtain image semantic features of the image to be recognized, wherein the fourth basic neural network includes a convolution layer with a fourth set convolution kernel size; Using a target object detection network, obtaining position information of a target object in the image to be identified, wherein the target object includes an object corresponding to the target semantics; From the image semantic features, a semantic feature corresponding to the position information of the target object is obtained as the target semantic feature.

18. The device according to any one of claims 10 to 12, characterized in that: The image recognition unit is specifically configured to perform: A trained classifier model is used, the recognition semantic features of the image to be recognized are input, and the probability parameters of the image to be recognized output by the classifier model are obtained, that is, the probability parameters that the image to be recognized contains the target semantics. The classifier model is based on a machine learning method, and is trained using the recognition semantic features of each historical image and the image type of each historical image as training samples.

19. An electronic device, characterized in that: comprising a processor, and a memory for storing instructions executable by the processor; The processor is configured to execute the method according to any one of claims 1 to 9.

20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 9.

21. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Method and device for establishing multi-attribute recognition model and method for multi-attribute recognition

    CN109117781A

  • Generation and auxiliary positioning method for live-action semantic map of smart scenic spot

    CN110866079A

  • Medical image text report generation method and device

    CN111063410A