Group detection method, device, storage medium and electronic device

By extracting and encoding interactive prompt word features and generating interactive features, the problem of low accuracy of existing group detection methods is solved and more accurate group detection is achieved.

CN118429897BActive Publication Date: 2024-10-22HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410881274.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-10-22
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

Existing group detection methods are based on clustering methods of manual features such as distance, which have low accuracy, and the learning of interactive relationships is not correctly guided, resulting in inaccurate group detection.

Method used

A group detection method is used to determine the individual characteristics of each target in the image to be tested, and the language model is used to extract features of the externally input interactive prompt words to obtain the interactive prompt word features, and the pre-trained interactive feature encoding model is used to Individual features are encoded and processed to generate interactive features to indicate the interactive relationship between targets. Finally, group division and identification are performed based on interactive features.

Benefits of technology

It improves the accuracy of group detection, avoids the complexity of scene restrictions and manual parameter adjustment, ensures that interactive features reflect the consistency of interactive relationships, and enhances the accuracy of group division.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118429897B_ABST
    Figure CN118429897B_ABST
Patent Text Reader

Abstract

The present application discloses a group detection method, device, storage medium and electronic device, including: determining individual features of each target in the image to be detected; using a first language model to extract features of an externally input interactive prompt word to obtain interactive prompt word features; using a pre-trained interactive feature encoding model, based on the interactive prompt word features, encoding the individual features to obtain interactive features for indicating the interactive relationship between any two targets among the targets; and dividing and identifying groups based on the interactive features. The application can effectively improve the accuracy of group detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to neural network technology, and in particular to a group detection method, device, storage medium and electronic device. Background Art

[0002] In security monitoring scenarios, the identification of abnormal events often relies on the input information of group detection. First, the target group (such as a crowd) with the same purpose or the same event is detected as a group, and then the behavior recognition method is used for abnormal detection. The current common group detection method is based on the clustering method of manual features such as distance. It is limited by the scene, the parameter adjustment is complex and the accuracy is low. Recently, some technologies focus on the interactive relationship between targets, but the learning of the interactive relationship is not properly guided. The fuzzy relationship will introduce many irrelevant targets, making the group detection inaccurate. Summary of the invention

[0003] The present application provides a group detection method, device, storage medium and electronic device, which can effectively improve the accuracy of group detection.

[0004] To achieve the above objectives, this application adopts the following technical solutions:

[0005] A group detection method, comprising:

[0006] Determine the individual characteristics of each target in the image to be tested;

[0007] Using the first language model to extract features of the externally input interactive prompt words, and obtaining interactive prompt word features;

[0008] Using a pre-trained interaction feature encoding model, based on the interaction prompt word features, the individual features are encoded to obtain interaction features for indicating the interaction relationship between any two targets among the targets;

[0009] Group division and identification are performed based on the interaction characteristics.

[0010] Preferably, the interactive feature encoding model is a Transformer model;

[0011] The encoding process of the individual features based on the interactive prompt word features includes:

[0012] Performing position coding based on the position relationship between the targets, fusing the position coding result, the interactive prompt word feature and the individual feature, using the fused feature as the input of the interactive feature coding model, and performing coding processing using the interactive feature coding model; or

[0013] Position encoding is performed based on the positional relationship between the various targets, the position encoding result and the individual features are fused, and the fused features are processed as inputs of the interactive feature encoding model; before self-attention processing is performed in the interactive feature encoding model, the individual features are grouped based on the interactive prompt word features, and the self-attention processing in the interactive feature encoding model is performed based on the result of the grouping.

[0014] Preferably, the group division and identification based on the interaction features includes:

[0015] Inputting the interaction features into a pre-trained behavior inference model, classifying the interaction features using the behavior inference model, predicting a group classification result, and predicting the probability of an interaction relationship between any two targets based on the interaction features;

[0016] The any two targets whose probability is greater than or equal to the interaction threshold are regarded as a pair of targets having an interaction relationship;

[0017] The groups are divided based on all the determined interaction relationships, the targets that have interaction relationships with each other are divided into the same group, and the group classification result is used as the classification recognition result of the divided group.

[0018] Preferably, after obtaining the interaction features and before performing group division and identification based on the interaction features, the method further comprises:

[0019] Constructing a graph network model; wherein the nodes of the graph network model include the target, the interaction relationship between any two targets, and the group relationship, and the group relationship is used to characterize the consistency relationship between different interaction relationships;

[0020] Determining initial features of each node in the graph network model based on the individual features and the interaction features, iteratively updating the features of each node in the graph network model, and determining output node features of each node, so that the nodes can learn from each other;

[0021] Based on the guidance of the external input group prompt words, the output node features are encoded to determine the updated output node features;

[0022] The performing group division and identification based on the interaction features includes: performing group division and identification based on updated interaction features included in updated output node features.

[0023] Preferably, the method further comprises: receiving an externally input individual prompt word, and extracting features of the individual prompt word using a second language model to obtain individual prompt word features;

[0024] After obtaining the individual features, the method further includes: based on the guidance of the individual prompt word features, using a trained individual feature encoder to encode the individual features to obtain updated individual features;

[0025] When encoding the individual features using the interactive feature encoder, the encoding is performed based on the updated individual features;

[0026] When determining the initial features of each node in the graph network model, it is done based on the updated individual features.

[0027] Preferably, the method further comprises:

[0028] When the individual feature encoder is trained, the updated individual feature output by the encoding is compared with the individual prompt word feature for similarity to determine the loss function of the individual feature encoder.

[0029] Preferably, the graph network model is a factor graph model;

[0030] The nodes of the factor graph include regular nodes and factor nodes;

[0031] The conventional nodes include target nodes for representing targets and interactive nodes for representing the interactive relationship between any two targets;

[0032] The factor nodes include first-type factor nodes and second-type factor nodes; the factor nodes are triplet consisting of three regular nodes, and for the first-type factor nodes, the triplet includes any two targets and their mutual interaction; for the second-type factor nodes, the triplet includes any two-to-two interaction among the three targets;

[0033] An edge is set between the factor node and the regular nodes included in its triplet, and an edge is set between the interaction node and two specified target nodes; wherein the specified target nodes are target nodes corresponding to the two targets of the interaction relationship represented by the interaction node.

[0034] Preferably, the determining the initial features of each node in the graph network model based on the individual features and the interaction features includes:

[0035] The initial feature of the target node is the individual feature of the target corresponding to the node;

[0036] The initial feature of the interaction node is the interaction feature of the interaction relationship corresponding to the node;

[0037] The initial feature of the factor node is the average initial feature of the three nodes included in the triple of the factor node.

[0038] Preferably, when the features of each node in the graph network model are iteratively updated,

[0039] Determine the feature of the corresponding factor node after the current iteration based on the factor node feature determined after the last iteration of each factor node and the node features determined after the last iteration of each regular node having an edge with the factor node;

[0040] Based on the node features determined after the last iteration for each of the regular nodes and the node features determined after the last iteration for each factor node having an edge with the regular node, the features of the corresponding regular nodes after the current iteration are determined.

[0041] Preferably, the updated interaction feature is an updated output node feature of the interaction node;

[0042] The method further comprises:

[0043] The activity of each target is determined based on the updated output node feature of the target node, and the key target is determined based on the activity.

[0044] Preferably, the method further comprises:

[0045] The parameters for updating the features of the graph network model, the parameters for encoding the output node features, and the parameters for group division and identification are determined in advance through a training process.

[0046] Preferably, the loss function of the training process is determined based on the similarity loss of the interaction adjacency matrix and the binary classification loss of whether each target is a key point, wherein the elements in the interaction adjacency matrix indicate whether there is interaction between any two targets.

[0047] A group detection device, comprising: a feature determination unit, a first language model processing unit, an interactive feature encoder and a group division unit;

[0048] The feature determination unit is used to determine the individual features of each target in the image to be tested;

[0049] A first language model processing unit, configured to extract features of an externally input interactive prompt word using the first language model to obtain interactive prompt word features;

[0050] The interaction feature encoder is used to encode the individual features based on the interaction prompt word features using a pre-trained interaction feature encoding model to obtain interaction features indicating the interaction relationship between any two targets among the targets;

[0051] The group division unit is used to divide and identify groups based on the interaction features;

[0052] Wherein, the interactive feature encoding model is a Transformer model;

[0053] In the interactive feature encoder, encoding the individual features based on the interactive prompt word features includes:

[0054] Performing position coding based on the position relationship between the targets, fusing the position coding result, the interactive prompt word feature and the individual feature, using the fused feature as the input of the interactive feature coding model, and performing coding processing using the interactive feature coding model; or

[0055] Performing position encoding based on the positional relationship between the targets, fusing the position encoding result with the individual features, and processing the fused features as inputs of the interactive feature encoding model; before performing self-attention processing in the interactive feature encoding model, grouping the individual features based on the interactive prompt word features, and performing self-attention processing in the interactive feature encoding model based on the grouping results;

[0056] and / or,

[0057] The apparatus further comprises a graph network processing unit and a population encoding unit;

[0058] The graph network processing unit is used to construct a graph network model; it is also used to determine the initial features of each node in the graph network model based on the individual features and the interaction features, and iteratively update the features of each node in the graph network model to determine the output node features of each node so that the nodes can learn from each other; wherein the nodes of the graph network model include the target, the interaction relationship between any two targets, and the group relationship, and the group relationship is used to characterize the consistency relationship between different interaction relationships;

[0059] The group encoding unit is used to encode the output node features based on the guidance of the externally input group prompt words, and determine the updated output node features;

[0060] The group division unit is used to perform group division and identification based on the updated interaction features included in the updated output node features.

[0061] Preferably, when the interaction feature encoding model is a Transformer model, in the group division unit, the group division and identification based on the interaction features includes:

[0062] The interaction features are input into a pre-trained behavior inference model, and the interaction features are classified using the behavior inference model to predict a group classification result, and the probability of an interaction relationship between any two targets is predicted based on the interaction features, and the any two targets with a probability greater than or equal to an interaction threshold are regarded as a pair of targets with an interaction relationship;

[0063] The groups are divided based on all the determined interaction relationships, the targets that have interaction relationships with each other are divided into the same group, and the group classification result is used as the classification recognition result of the divided group.

[0064] Preferably, the device further comprises a second language model processing unit, which is used to extract features of the individual prompt words using the second language model to obtain features of the individual prompt words;

[0065] The device further comprises an individual feature encoder, which is used to encode the individual feature based on the guidance of the individual prompt word feature using the trained individual feature encoder to obtain an updated individual feature;

[0066] When encoding the individual features using the interactive feature encoding model in the interactive encoding unit, the encoding is performed based on the updated individual features;

[0067] When determining the initial features of each node in the graph network model in the graph network processing unit, it is done based on the updated individual features.

[0068] Preferably, when the individual feature encoder is trained, the updated individual feature output by the encoding is compared with the individual prompt word feature for similarity to determine the loss function of the individual feature encoder.

[0069] Preferably, the graph network model is a factor graph model;

[0070] The nodes of the factor graph include regular nodes and factor nodes;

[0071] The conventional nodes include target nodes for representing targets and interactive nodes for representing the interactive relationship between any two targets;

[0072] The factor nodes include first-type factor nodes and second-type factor nodes; the factor nodes are triplet consisting of three regular nodes, and for the first-type factor nodes, the triplet includes any two targets and their mutual interaction; for the second-type factor nodes, the triplet includes any two-to-two interaction among the three targets;

[0073] An edge is set between the factor node and the regular nodes included in its triplet, and an edge is set between the interaction node and two specified target nodes; wherein the specified target nodes are target nodes corresponding to the two targets of the interaction relationship represented by the interaction node.

[0074] Preferably, in the graph network processing unit, determining the initial features of each node in the graph network model based on the individual features and the interaction features includes:

[0075] The initial feature of the target node is the individual feature of the target corresponding to the node;

[0076] The initial feature of the interaction node is the interaction feature of the interaction relationship corresponding to the node;

[0077] The initial feature of the factor node is the average initial feature of the three nodes included in the triple of the factor node.

[0078] Preferably, in the graph network processing unit, when the features of each node in the graph network model are iteratively updated,

[0079] Determine the feature of the corresponding factor node after the current iteration based on the factor node feature determined after the last iteration of each factor node and the node features determined after the last iteration of each regular node having an edge with the factor node;

[0080] Based on the node features determined after the last iteration for each of the regular nodes and the node features determined after the last iteration for each factor node having an edge with the regular node, the features of the corresponding regular nodes after the current iteration are determined.

[0081] Preferably, when the device further includes a graph network processing unit and a group encoding unit, the group division unit is further used to determine the activity of each target based on the updated output node characteristics of the target node, and determine the key target based on the activity.

[0082] Preferably, the device further includes a joint training unit for determining, in advance through a training process, parameters for updating features of the graph network model, parameters for encoding features of the output nodes, and parameters for group division.

[0083] Preferably, the loss function of the training process is determined based on the similarity loss of the interaction adjacency matrix and the binary classification loss of whether each target is a key point, wherein the elements in the interaction adjacency matrix indicate whether there is interaction between any two targets.

[0084] A computer-readable storage medium stores computer instructions, which, when executed by a processor, can implement any of the above-mentioned group detection methods.

[0085] An electronic device comprising at least a computer-readable storage medium and a processor;

[0086] The processor is used to read executable instructions from the computer-readable storage medium and execute the instructions to implement any of the above-mentioned group detection methods.

[0087] It can be seen from the above technical scheme that in the present application, the individual features of each target in the image to be tested are determined, and the first language model is used to extract features of the externally input interaction prompt words to obtain the interaction prompt word features, so that the interaction characteristics between the targets can be described at the semantic level; next, the pre-trained interaction feature encoding model is used to encode the individual features based on the interaction prompt word features to obtain the interaction features for indicating the interaction relationship between any two targets among the targets; in this way, the semantic information of the interaction characteristics can be referred to, and the individual features of the targets can be encoded to obtain the interaction features, so as to ensure that the interaction features can reflect the interaction relationship consistent with the interaction prompt words, and improve the accuracy of the interaction features and the accuracy of the interaction relationship reflected by the interaction features; finally, group division and identification are performed based on the interaction features, and group division is performed using more accurate interaction features, which can effectively improve the accuracy of group detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] Figure 1 It is a schematic diagram of the basic process of the group detection method in this application;

[0089] Figure 2 This is a schematic diagram of a specific process of the group detection method in Example 1 of the present application;

[0090] Figure 3 This is a schematic diagram of the framework of the group detection method in Example 1 of the present application;

[0091] Figure 4 This is a specific schematic diagram of the group detection method in Example 2 of the present application;

[0092] Figure 5 This is a schematic diagram of the framework of the group detection method in Example 2 of the present application;

[0093] Figure 6 This is a schematic diagram of the edge of the graph network model in the second embodiment of the present application;

[0094] Figure 7 A schematic diagram of the nodes and their relationships in the graph network model in the second embodiment of the present application;

[0095] Figure 8 It is a basic structural diagram of the group detection device in this application;

[0096] Fig. 9 This is a schematic diagram of the basic structure of the electronic device provided in this application. DETAILED DESCRIPTION

[0097] In order to make the objectives, technical means and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings.

[0098] The present application provides a group detection method, which introduces interactive prompt words to represent the semantic features of the interactive relationship between different targets in a group, and uses the interactive prompt words to guide the acquisition of interactive features, so that group detection can avoid being restricted by scenes and avoid the complexity of manual parameter adjustment, so that the group segmentation results meet user needs and can effectively improve the accuracy of group detection.

[0099] Figure 1 The basic flow chart of the group detection method in this application is as follows: Figure 1 As shown, the method includes:

[0100] Step 101, determining the individual features of each target in the image to be tested.

[0101] The individual characteristics of the target include but are not limited to speed, acceleration, posture, direction, etc.

[0102] When obtaining individual features, it can be based on a current single image frame or a current group of image frames. The specific processing of determining individual features can adopt various existing methods, and can usually be performed using a neural network model.

[0103] Step 102: extract features of the externally input interactive prompt words using the first language model to obtain interactive prompt word features.

[0104] In order to obtain more accurate and user-friendly features for group detection, interaction prompt words can be input externally to describe the interactive information of interest. In order to introduce the semantic information of interaction prompt words into group detection, this step uses the first language model to extract features of interaction prompt words to obtain interaction prompt word features, thereby obtaining semantic features of the interactive relationship between different targets, and in subsequent processing, based on the guidance of interaction prompt word features, encode individual features to obtain interaction features, so that the interaction features conform to the semantic description of interaction prompt words.

[0105] Step 103, using a pre-trained interaction feature encoding model, based on the interaction prompt word features, encodes the individual features to obtain interaction features for indicating the interaction relationship between any two targets in each target.

[0106] In this step, the pre-trained interactive feature encoding model is used to encode the individual features to obtain interactive features used to describe the interactive relationship between different targets. The interactive feature encoding model can be an existing neural network model, such as a transformer structure, a CNN structure, a GCN structure, etc.

[0107] Specifically, the Transformer structure model introduces a self-attention mechanism, which can more effectively refine and aggregate individual features. Compared with the RNN and CNN structure models, it can have a better effect on the recognition of interactive relationships.

[0108] At the same time, as mentioned above, the interaction prompt word features are determined through step 102. This step is based on the interaction prompt word features in the process of encoding individual features to determine the interaction features. This can ensure that the interaction features reflect the interaction relationship consistent with the interaction prompt words, thereby improving the accuracy of the interaction features.

[0109] In addition, in order to further improve the accuracy of the target description of the individual features, and thus improve the accuracy of the interactive features, optionally, an externally input individual prompt word can be introduced, and before the individual features are input into the interactive feature encoding model, the individual prompt word is used to guide the encoding of the individual features, and then the encoding result is input into the interactive feature encoding model as the updated individual features. At the same time, in order to facilitate the use of individual prompt words to encode individual features, optionally, the trained second language model can be used to extract features of the individual prompt words to obtain individual prompt word features, and then the encoding of the individual features is guided based on the individual prompt word features.

[0110] Step 104: group division and identification based on the interaction features.

[0111] Through the above processing, the interactive features that meet the requirements of the interactive prompt words are obtained, and finally the groups are divided according to the interactive features, and the categories of the groups are identified.

[0112] Most basically, the classification category of a group can be determined based on the interaction feature, for example, the interaction feature is input into the classification network to determine the group classification corresponding to the interaction feature. At the same time, the interaction feature reflects the interaction relationship between any two targets. The probability of an interaction relationship between any two targets can be determined based on the interaction feature, and the two targets with a probability greater than or equal to the interaction threshold are regarded as a pair of targets with an interaction relationship; then, the group division is performed based on all the determined interaction relationships, and the targets with an interaction relationship between each other are divided into the same group, and the divided group category is set to the group classification determined above.

[0113] At this point, the group detection method process in this application ends. Figure 1 The method shown in the process uses interactive prompt words to guide the relationship learning between targets, so as to effectively determine the interactive relationship that meets user needs and perform accurate group division.

[0114] In the above Figure 1 On the basis of the group detection method shown, after the interactive feature coding model is used to determine the interactive feature coding, the following processing on the graph network model can be further included to obtain more accurate updated interactive features for further improving the accuracy of group identification. Specifically, the following processing can be added between step 103 and step 104:

[0115] Step 103a, constructing a graph network model, the nodes of which include targets, interaction relationships between any two targets, and group relationships.

[0116] Among them, group relations are used to characterize the consistency relations between different interactive relations. In this way, the graph network model structure can reflect the targets, the interactive relations between targets, and the consistency relations between different interactive relations, thereby reflecting the mutual influence and interactive relations between the targets in the image, as well as the mutual influence and transmission between these interactive relations.

[0117] Step 103b, determining the initial features of each node in the graph network model based on the individual features and the interaction features, and iteratively updating the features of each node in the graph network model to determine the output node features of each node so that the nodes can learn from each other.

[0118] Graph neural networks are a type of deep learning model used to process graph structured data. They can aggregate the neighbor information of model nodes and update the feature representation of nodes through a message passing mechanism. In this application, the learning of features and relationships between targets is achieved by updating node features in the graph neural network model.

[0119] Specifically, the initial features of each node in the graph network model are first determined based on individual features and interaction features, and then the features of each node in the graph network model are iteratively updated to determine the output node features of each node, so that the nodes can learn from each other. The output node features include the updated interaction features processed by the graph network model.

[0120] Step 103c: Based on the guidance of the externally input group prompt words, the output node features are encoded to determine the updated output node features.

[0121] In order to guide the relationship learning, the present application receives external input group prompt words, and encodes the output node features under the guidance thereof to determine the updated output node features of each type of node.

[0122] Specifically, after determining the output node features, according to the guidance of the group prompt word, the group encoder is used to encode the different output node features respectively to obtain the updated output node features. Due to the guidance of the group prompt word, when encoding the output node features, the output node features that meet the group prompt word can be extracted, so that the updated output node features meet the requirements of the group prompt word.

[0123] In addition, to facilitate guidance, the language model can be used in advance to extract features of group prompt words to obtain group prompt word features, and then the output node features are encoded based on the group prompt word features.

[0124] Further, in step 104, group division and identification are performed based on the updated interaction features. Meanwhile, in addition to using the interaction features to divide and identify groups, further optionally, the activity of each target can be determined based on the updated individual features, and key targets can be determined based on the activity of each target.

[0125] The specific implementation of this application is described below through two specific embodiments.

[0126] Embodiment 1:

[0127] Figure 2 Schematic diagram of a specific process of the group detection method in the first specific embodiment. Figure 3 Schematic diagram of the framework of the group detection method in the specific embodiment 1. In this embodiment, individual prompt words and interactive prompt words are introduced to guide the encoding of individual features and interactive features, and the language model is used to extract features of individual prompt words and interactive prompt words to facilitate subsequent processing, such as Figure 2 and Figure 3 As shown, the group detection method of the specific embodiment includes:

[0128] Step 201 : Using a language model, feature extraction is performed on externally input individual prompt words and interactive prompt words to obtain individual prompt word features and interactive prompt word features.

[0129] The language model includes but is not limited to GPT, Bert, LLaMa, etc. Individual prompt words are prompt words that describe each target, such as "a person waving", "a person kicking", etc.; interactive prompt words are prompt words that describe the interaction between any two targets, such as "two people hitting each other", etc. Among them, the same language model can usually be used for feature extraction for individual prompt words and interactive prompt words. Of course, it is not excluded that the two can use different language models for feature extraction, and this application does not limit this.

[0130] Step 202: determine the individual features of each target in the image to be tested.

[0131] The individual characteristics can be obtained by various existing methods, and this application does not limit the acquisition method.

[0132] Step 203: Under the guidance of the individual prompt word features, the individual features are encoded using the individual encoding model.

[0133] Among them, the individual coding model is used to extract the individual features again and generate updated individual features. Figure 3 The individual features shown are the individual features updated in this step. The specific model can be a traditional single-person behavior recognition model. The form of the individual encoding model includes but is not limited to the Transformer structure, the CNN structure, etc. In the individual encoding model, after the feature extraction structure, the individual prompt word features extracted by the language model are aligned.

[0134] When training the individual encoding model, the output updated individual features can be compared with the individual prompt word features to calculate the loss function for updating the parameters of the individual encoding model.

[0135] Step 204: Based on the interactive prompt word features, the individual features are encoded using a pre-trained interactive feature encoding model.

[0136] As mentioned above, the interactive feature encoding model can be an existing neural network model, such as a transformer structure, a CNN structure, a GCN structure, etc. In this embodiment, a model with a transformer structure is adopted.

[0137] The model of the Transform structure consists of two parts: an encoder and a decoder. The encoder receives an input sequence (source), which is processed by a stack of identical layers consisting of a "multi-head self-attention mechanism" and a "fully connected feedforward network". The decoder then generates an output sequence (target) based on the representation generated by the encoder. In order to be able to successfully use the Transform model to reason about the relationships and interactions between group behavior participants, the self-attention mechanism is a key factor. Therefore, the self-attention mechanism itself is further described below, as well as how the Transform model is applied to group activity recognition tasks.

[0138] Attention A is a function that represents a weighted sum of “values ​​V”. The weights are calculated by matching a “query Q” with a set of “keys K”. The matching function can have different forms, the most popular being the scaled dot product. Formally, attention with a scaled dot product matching function can be written as:

[0139] Where d is the dimension of the query Q and key K. In the self-attention module, all three representations (Q, K, V) are computed from the input sequence S by linear projection, so A(S) = A(Q(S), K(S), V(S)).

[0140] Since attention is a weighted sum of all values, it overcomes the problem of forgetting over time. In sequence-to-sequence modeling, this mechanism gives more weight to the most relevant words in the source sequence. This is also a desirable property for group activity recognition, as the information of each actor’s features can be enhanced based on other actors in the scene without any spatial constraints. Multi-head attention is an extension of attention with several parallel attention functions using independent linear projections of (Q, K, V):

[0141]

[0142]

[0143] The encoder layer E of the Transform model consists of multi-head attention combined with a feed-forward neural network L:

[0144]

[0145] The encoder E can contain several such layers that process the input feature sequence S sequentially.

[0146] For the group behavior recognition task, the input feature sequence S of the model is a set of individual feature representations S = {s i |i=1, .., N} (multiple branches in parallel, one type of feature corresponds to one encoder). Since feature s i No specific order is followed, so the self-attention mechanism is a model that is more suitable for refining and aggregating these features than RNN and CNN. Compared with the method of using a graph network model to model interactive features in Example 2, the interactive feature encoding model in this step relies on the self-attention mechanism and does not require additional explicit modeling of the connection between nodes through appearance and position relationships.

[0147] As for the spatial relationship between the behavior participants, the encoder can use the individual features s i can be implicitly exploited by encoding the position of i ,y i ) represents the characteristics of each participant s i Each bounding box b i , and use PE encoding center point to achieve this.

[0148] For PE encoding, assume there is an input sequence of length L and the position of the object in this sequence is required. The position encoding is given by sine and cosine functions of different frequencies as follows:

[0149]

[0150] where d represents the dimension of the output embedding space; pos represents the position of the object in the input sequence, 0 ≤ pos ≤ L / 2; i is used to map to the column index, where 0 ≤ i < d / 2, and a single value of i also maps to sine and cosine functions; in summary, as can be seen in the above expressions, the sine function is used for even positions and the cosine function is used for odd positions.

[0151] Applying the model with the above Transformer structure to the interactive feature generation process in this embodiment, the process of encoding individual features using the interactive feature encoding model in this step can be obtained. Two implementation methods are given in this embodiment:

[0152] I. Perform position encoding based on the positional relationship between each target; fuse the position encoding result, interactive prompt word feature, and individual feature, and use the fused feature as the input of the interactive feature encoding model for encoding processing;

[0153] In this implementation method, on the one hand, spatial information between targets is obtained through position encoding, and on the other hand, the interactive semantic information between targets is expressed using the interactive prompt word feature. The above spatial information, semantic information, and individual feature are fused, and the fused feature is processed by the Transformer encoder.

[0154] II. Perform position encoding based on the positional relationship between each target, fuse the position encoding result and individual feature, and use the fused feature as the input of the interactive feature encoding model for processing; before the self-attention processing in the interactive feature encoding model, group the individual features based on the interactive prompt word feature, and the self-attention processing in the interactive feature encoding model is based on the grouped results;

[0155] In this implementation method, the interactive prompt word feature is no longer fused with the individual feature as the encoder input, but the interactive prompt word feature is used as prior information to group the individual features, that is, group the targets, and perform multi-head attention encoding within each group. In this way, the feature information between targets with interactive relationships can be captured as much as possible, and the information interference between irrelevant targets can be reduced.

[0156] The interactive feature is processed by the interactive feature encoding model and output. On the one hand, the interactive feature is obtained based on the interactive prompt word feature, so it can reflect the interactive relationship that conforms to the semantic information given by the interactive prompt word. On the other hand, the interactive feature is based on the Transformer structure model, which can effectively model the relationship between different targets through the self-attention mechanism, and generate interactive features that reflect the interactive relationship between different targets, without the need to explicitly model the connection relationship between different targets.

[0157] Step 205 , performing group division and identification based on the interaction features determined in step 204 .

[0158] The group segmentation and identification process includes two branches: behavior classification and group segmentation. Figure 3 It is implemented by the behavior reasoning module and group detection result output module shown.

[0159] Specifically, the behavior reasoning module consists of two branches:

[0160] Branch 1: It can be the classification head in the behavior recognition model. The commonly used one is the linear head, which is composed of several fully connected layers. After processing, this branch outputs an N×C category probability vector. Each element in the vector represents the probability value of sample i belonging to group category j, where i is the sample index, j is the group category index, N is the number of samples, and C is the number of group categories. During the training process, the true value label is the actual group category corresponding to the sample. Here, the behavior reasoning module and the interactive feature encoding model are jointly trained. A sample is a set of individual features that are input into the interactive feature encoding model at a single time.

[0161] Branch 2: It is used to obtain the interaction relationship between each target and output an N×K×K interaction probability map, in which the elements represent the probability information of the interaction relationship between target j and target k in each sample i. K is the number of individuals in a single sample (i.e., the number of targets). During the training process, the true value label is the target interaction map (the corresponding element is 1 if there is an interaction relationship between target j and target k in each sample i, and the corresponding element is 0 if there is no interaction relationship between target j and target k). Note that the K value is predefined based on the training test set.

[0162] After being processed by the above-mentioned behavior inference module, on the one hand, the group category corresponding to the current sample is obtained, and on the other hand, the interaction probability between each target in the current sample is obtained.

[0163] In the group detection result output module, group division is performed based on the interaction probability graph output by the behavior reasoning module. Specifically, for each sample, any two targets with an interaction probability greater than or equal to the interaction threshold are regarded as a pair of targets with an interaction relationship. Group division is performed based on all determined interaction relationships, and targets with an interaction relationship are divided into the same group; finally, the divided groups are obtained for each sample. In the group detection result output module, the group category corresponding to each sample is determined based on the category probability vector output by the behavior reasoning module.

[0164] As mentioned above, the group detection result output unit obtains the group division result corresponding to each sample on the one hand, and obtains the group category corresponding to each sample on the other hand. The two types of results are combined and output as the group recognition result, that is, the determined group category B of any sample A is output as the group category of the corresponding group divided from the sample A, that is, for a sample composed of multiple individual features, the group divided from the corresponding sample and the group category of the group are output.

[0165] At this point, the method flow in Example 1 ends.

[0166] Embodiment 2:

[0167] Figure 4 is a schematic diagram of a specific flow chart of the group detection method in the second specific embodiment, Figure 5 Schematic diagram of the framework of the group detection method in the second specific embodiment. In this embodiment, individual prompt words, interactive prompt words and group prompt words are introduced to guide the encoding of individual features, interactive features and group features, and the language model is used to extract features of individual prompt words, interactive prompt words and group prompt words to facilitate subsequent processing, such as Figure 4 and Figure 5 As shown, the group detection method of the specific embodiment includes:

[0168] Step 401 , using a language model, extracting features of externally input individual prompt words, interactive prompt words and group prompt words to obtain individual prompt word features, interactive prompt word features and group prompt word features.

[0169] Among them, language models include but are not limited to GPT, Bert, LLaMa, etc. Individual prompt words are prompt words that describe each target, such as "a person waving", "a person kicking", etc.; interactive prompt words are prompt words that describe the interaction between any two targets, such as "two people hitting each other", etc.; group prompt words are prompt words that describe the whole picture, such as "in the square scene, there are two people fighting in the lower right corner of the picture", etc.

[0170] Step 402, determining the individual features of each target in the image to be tested.

[0171] The individual characteristics can be obtained by various existing methods, and this application does not limit the acquisition method.

[0172] Step 403: Under the guidance of the individual prompt word feature, the individual feature is encoded using the individual encoder; under the guidance of the interactive prompt word feature, the individual feature is encoded using the interactive encoder.

[0173] Among them, the individual encoder is used to extract the individual features again to generate updated individual features. The interactive encoder is used to encode the individual features and generate interactive features that represent the relationship between targets. The forms of the individual encoder and the interactive encoder include but are not limited to the Transformer structure, the CNN structure, etc. In the individual encoder and the interactive encoder, after the feature extraction structure, they are aligned with the individual prompt word features and the interactive prompt word features extracted by the language model respectively.

[0174] When training an individual encoder, the output updated individual features can be compared with the individual prompt word features, and the loss function can be calculated to update the parameters of the individual encoder; when training an interactive feature encoder, the output interactive features can be compared with the interactive prompt word features, and the loss function can be calculated to update the parameters of the interactive encoder.

[0175] The interactive encoder may use the interactive feature encoding model of the Transformer structure described in the first embodiment to determine the interactive features, or may simply use a model of a CNN or RNN structure to fuse and encode individual features. When the interactive feature encoding model of the Transformer structure described in the first embodiment is used to determine the interactive features, the system does not need to include Figure 3 The behavior reasoning module and the group detection result output module in the process are used to train the interactive feature encoding model.

[0176] Step 404, constructing a graph network model.

[0177] In this embodiment, interaction graph modeling is performed, so that graph elements such as edges and nodes are used to represent individual and interaction features, including but not limited to single-graph modeling of a single interaction relationship of a target and multi-graph modeling of multiple interaction relationships.

[0178] In this embodiment, factor graph is used as an example to illustrate the modeled graph network model. The structure of factor graph includes nodes and edges, where nodes are divided into two types, namely regular nodes and factor nodes. . Regular Node Contains two sets ,and .in Represents a collection of single targets, and such nodes are called target nodes. Represents a collection of interactive information between targets. Such nodes are called interactive nodes. Interactive nodes can be represented by the interactive features between targets:

[0179]

[0180] Factor nodes are divided into two types , a node It is strongly correlated with the interaction relationship between targets, indicating the association between individual features and interaction relationships, that is, the relationship of interaction consistency between targets, and is used for interaction and individual feature learning between two targets.

[0181]

[0182] Another type of factor node is based on a higher-order ternary relationship, which is used to learn the consistency of the interaction relationship between triplets (here "tuple" represents a target pair). In more detail, it represents the consistency relationship between the interactions between any two of the three targets. In other words, it is to learn the transitive relationship of the interaction (such as behavioral interaction), that is, if i interacts with j, and j interacts with k, then the interaction relationship between i and k should be affected by the transitive influence of j.

[0183]

[0184] As can be seen from the above, for both types of factor nodes, their composition includes a triplet. The first type of factor node The ternary specifically includes two goals and the interaction between the two goals. The second type of factor node The triad includes the interactive relationships between any two of the three goals.

[0185] Finally, for each triple in a factor node Connect Edges ,At the same time, for each interaction node, connect the interaction node with the two targets involved in the interaction relationship, such as Figure 6 shown.

[0186] More simply, taking the interaction between individuals as an example, refer to Figure 7 , circles represent two different types of regular nodes: the green circle is the action variable, which indicates the action category of each person, and the orange circle (interactive variable) is the interaction variable, which indicates whether there is interaction between two people; the square represents two different factor nodes, the blue square represents the relationship of behavioral interaction consistency, and the yellow square represents the relationship of interactive transitivity.

[0187] The above is the graph network model in this embodiment. Of course, in practical applications, probabilistic graph network models with other structures can also be selected, such as Bayesian graph, Markov graph, etc.

[0188] Step 405, determining the initial features of each node in the graph network model based on the individual features and the interaction features.

[0189] The initial features of each node in the graph network model are the node features in the initial graph. For the target node, its initial features are the updated individual features corresponding to the target determined in step 403. f i For an interactive node, its initial feature is the updated interactive feature corresponding to the interactive relationship determined in step 403 .

[0190] The initial characteristics of the first type of factor nodes are:

[0191]

[0192] The initial characteristics of the second type of factor nodes are:

[0193]

[0194] The edge features are:

[0195]

[0196] The edge features here are used for subsequent updating of node features.

[0197] Step 406, iteratively update the features of each node in the graph network model to determine the output node features of each node.

[0198] In the graph network model, mutual learning between nodes is achieved by updating node features. Node feature updates can be performed through feature extraction structures. To obtain better node feature representation, a multi-layer feature extraction structure can be used. In this embodiment, the MLP multi-layer perception network is used as an example of a feature extraction structure for mechanical explanation. Assume that the number of layers of the factor graph network (FGNN) corresponding to the graph network model is L, that is, L layers of the same feature extraction structure. Each layer updates the node features once, and then uses the node features of the current layer as the input of the feature extraction structure of the next layer, where the first l The factor node characteristics of the +1 layer are:

[0199]

[0200] Among them, M and Q are MLP multi-layer perception networks, and are the parameters of the multi-layer perception network, represents the maximum pooling operation, Represents factor node c and all regular nodes connected to it. Factor nodes may be or .

[0201] No. l The regular node characteristics of the +1 layer are:

[0202]

[0203] Represents a regular node i and all factor nodes connected to it. A regular node may be a target node or an interaction node.

[0204] Through steps 405 and 406, the learning of the interactive relationship can be realized, and the graph network model of the node outputs the node features.

[0205] Step 407 , based on the guidance of the group prompt word features, the output node features are encoded respectively to determine the updated output node features.

[0206] In this step, the output node features are input into the trained group interaction encoder together with the group prompt word features, and the updated output node features are output after being processed by the group interaction encoder. Among them, the group prompt word features are used to guide the encoding process and output the output node features consistent with the group prompt word feature characteristics.

[0207] The group interaction encoder includes, but is not limited to, a Transformer structure, a CNN structure, etc. In the group interaction encoder, the feature extraction structure is aligned with the group prompt word features extracted by the language model.

[0208] When training the group interaction encoder, the output node features can be compared with the group prompt word features, and the loss function can be calculated to update the parameters of the group interaction encoder so that the group interaction encoder can output output node features that are consistent with the group prompt word features.

[0209] This step mainly processes the output node features of each regular node, that is, processes the output node features of the target node and the interactive node.

[0210] The processing of steps 405 to 407 above corresponds to Figure 5 The processing of the community interaction learning module in the method can obtain the updated output node features of each node according to the input personal features and interaction features. In addition to reflecting the interaction characteristics between two people, the output node features also reflect the consistency characteristics between different interaction characteristics.

[0211] Step 408: Determine the probability of an interactive relationship between any two targets and the activity of each target based on the updated output node features, and output the key target.

[0212] In this embodiment, group division and identification can be performed in the manner of step 205, wherein the updated output node features of the interactive nodes determined in step 407 are equivalent to Figure 2 The interactive features in the process shown are handled.

[0213] In addition, in addition to outputting the group detection results (i.e., group division results), this embodiment can also output key targets of the group. The key targets of the group can include key targets, group key areas, and heat maps (i.e., activity information of each target) and other different forms of output.

[0214] The activity of a target refers to the probability value of whether the target is a key node. Targets whose activity is greater than the set threshold are output as key targets.

[0215] The activity of a specific target can be determined according to the updated output node features of the target node determined in step 407 in the following manner:

[0216]

[0217] Among them, α is calculated A linear function of the classification score, Indicates the probability of whether an individual target is critical, The updated output node features for the target node.

[0218] In more detail, in order to perform group segmentation, it is also necessary to determine the probability of an interactive relationship between any two targets based on the updated output node features of the target nodes determined in step 407:

[0219]

[0220] Among them, β is a linear function that calculates the classification score of the interaction node, Indicates the probability of whether there is interaction between targets, Output node features after interaction node update.

[0221] Step 409: any two targets with a probability greater than or equal to the interaction threshold are regarded as a pair of targets with an interaction relationship, the targets with an interaction relationship are classified into the same group, and the group category is determined.

[0222] Similar to the first embodiment, whether there is an interaction between the two targets is determined based on the probability that there is an interaction relationship between the two targets, and when performing group division, the targets that have an interaction relationship with each other are divided into the same group; classification processing is performed based on the output node features after the interaction node is updated to determine the group category of this output, and the determined group category is used as the category information of the aforementioned divided group.

[0223] So far, Figure 4 The method flow shown ends. Figure 4 In the processing of , the processing of steps 403 to 409 involves multiple neural networks and parameters that need to be determined in advance, specifically including individual encoders, interaction encoders, feature extraction structures in graph networks, functions for calculating the probability of interaction between targets in group division, and functions for calculating the probability of a target being a key node. In order to determine these neural networks and related parameters, it is necessary to pre-train the entire processing of steps 403 to 409. In this training, the training data is labeled with the true value of the group and the key targets in the group, and the group true value is converted into the true value of the interaction relationship of the targets in the group. Specifically, the factor nodes and interaction nodes between the targets in the same group are 1, and the other factor nodes and interaction nodes are 0. The loss function of the training is the similarity loss of the interaction adjacency matrix, and can also include a binary classification loss (such as a cross entropy loss) of whether the target is a key point, where the elements in the interaction adjacency matrix indicate whether there is an interaction between any two targets. For example, if the target I interacts with J, the element at the corresponding position is 1. Through the joint training of the entire steps 403 to 409, the various encoders, feature extraction structures and group divisions can cooperate with each other, and reasonable relationship learning and group division can be carried out under the guidance of individual prompt words, interactive prompt words and group prompt words.

[0224] The above is the specific implementation of the group detection method in Example 2. In this method, pre-trained encoders, graph network models, feature extraction architectures, group division methods, etc. are used to perform reasonable group division; at the same time, multi-level prompt words are added to interactive learning for multi-modal interactive relationship learning, and by guiding the feature learning of individuals, interactions, and groups, the problems of single features and cumbersome clustering parameter debugging in common methods are alleviated, and interactive relationships with similar features are distinguished at the same time, onlookers are removed, and the accuracy of group detection is improved.

[0225] The present application also provides a group detection device, which can be used to implement the group detection method of the present application. Figure 8 Schematic diagram of the basic structure of the group detection device in this application. Figure 8 As shown, the method includes: a feature determination unit, a first language model processing unit, an interactive feature encoder and a group division unit;

[0226] The feature determination unit is used to determine the individual features of each target in the image to be tested;

[0227] A first language model processing unit, configured to extract features of an externally input interactive prompt word using the first language model to obtain interactive prompt word features;

[0228] An interactive feature encoder is used to encode individual features based on interactive prompt word features using a pre-trained interactive feature encoding model to obtain interactive features indicating the interactive relationship between any two targets in each target;

[0229] The group segmentation unit is used to perform group segmentation and identification based on interaction features.

[0230] Among them, the interactive feature encoding model is the Transformer model;

[0231] In the interactive feature encoder, the operation of encoding individual features based on the interactive prompt word features may specifically include:

[0232] Position encoding is performed based on the positional relationship between each target, the position encoding result, the interactive prompt word feature and the individual feature are fused, the fused feature is used as the input of the interactive feature encoding model, and the interactive feature encoding model is used for encoding processing; or,

[0233] Position encoding is performed based on the positional relationship between each target, the position encoding result and the individual feature are fused, and the fused feature is processed as the input of the interactive feature encoding model; before the self-attention processing is performed in the interactive feature encoding model, the individual features are grouped based on the interactive prompt word features, and the self-attention processing in the interactive feature encoding model is performed based on the grouping results;

[0234] and / or,

[0235] The apparatus may further include a graph network processing unit and a group encoding unit;

[0236] A graph network processing unit, used to construct a graph network model; further used to determine the initial features of each node in the graph network model based on individual features and interaction features, and iteratively update the features of each node in the graph network model to determine the output node features of each node, so that the nodes can learn from each other; wherein the nodes of the graph network model include targets, interaction relationships between any two targets, and group relationships, and the group relationships are used to characterize the consistency relationship between different interaction relationships;

[0237] A group encoding unit, used for encoding output node features based on the guidance of externally input group prompt words, and determining updated output node features;

[0238] A group division unit is used to perform group division and identification based on the updated interaction features included in the updated output node features.

[0239] Optionally, when the interaction feature encoding model is a Transformer model, in the group segmentation unit, the group segmentation and identification processing based on the interaction features may specifically include:

[0240] The interaction features are input into a pre-trained behavior inference model, and the interaction features are classified using the behavior inference model to predict the group classification results, and the probability of an interaction relationship between any two targets is predicted based on the interaction features, and any two targets with a probability greater than or equal to an interaction threshold are regarded as a pair of targets with an interaction relationship;

[0241] The groups are divided based on all the determined interaction relationships, the targets with interaction relationships are divided into the same group, and the group classification results are used as the classification and recognition results of the divided groups.

[0242] Optionally, the device further comprises a second language model processing unit, which is used to extract features of the individual prompt words using the second language model to obtain features of the individual prompt words;

[0243] The device further includes an individual feature encoder, which is used to encode the individual feature using the trained individual feature encoder based on the guidance of the individual prompt word feature to obtain an updated individual feature;

[0244] When encoding the individual features using the interactive feature encoding model in the interactive encoding unit, it is based on the updated individual features;

[0245] When determining the initial features of each node in the graph network model in the graph network processing unit, it is done based on the updated individual features.

[0246] Optionally, when training the individual feature encoder, the updated individual feature output by the encoding is compared with the individual prompt word feature for similarity to determine the loss function of the individual feature encoder;

[0247] When training the interactive feature encoder, the updated interactive features output by the encoder are compared with the interactive prompt word features for similarity to determine the loss function of the interactive feature encoder.

[0248] Optionally, the graph network model is a factor graph model;

[0249] The nodes of the factor graph include regular nodes and factor nodes;

[0250] Conventional nodes include target nodes used to represent targets and interaction nodes used to represent the interaction relationship between any two targets;

[0251] Factor nodes include first-type factor nodes and second-type factor nodes; factor nodes are ternary entities composed of three regular nodes. For first-type factor nodes, ternary entities include any two targets and their mutual interactions; for second-type factor nodes, ternary entities include any two-to-two interactions among any three targets.

[0252] Edges are set between the factor node and the regular nodes included in its triplet, and edges are set between the interaction node and two specified target nodes; wherein the specified target nodes are target nodes corresponding to the two targets of the interaction relationship represented by the interaction node.

[0253] Optionally, in the graph network processing unit, determining the initial features of each node in the graph network model based on the individual features and the interaction features includes:

[0254] The initial features of the target node are the individual features of the target corresponding to the node;

[0255] The initial feature of an interaction node is the interaction feature of the interaction relationship corresponding to the node;

[0256] The initial feature of a factor node is the average initial feature of the three nodes included in the triple of the factor node.

[0257] Optionally, in the graph network processing unit, when iteratively updating the features of each node in the graph network model,

[0258] Determine the feature of the corresponding factor node after the current iteration based on the feature of each factor node determined after the last iteration and the feature of each regular node having an edge with the factor node determined after the last iteration;

[0259] Based on the node features determined after the last iteration of each regular node and the node features determined after the last iteration of each factor node having an edge with the regular node, the features of the corresponding regular node after the current iteration are determined.

[0260] Optionally, when the device further includes a graph network processing unit and a group encoding unit, the group division unit is further used to determine the activity of each target based on the updated output node features of the target node, and determine the key target based on the activity.

[0261] Optionally, the device further includes a joint training unit for determining in advance through a training process parameters for updating features of a graph network model, parameters for encoding output node features, and parameters for performing group division in a group detection model.

[0262] Optionally, the loss function of the training process is determined based on the similarity loss of the interaction adjacency matrix and the binary classification loss of whether each target is a key point, wherein the elements in the interaction adjacency matrix indicate whether there is an interaction between any two targets.

[0263] The present application also provides a computer-readable storage medium that stores instructions, which, when executed by a processor, can execute the steps in the group detection method described above. In practical applications, the computer-readable medium can be included in each device / apparatus / system in the above embodiments, or it can exist independently without being assembled into the device / apparatus / system. Instructions are stored in a computer-readable storage medium, and the instructions stored therein can execute the steps in the group detection method described above when executed by a processor.

[0264] According to the embodiments disclosed in the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof, but it is not used to limit the scope of protection of the present application. In the embodiments disclosed in the present application, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0265] Fig. 9 This application also provides an electronic device. Fig. 9 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:

[0266] The electronic device may include a processor 901 with one or more processing cores, a memory 902 with one or more computer-readable storage media, and a computer program stored in the memory and executable on the processor. When the program in the memory 902 is executed, a group detection method may be implemented.

[0267] Specifically, in practical applications, the electronic device may further include components such as a power supply 903, an input / output unit 904, etc. Those skilled in the art may understand that Fig. 9 The structure of the electronic device shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0268] Processor 901 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the server and processes data by running or executing software programs and / or modules stored in memory 902 and calling data stored in memory 902, thereby monitoring the electronic device as a whole.

[0269] The memory 902 can be used to store software programs and modules, that is, the above-mentioned computer-readable storage medium. The processor 901 executes various functional applications and data processing by running the software programs and modules stored in the memory 902. The memory 902 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 902 may also include a memory controller to provide the processor 901 with access to the memory 902.

[0270] The electronic device also includes a power supply 903 for supplying power to various components, which can be logically connected to the processor 901 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 903 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0271] The electronic device may also include an input and output unit 904, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, and optical signal inputs related to user settings and function control. The input unit output 904 may also be used to display information input by the user or information provided to the user and various graphical user interfaces, which may be composed of graphics, text, icons, videos, and any combination thereof.

[0272] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A group detection method, characterized in that: include: Determine the individual characteristics of each target in the image to be tested; Using the first language model to extract features of the externally input interactive prompt words, and obtaining interactive prompt word features; Using a pre-trained interaction feature encoding model, based on the interaction prompt word features, the individual features are encoded to obtain interaction features for indicating the interaction relationship between any two targets among the targets; Performing group segmentation and identification based on the interaction characteristics; Wherein, when the interaction feature encoding model is a Transformer model, encoding the individual features based on the interaction prompt word features includes: Performing position coding based on the position relationship between the targets, fusing the position coding result, the interactive prompt word feature and the individual feature, using the fused feature as the input of the interactive feature coding model, and performing coding processing using the interactive feature coding model; or Performing position encoding based on the positional relationship between the targets, fusing the position encoding result with the individual features, and processing the fused features as inputs of the interactive feature encoding model; before performing self-attention processing in the interactive feature encoding model, grouping the individual features based on the interactive prompt word features, and performing self-attention processing in the interactive feature encoding model based on the grouping results; and / or, After obtaining the interaction features and before performing group division and identification based on the interaction features, the method further includes: Constructing a graph network model; wherein the nodes of the graph network model include the target, the interaction relationship between any two targets, and the group relationship, and the group relationship is used to characterize the consistency relationship between different interaction relationships; Determining initial features of each node in the graph network model based on the individual features and the interaction features, iteratively updating the features of each node in the graph network model, and determining output node features of each node, so that the nodes can learn from each other; Based on the guidance of the external input group prompt words, the output node features are encoded to determine the updated output node features; The performing group division and identification based on the interaction features includes: performing group division and identification based on updated interaction features included in updated output node features.

2. The method according to claim 1, characterized in that The group division and identification based on the interaction features includes: Inputting the interaction features into a pre-trained behavior inference model, classifying the interaction features using the behavior inference model, predicting a group classification result, and predicting the probability of an interaction relationship between any two targets based on the interaction features; The any two targets whose probability is greater than or equal to the interaction threshold are regarded as a pair of targets having an interaction relationship; The groups are divided based on all the determined interaction relationships, the targets that have interaction relationships with each other are divided into the same group, and the group classification result is used as the classification recognition result of the divided group.

3. The method according to claim 1, characterized in that The method further includes: receiving an externally input individual prompt word, and extracting features of the individual prompt word using a second language model to obtain individual prompt word features; After obtaining the individual features, the method further includes: based on the guidance of the individual prompt word features, using a trained individual feature encoder to encode the individual features to obtain updated individual features; When encoding the individual features using the interactive feature encoder, the encoding is performed based on the updated individual features; When determining the initial features of each node in the graph network model, it is done based on the updated individual features.

4. The method according to claim 3, characterized in that The method further comprises: When the individual feature encoder is trained, the updated individual feature output by the encoding is compared with the individual prompt word feature for similarity to determine the loss function of the individual feature encoder.

5. The method according to claim 1, characterized in that The graph network model is a factor graph model; The nodes of the factor graph include regular nodes and factor nodes; The conventional nodes include target nodes for representing targets and interactive nodes for representing the interactive relationship between any two targets; The factor nodes include first-type factor nodes and second-type factor nodes; the factor nodes are triplet consisting of three regular nodes, and for the first-type factor nodes, the triplet includes any two targets and their mutual interaction; for the second-type factor nodes, the triplet includes any two-to-two interaction among the three targets; An edge is set between the factor node and the regular nodes included in its triplet, and an edge is set between the interaction node and two specified target nodes; wherein the specified target nodes are target nodes corresponding to the two targets of the interaction relationship represented by the interaction node.

6. The method according to claim 5, characterized in that The determining the initial features of each node in the graph network model based on the individual features and the interaction features includes: The initial feature of the target node is the individual feature of the target corresponding to the node; The initial feature of the interaction node is the interaction feature of the interaction relationship corresponding to the node; The initial feature of the factor node is the average initial feature of the three nodes included in the triple of the factor node.

7. The method according to claim 5, characterized in that When the features of each node in the graph network model are iteratively updated, Determine the feature of the corresponding factor node after the current iteration based on the factor node feature determined after the last iteration of each factor node and the node features determined after the last iteration of each regular node having an edge with the factor node; Based on the node features determined after the last iteration for each of the regular nodes and the node features determined after the last iteration for each factor node having an edge with the regular node, the features of the corresponding regular nodes after the current iteration are determined.

8. The method according to claim 5, characterized in that The updated interaction feature is the updated output node feature of the interaction node; The method further comprises: The activity of each target is determined based on the updated output node feature of the target node, and the key target is determined based on the activity.

9. The method according to claim 1, characterized in that: The method further comprises: The parameters for updating the features of the graph network model, the parameters for encoding the output node features, and the parameters for group division and identification are determined in advance through a training process.

10. The method according to claim 9, characterized in that The loss function of the training process is determined based on the similarity loss of the interaction adjacency matrix and the binary classification loss of whether each target is a key point, wherein the elements in the interaction adjacency matrix indicate whether there is an interaction between any two targets.

11. A group detection device, characterized in that: The device comprises: a feature determination unit, a first language model processing unit, an interactive feature encoder and a group division unit; The feature determination unit is used to determine the individual features of each target in the image to be tested; A first language model processing unit, configured to extract features of an externally input interactive prompt word using the first language model to obtain interactive prompt word features; The interaction feature encoder is used to encode the individual features based on the interaction prompt word features using a pre-trained interaction feature encoding model to obtain interaction features indicating the interaction relationship between any two targets among the targets; The group division unit is used to divide and identify groups based on the interaction features; Wherein, the interactive feature encoding model is a Transformer model; In the interactive feature encoder, encoding the individual features based on the interactive prompt word features includes: Performing position coding based on the position relationship between the targets, fusing the position coding result, the interactive prompt word feature and the individual feature, using the fused feature as the input of the interactive feature coding model, and performing coding processing using the interactive feature coding model; or Performing position encoding based on the positional relationship between the targets, fusing the position encoding result with the individual features, and processing the fused features as inputs of the interactive feature encoding model; before performing self-attention processing in the interactive feature encoding model, grouping the individual features based on the interactive prompt word features, and performing self-attention processing in the interactive feature encoding model based on the grouping results; and / or, The apparatus further comprises a graph network processing unit and a population encoding unit; The graph network processing unit is used to construct a graph network model; it is also used to determine the initial features of each node in the graph network model based on the individual features and the interaction features, and iteratively update the features of each node in the graph network model to determine the output node features of each node so that the nodes can learn from each other; wherein the nodes of the graph network model include the target, the interaction relationship between any two targets, and the group relationship, and the group relationship is used to characterize the consistency relationship between different interaction relationships; The group encoding unit is used to encode the output node features based on the guidance of the externally input group prompt words, and determine the updated output node features; The group division unit is used to perform group division and identification based on the updated interaction features included in the updated output node features.

12. The device according to claim 11, characterized in that When the interaction feature encoding model is a Transformer model, in the group division unit, performing group division and identification based on the interaction feature includes: The interaction features are input into a pre-trained behavior inference model, and the interaction features are classified using the behavior inference model to predict a group classification result, and the probability of an interaction relationship between any two targets is predicted based on the interaction features, and the any two targets with a probability greater than or equal to an interaction threshold are regarded as a pair of targets with an interaction relationship; Perform group division based on all determined interaction relationships, divide the targets that have interaction relationships with each other into the same group, and use the group classification result as the classification recognition result of the divided group; and / or, When the device further includes a graph network processing unit and a group encoding unit, the group division unit is further used to determine the activity of each target based on the updated output node features of the target node, and determine the key target based on the activity.

13. The device according to claim 11, characterized in that The device further includes a second language model processing unit, which is used to extract features of the individual prompt words using the second language model to obtain individual prompt word features; The device further comprises an individual feature encoder, which is used to encode the individual feature based on the guidance of the individual prompt word feature using the trained individual feature encoder to obtain an updated individual feature; When encoding the individual features using the interactive feature encoding model in the interactive feature encoder, the encoding is performed based on the updated individual features; When determining the initial features of each node in the graph network model in the graph network processing unit, it is performed based on the updated individual features; and / or, When the individual feature encoder is trained, the updated individual feature output by the encoding is compared with the individual prompt word feature for similarity to determine the loss function of the individual feature encoder.

14. The device according to claim 11, characterized in that The graph network model is a factor graph model; The nodes of the factor graph include regular nodes and factor nodes; The conventional nodes include target nodes for representing targets and interactive nodes for representing the interactive relationship between any two targets; The factor nodes include first-type factor nodes and second-type factor nodes; the factor nodes are triplet consisting of three regular nodes, and for the first-type factor nodes, the triplet includes any two targets and their mutual interaction; for the second-type factor nodes, the triplet includes any two-to-two interaction among the three targets; An edge is set between the factor node and the regular nodes included in its triplet, and an edge is set between the interaction node and two specified target nodes; wherein the specified target nodes are target nodes corresponding to the two targets of the interaction relationship represented by the interaction node.

15. The device according to claim 14, characterized in that In the graph network processing unit, The determining the initial features of each node in the graph network model based on the individual features and the interaction features includes: The initial feature of the target node is the individual feature of the target corresponding to the node; The initial feature of the interaction node is the interaction feature of the interaction relationship corresponding to the node; The initial feature of the factor node is the average initial feature of the three nodes included in the triple of the factor node; And / or, when the features of each node in the graph network model are iteratively updated, Determine the feature of the corresponding factor node after the current iteration based on the factor node feature determined after the last iteration of each factor node and the node features determined after the last iteration of each regular node having an edge with the factor node; Based on the node features determined after the last iteration for each of the regular nodes and the node features determined after the last iteration for each factor node having an edge with the regular node, the features of the corresponding regular nodes after the current iteration are determined.

16. The device according to claim 11, characterized in that The device further includes a joint training unit, which is used to determine parameters for updating features of the graph network model, parameters for encoding features of the output nodes, and parameters for group division in advance through a training process; The loss function of the training process is determined based on the similarity loss of the interaction adjacency matrix and the binary classification loss of whether each target is a key point, wherein the elements in the interaction adjacency matrix indicate whether there is an interaction between any two targets.

17. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instructions are executed by a processor, the group detection method described in any one of claims 1 to 10 can be implemented.

18. An electronic device, characterized in that: The electronic device includes at least a computer-readable storage medium and also includes a processor; The processor is used to read executable instructions from the computer-readable storage medium and execute the instructions to implement the group detection method described in any one of claims 1 to 10 above.