A method for detecting interactive relationships between people, terminal equipment and medium

By extracting visual features and combining the interaction encoder and detection encoder to generate interaction classification and detection scores, input the interaction prediction decoder, and optimize the loss function, the problem of low accuracy in the existing technology is solved and more efficient character interaction is achieved. Relation detection, especially in rare category recognition.

CN117934932BActive Publication Date: 2024-10-29湖南工商大学
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410068991.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-17
Publication Date
2024-10-29
Estimated Expiration
2044-01-17

AI Technical Summary

Technical Problem

The accuracy of existing human interaction relationship detection methods is low, mainly due to limited data set annotation and high annotation costs, resulting in long-tail problems in the data, and the large-scale image-text pre-training model CLIP has not been fully utilized in this field. Guidance methods Simple and computationally expensive.

Method used

A human interaction relationship detection method is designed. By extracting visual features and inputting them into the interaction encoder and detection encoder, interaction features and detection features are generated. Combined with the pre-trained image encoder and interaction classifier, the interaction classification score and object category are calculated. Score, input the interaction prediction decoder, enhance the degree of feature refinement, calculate the character interaction relationship score, consider semantic information, and optimize the loss function update parameters.

Benefits of technology

It improves the accuracy and efficiency of character interaction relationship detection, enhances feature refinement, and significantly improves the ability to identify rare categories. Compared with traditional methods, the performance is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117934932B_ABST
    Figure CN117934932B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of artificial intelligence technology, and provides a method, terminal device and medium for detecting interactive relationships of people, which extracts visual features of an image to be tested, and inputs them into an interactive encoder and a detection encoder to obtain interactive features and detection features; vectorizes the interactive features and inputs them into a person interactive relationship classifier to obtain an interactive classification score; inputs the detection features into a detection decoder to obtain a person pair boundary box, an object category and an object category score; calculates an interactive prediction query; inputs the interactive features and the interactive prediction query into an interactive prediction decoder to obtain an interactive prediction score of the interactive prediction query; calculates a person interactive relationship score based on the interactive classification score, the object category score and the interactive prediction score; and determines the person interactive relationship of the image to be tested based on the person interactive relationship score. The present application can improve the accuracy of the method for detecting interactive relationships of people.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to a method, terminal device and medium for detecting a person interaction relationship. Background Art

[0002] Human interaction detection is a widely-watched research direction in the field of computer vision. Its main task is to detect the <human, object, action> triples with interactive relationships in images, focusing on understanding objects and behaviors that interact with humans. This technology has important value in multiple application scenarios, including but not limited to video surveillance, human-computer interaction, and intelligent manufacturing, and is of great significance for improving the level of intelligence in modern life.

[0003] The core problem of human interaction relationship detection is interaction understanding. Most of the current mainstream methods rely on classifiers fitted from specific datasets to predict interactions. However, due to the limited annotation of datasets for human interaction relationship detection and the high cost of annotation, the data presents a serious long-tail problem, so the traditional methods have significant limitations.

[0004] In recent years, using large models to improve the generalization ability of downstream tasks has become a new research trend. In particular, the large-scale image-text pre-training model CLIP[2] (Contrastive Language-Image Pretraining, a model developed by OpenAI that can process both image and text data) has been applied to dozens of tasks including object detection and has performed well. However, in the field of human-object interaction detection, the research on using CLIP for knowledge guidance is still in its infancy. Existing methods can be roughly divided into two types: one is to use a two-stage method to first crop the detection boxes of people and objects, then pair them one by one and input them into CLIP to generate their interaction types; the other is to use the CLIP visual features of the entire image to guide the output of the interaction decoder, and let it query the merged features of the output to learn the CLIP visual features. However, the CLIP features of the entire image are less refined, and cropping and prediction require high computational and time costs. The current methods have problems such as too simple guidance methods and insufficient knowledge transfer. Therefore, it is necessary to further study how to make full use of CLIP knowledge to guide human-object interaction detection, so as to improve the accuracy of human interaction detection. Summary of the invention

[0005] The present application provides a method, terminal device and medium for detecting interactive relationships between characters, which can solve the problem of low accuracy of traditional interactive relationship detection between characters.

[0006] In a first aspect, the present application provides a method for detecting a person interaction relationship, comprising:

[0007] Extracting visual features of the image to be tested, and inputting the visual features into the interaction encoder and the detection encoder respectively to obtain interaction features and detection features;

[0008] The interaction features are vectorized and input into a person interaction relationship classifier to obtain an interaction classification score; the person interaction relationship classifier includes a pre-trained image encoder, an adapter, and a pre-initialized interaction classifier, the image encoder is used to extract image features of the image to be tested, the adapter is used to segment the image features, the interaction classifier is used to calculate the interaction classification score of the image to be tested according to the segmented image features, and the interaction classification score is used to describe the semantic information of all types of person interaction relationships in the image to be tested;

[0009] Input the detection features into the detection decoder to obtain multiple person-pair bounding boxes, object categories in each person-pair bounding box, and object category scores corresponding to the object categories; the person-pair bounding boxes include human body bounding boxes and object bounding boxes;

[0010] Based on the query vectors of people and objects optimized by the detection decoder, the interaction prediction query is calculated; the interaction prediction query is used to describe the visual features used to extract and aggregate the interaction relationship classification;

[0011] The interaction features and the interaction prediction query are input into an interaction prediction decoder to obtain an interaction prediction score of the interaction prediction query; the interaction prediction decoder comprises a first preset number of self-attention layers and a second preset number of cross-attention layers, the self-attention layers and the cross-attention layers are sequentially connected, and the interaction prediction score is used to characterize a confidence vector of the interaction classification;

[0012] The person interaction score is calculated based on the interaction classification score, the object category score and the interaction prediction score; the person interaction score is used to describe the possibility of all candidate interaction triplets pre-acquired in the image to be tested, and the candidate interaction triplets include the interaction relationship types between the human body, the object and the human body object;

[0013] The candidate interaction relationship triples corresponding to the character interaction relationship scores that are greater than or equal to the preset score threshold are used as the character interaction relationships of the image to be tested.

[0014] Optionally, the interaction encoder includes a third preset number of encoder layers, the detection encoder includes a fourth preset number of encoder layers, the encoder layer includes a self-attention sublayer and a feedforward neural network sublayer, and the self-attention sublayer and the feedforward neural network sublayer are connected in sequence.

[0015] Optionally, the expression for the interaction classification score is as follows:

[0016]

[0017] W = softmax(topk(S c ))

[0018] Among them, Q s represents the interactive classification score, L(·) represents the linear layer, W represents the weight, and E t represents text embedding, which is used to pre-initialize the interactive classifier. topk(·) represents the first k, S c It represents the interaction score. The first k interaction scores are activated by the softmax function to obtain the interaction classification score.

[0019] Optionally, interactive classification scores, multiple person-pair bounding boxes, and object categories, compute interactive prediction queries, including:

[0020] By calculating the formula Get interactive prediction query Q act ; Among them, Q h' represents the updated vector representation of the query after the detection decoder, Q o' Represents the updated vector representation of the object query after passing through the detection decoder.

[0021] Optionally, the character interaction relationship score is calculated based on the interaction classification score, the object category score, and the interaction prediction score, including:

[0022] By calculating the formula Get the character interaction score S hoi ;in, represents the object category score after exponential weighting, represents the interactive prediction score after exponential weighting, The interactive classification scores after exponential weighting are shown.

[0023] Optionally, vectorize the interaction features, including:

[0024] By calculating the formula f v =L(P(V act )) to obtain the vectorized interaction feature f v ; where L(·) represents linearization, P(·) represents pooling, and f v ∈R B×1×C” , R represents a real number, B represents the batch size, and C' represents the number of feature channels.

[0025] Optionally, before calculating the character interaction relationship score according to the interaction classification score, the object category score, and the interaction prediction score, the character interaction relationship detection method further includes:

[0026] Calculate the detection loss; the expression of the detection loss is L = λ b Lb +λ u L u +λ o L o +λ a L a +λ c L c +λ KD L KD , where L b represents the bounding box regression loss, L u represents the intersection-over-union loss, L o represents the object category loss, L a represents the interaction category loss, l c represents the global interaction classification loss, L KD represents the intersection-over-union loss, λ b ,λ u ,λ o ,λ a ,λ c ,λ KD represents a hyperparameter used to adjust the weight of each loss;

[0027] According to the detection loss, the parameters in the interaction encoder, detection encoder, person interaction relationship classifier and detection decoder are updated until the detection loss is less than the preset loss threshold.

[0028] In a second aspect, the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the above-mentioned method for detecting interactive relationships between characters is implemented when the processor executes the computer program.

[0029] In a third aspect, the present application provides a computer-readable storage medium, which stores a computer program, and is characterized in that when the computer program is executed by a processor, the above-mentioned character interaction relationship detection method is implemented.

[0030] The above solution of the present application has the following beneficial effects:

[0031] The method for detecting human interaction relationships provided in the present application designs a new structure for detecting human interaction relationships. The decoupling of visual features of an image is achieved through a human interaction relationship classifier, an interaction encoder, a detection decoder, and an interaction prediction decoder. The feature refinement level is enhanced, which is beneficial to improving the accuracy of human interaction relationship detection. The human interaction relationship score is calculated based on the interaction classification score, the object category score, and the interaction prediction score. The semantic information of the human interaction relationship type in the image to be tested is taken into account, which is beneficial to improving the accuracy of human interaction relationship detection.

[0032] Other beneficial effects of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0034] Figure 1 A flowchart of a method for detecting a character interaction relationship provided in an embodiment of the present application;

[0035] Figure 2 A schematic diagram of a character interaction relationship detection structure provided in an embodiment of the present application;

[0036] Figure 3 A schematic diagram of the structure of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0037] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0038] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0039] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0040] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0041] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0042] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0043] In response to the problem of low accuracy of traditional character interaction relationship detection, the present application provides a character interaction relationship detection method, terminal device and medium. The method designs a new character interaction relationship detection structure, and realizes the decoupling of the visual features of the image through a character interaction relationship classifier, an interaction encoder, a detection decoder and an interaction prediction decoder, thereby enhancing the feature refinement level and facilitating the accuracy of character interaction relationship detection. The character interaction relationship score is calculated based on the interaction classification score, the object category score and the interaction prediction score, and the semantic information of the character interaction relationship type in the image to be tested is taken into account, which is conducive to improving the accuracy of character interaction relationship detection.

[0044] The following is an exemplary description of the character interaction relationship detection method provided in this application.

[0045] like Figure 1 As shown, the character interaction relationship detection method includes the following steps:

[0046] Step 11, extracting visual features of the image to be tested, and inputting the visual features into the interaction encoder and the detection encoder respectively to obtain interaction features and detection features.

[0047] Specifically, the interactive encoder includes a third preset number of encoder layers, the detection encoder includes a fourth preset number of encoder layers, the encoder layer includes a self-attention sublayer and a feedforward neural network sublayer, the self-attention sublayer and the feedforward neural network sublayer are connected in sequence, and illustratively, in one embodiment of the present application, this sublayer is used to calculate the attention weight of each position in the input sequence so that the model can pay attention to information at different positions; the self-attention mechanism determines the importance of each position to other positions by learning weights. The feedforward neural network sublayer is used to transform and combine the features of each position through the feedforward neural network after calculating the self-attention to enhance the feature representation.

[0048] In addition, to stabilize training and improve model performance, residual connections and layer normalization are added after each sublayer.

[0049] Exemplarily, in one embodiment of the present application, the interaction encoder includes 4 encoder layers connected in sequence, and the detection encoder includes 5 encoder layers connected in sequence.

[0050] It should be noted that in the embodiments of the present application, the above-mentioned visual features follow the traditional DETR (Detection Transformer, an emerging object detection model that realizes end-to-end training and reasoning of human interaction relationship detectors by converting the detection problem into a key point matching problem), and adopts a combined architecture of convolutional neural network (CNN) + Transformer encoder to extract visual features.

[0051] Step 12, quantize the interaction features and input them into the character interaction relationship classifier to obtain the interaction classification score.

[0052] The above-mentioned person interaction relationship classifier includes a pre-trained image encoder, an adapter and a pre-initialized interaction classifier. The image encoder is used to extract image features of the image to be tested, the adapter is used to segment the image features, and the interaction classifier is used to calculate the interaction classification score of the image to be tested based on the segmented image features. The interaction classification score is used to describe the semantic information of all person interaction relationship types in the image to be tested.

[0053] In one embodiment of the present application, the character interaction relationship detection structure is as follows: Figure 2 shown.

[0054] Combination Figure 2It can be seen that the traditional single-stage method needs to tightly couple person detection and interaction relationship recognition, and use the same query to extract unified features to complete the above two tasks at the same time. However, the visual features and optimization goals of these two tasks are very different, which affects the performance of the single-stage method to a certain extent. The method proposed in this application uses a two-step strategy to decouple the detection and interaction relationship recognition tasks, retaining the characteristics of the single-stage method of efficiently locating interactive person pairs, so that the network can extract task-adapted features for different tasks, thereby better optimizing the two tasks.

[0055] Exemplarily, in an embodiment of the present application, the above-mentioned image encoder comes from CLIP; the interaction classifier is initialized (initialized weights) by the text embedding generated by the CLIP text encoder; the adapter consists of two Transformer layers, whose purpose is to make the cropped features more suitable for the task of detecting human interaction relationships.

[0056] Specifically, the expression of the interactive classification score is as follows:

[0057]

[0058] W = softmax(topk(S c ))

[0059] Among them, Q s represents the interactive classification score, L(·) represents the linear layer, W represents the weight, and E t represents text embedding, which is used to pre-initialize the interactive classifier. topk(·) represents the first k, S c It represents the interaction score. The first k interaction scores are activated by the softmax function to obtain the interaction classification score.

[0060] The higher the interaction classification score, the greater the weight given to the corresponding interaction classification. In this way, high-quality interaction classifications will be retained as much as possible for subsequent semantic guidance.

[0061] It should be noted that this application is considered from both the global and local levels.

[0062] Specifically, at the global level, the present application uses the complete image to be tested as input, and uses the character interaction relationship categories existing in the image to be tested as multi-classification supervision.

[0063] At the local level, each person interaction relationship pair is considered separately, and the person region, object region, and joint region are used as the input of the network. These three regions will perform a shared linear projection to obtain their respective block embeddings, and then add their own independent position encodings. Then, the model is trained using a mixed block training strategy, and all block encodings interact in the Transformer.

[0064] It is worth mentioning that the above structure can make the class markers more focused on the character interaction relationship area, and all markers can interact more deeply.

[0065] The above process of vectorizing the interactive features is:

[0066] By calculating the formula f v =L(P(V act )), and obtain the vectorized interaction feature f v ; where L(·) represents linearization, P(·) represents pooling, and f v ∈R B×1×C” , R represents a real number, B represents the batch size, and C' represents the number of feature channels.

[0067] It is worth mentioning that after the above operations, the interactive feature vector is aligned with the dimension of CLIP encoding, and the obtained interactive feature vector can learn from CLIP image encoding, which facilitates knowledge distillation.

[0068] When implementing knowledge distillation, this application uses the image feature vector obtained by the trained CLIP image encoder as the teacher network for knowledge distillation, and the loss function used is L KD =L1(f v ,f c ), where L1 represents the L1 loss function. After training, the interactive feature vector has gradually aligned with the CLIP image encoding, so it can be considered that it also has the same ability as the CLIP-driven interactive classifier.

[0069] Step 13, input the detection features into a detection decoder to obtain a plurality of person-pair bounding boxes, an object category in each person-pair bounding box, and an object category score corresponding to the object category.

[0070] The above-mentioned person pair bounding box includes a human body bounding box and an object bounding box.

[0071] Step 14, computing interactive prediction queries based on the query vectors of people and objects optimized by the detection decoder.

[0072] Interaction prediction queries are used to extract and aggregate visual features for interactive relation classification.

[0073] Exemplarily, in one embodiment of the present application, the visual features include features encoded by Transformer.

[0074] Specifically, by calculating the formula Get interactive prediction query Q act ; Among them, Q h' represents the updated vector representation of the query after the detection decoder, Q o' Represents the updated vector representation of the object query after passing through the detection decoder.

[0075] It is worth mentioning that the interaction prediction query obtained by the above operation makes up for the previous lack of semantic information and improves the accuracy of character interaction relationship detection.

[0076] Step 15: Input the interaction feature and the interaction prediction query into an interaction prediction decoder to obtain an interaction prediction score of the interaction prediction query.

[0077] The above-mentioned interactive prediction decoder includes a first preset number of self-attention layers and a second preset number of cross-attention layers, the self-attention layers and the cross-attention layers are connected in sequence, and the interactive prediction score is used to characterize the confidence vector of the interactive classification. In an embodiment of the present application, first, the input of the interactive prediction decoder is processed by a multi-head self-attention mechanism, allowing the target query to self-associate, and then interacts with the output (image features) of the encoder through a cross-attention mechanism. A self-attention layer and a cross-attention layer constitute a decoding unit, and the interactive prediction decoder includes a plurality of such decoding units, and the first preset number and the second preset number are usually equal.

[0078] The confidence vector is used to describe the interaction classification score.

[0079] In order to further improve the accuracy of human interaction detection, the present application also performs the following operations, as shown in steps a to b:

[0080] Step a, calculate the detection loss.

[0081] Specifically, the expression of detection loss is L = λ b L b +λ u L u +λ o L o +λ a L a +λ c L c +λ KD L KD , where L b represents the bounding box regression loss, L u represents the intersection-over-union loss, L orepresents the object category loss, L a represents the interaction category loss, L c represents the global interaction classification loss, L KD represents the intersection-over-union loss, λ b ,λ u ,λ o ,λ a ,λ c ,λ KD Represents a hyperparameter used to adjust the weight of each loss.

[0082] Step b: according to the detection loss, update the parameters in the interaction encoder, the detection encoder, the person interaction relationship classifier and the detection decoder until the detection loss is less than a preset loss threshold.

[0083] This can further improve the accuracy of each encoder and decoder, reduce detection loss, and achieve the effect of improving the accuracy of human interaction detection.

[0084] In addition, in order to retain the original knowledge of CLIP as much as possible, in the embodiment of the present application, the parameters of CLIP are also trained and updated, and the encoder learning rate lr1 and the adapter learning rate lr2 are set, where lr1 is much smaller than lr2.

[0085] Step 16, calculating the person interaction relationship score based on the interaction classification score, the object category score and the interaction prediction score.

[0086] The above-mentioned person interaction relationship score is used to describe the possibility of all candidate interaction relationship triplets pre-acquired in the image to be tested, and the candidate interaction relationship triplets include the interaction relationship types between the human body, the object, and the human body and the object.

[0087] The above candidate interaction relation triplets are obtained according to the outputs of the detection decoder and the interaction decoder.

[0088] Exemplarily, the detection decoder outputs human and object detection frames, and the interaction decoder outputs corresponding interaction relationship types, thereby forming a triplet of (human detection frame, object detection frame, interaction relationship type).

[0089] Specifically, by calculating the formula Get the character interaction score S hoi ;in, represents the object category score after exponential weighting, represents the interactive prediction score after exponential weighting, The interactive classification scores after exponential weighting are shown.

[0090] Step 17: taking the candidate interaction relationship triples corresponding to the character interaction relationship scores that are greater than or equal to the preset score threshold as the character interaction relationships of the image to be tested.

[0091] For example, taking highway driving violation detection as an example, the images captured by the camera installed on the highway are taken as the object to be tested. By executing the above steps, the character interaction relationship detection results can be obtained: <Driver A, making a call>, <Driver B, driving a car>... Based on the character interaction relationship detection results and in combination with relevant traffic regulations, corresponding penalties can be imposed on driver A who made the call, thereby improving the safety of highway driving.

[0092] In order to verify the effectiveness of the character interaction relationship detection method provided by the present application, in one embodiment of the present application, multiple character interaction relationship detection test scenarios and data sets were evaluated in an experimental environment of 8 Tesla V100 graphics cards, and the experiment showed that significant performance improvement was achieved. On the benchmark character interaction detection data set HICO-DET, compared with the then optimal Transformer-based interaction detection algorithm SSRT, the method proposed in the present application, under the same backbone network settings, has a relative improvement of 16.83% in average precision AP, and a relative improvement of 48.97% compared to the convolutional neural network-based algorithm ATL. In rare categories (Rare), a relative improvement of 31.51% was obtained compared to SSRT, which shows that the character interaction relationship detection method provided by the present application has a stronger rare category recognition capability, which is mainly derived from the knowledge transfer of CLIP.

[0093] like Figure 3 As shown, an embodiment of the present application provides a terminal device, such as Figure 3 As shown, the terminal device D10 of this embodiment includes: at least one processor D100 ( Figure 3 Only one processor is shown in the figure), a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100, wherein the processor D100 implements the steps of any of the above-mentioned method embodiments when executing the computer program D102.

[0094] Specifically, when the processor D100 executes the computer program D102, it extracts visual features of the image to be tested, and inputs the visual features into the interaction encoder and the detection encoder respectively to obtain interaction features and detection features, vectorizes the interaction features and inputs them into the person interaction relationship classifier to obtain interaction classification scores, inputs the detection features into the detection decoder to obtain multiple person pair bounding boxes, object categories in each person pair bounding box, and object category scores corresponding to the object categories, calculates interaction prediction queries based on the interaction classification scores, multiple person pair bounding boxes, and object categories, inputs the interaction features and the interaction prediction queries into the interaction prediction decoder to obtain interaction prediction scores of the interaction prediction queries, calculates person interaction relationship scores based on the interaction classification scores, object category scores, and interaction prediction scores, and uses the candidate interaction relationship triples corresponding to the person interaction relationship scores that are greater than or equal to a preset score threshold as the person interaction relationship of the image to be tested. The method for detecting human interaction relationships provided in the present application designs a new structure for detecting human interaction relationships. The decoupling of visual features of an image is achieved through a human interaction relationship classifier, an interaction encoder, a detection decoder, and an interaction prediction decoder. The feature refinement level is enhanced, which is beneficial to improving the accuracy of human interaction relationship detection. The human interaction relationship score is calculated based on the interaction classification score, the object category score, and the interaction prediction score. The semantic information of the human interaction relationship type in the image to be tested is taken into account, which is beneficial to improving the accuracy of human interaction relationship detection.

[0095] The processor D100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0096] In some embodiments, the memory D101 may be an internal storage unit of the terminal device D10, such as a hard disk or memory of the terminal device D10. In other embodiments, the memory D101 may also be an external storage device of the terminal device D10, such as a plug-in hard disk, a smart memory card (SMC, SmartMedia Card), a secure digital (SD, Secure Digital) card, a flash card (Flash Card), etc. equipped on the terminal device D10. Further, the memory D101 may also include both an internal storage unit of the terminal device D10 and an external storage device. The memory D101 is used to store an operating system, an application program, a boot loader (BootLoader), data and other programs, such as the program code of the computer program, etc. The memory D101 may also be used to temporarily store data that has been output or is to be output.

[0097] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0098] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0099] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0100] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0101] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0102] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0103] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0104] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for detecting a person interaction relationship, characterized in that: include: Extracting visual features of the image to be tested, and inputting the visual features into an interaction encoder and a detection encoder respectively to obtain interaction features and detection features; The interaction features are vectorized and input into a person interaction relationship classifier to obtain an interaction classification score; the person interaction relationship classifier comprises a pre-trained image encoder, an adapter and a pre-initialized interaction classifier, the image encoder is used to extract image features of the image to be tested, the adapter is used to segment the image features, the interaction classifier is used to calculate the interaction classification score of the image to be tested according to the segmented image features, and the interaction classification score is used to describe the semantic information of all person interaction relationship types in the image to be tested; Inputting the detection features into a detection decoder to obtain a plurality of person-pair bounding boxes, an object category in each of the person-pair bounding boxes, and an object category score corresponding to the object category; the person-pair bounding boxes include a human body bounding box and an object bounding box; Calculating an interaction prediction query based on the query vectors of people and objects optimized by the detection decoder; the interaction prediction query is used to extract and aggregate visual features for interactive relationship classification; Inputting the interaction feature and the interaction prediction query into an interaction prediction decoder to obtain an interaction prediction score of the interaction prediction query; The interactive prediction decoder includes a first preset number of self-attention layers and a second preset number of cross-attention layers, the self-attention layers and the cross-attention layers are connected in sequence, and the interactive prediction score is used to characterize the confidence vector of the interactive classification; Calculating a character interaction relationship score according to the interaction classification score, the object category score, and the interaction prediction score; The person interaction relationship score is used to describe the possibility of all candidate interaction relationship triplets pre-acquired in the image to be tested, and the candidate interaction relationship triplets include a person, an object, and the interaction relationship type between the person and the object; Taking the candidate interaction relationship triplet corresponding to the character interaction relationship score greater than or equal to a preset score threshold as the character interaction relationship of the image to be tested; The interaction encoder includes a third preset number of encoder layers, the detection encoder includes a fourth preset number of encoder layers, the encoder layer includes a self-attention sublayer and a feedforward neural network sublayer, and the self-attention sublayer and the feedforward neural network sublayer are connected in sequence; The expression of the interactive classification score is as follows: W =softmax(top(S c )) Among them, Q s represents the interactive classification score, L(·) represents the linear layer, W represents the weight, E t represents text embedding, which is used to pre-initialize the interactive classifier, topk(·) represents the first k, S c represents the interaction score, and the first k interaction scores are activated by the softmax function to obtain the interaction classification score; The interactive classification score, the plurality of person pair bounding boxes, and the object category, calculate an interactive prediction query, including: By calculating the formula Get the interactive prediction query Q act ; Among them, Q h' represents the updated vector representation of the query after the detection decoder, Q o' Represents the updated vector representation of the object query after passing through the detection decoder.

2. The method for detecting interactive relationships between people according to claim 1, characterized in that: The calculating the character interaction relationship score according to the interaction classification score, the object category score and the interaction prediction score includes: By calculating the formula Get the character interaction score S hoi ;in, represents the object category score after exponential weighting, represents the interactive prediction score after exponential weighting, : represents the interactive classification score after exponential weighting.

3. The method for detecting interactive relationships between people according to claim 1, characterized in that: Vectorizing the interaction features, including: By calculating the formula f v =L(P(V acg )) to obtain the vectorized interaction feature f v ; where L(·) represents linearization, P(·) represents pooling, and f v ∈R B×1×C′ , R represents a real number, B represents the batch size, and C' represents the number of feature channels.

4. The method for detecting interactive relationships between people according to claim 1, characterized in that: Before calculating the character interaction relationship score according to the interaction classification score, the object category score and the interaction prediction score, the character interaction relationship detection method further includes: Calculate the detection loss; the expression of the detection loss is L = λ b L b +λ u L u +λ o L o +λ a L a +λ c L c +λ KD L KD , where L b represents the bounding box regression loss, L u represents the intersection-over-union loss, L o represents the object category loss, L a represents the interaction category loss, L c represents the global interaction classification loss, L KD represents the knowledge distillation loss, λ b ,λ u ,λ o ,λ a ,λ c ,λ KD represents a hyperparameter used to adjust the weight of each loss; According to the detection loss, the parameters in the interaction encoder, the detection encoder, the character interaction relationship classifier and the detection decoder are updated until the detection loss is less than a preset loss threshold.

5. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for detecting interactive relationships between characters as described in any one of claims 1 to 4 is implemented.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for detecting interactive relationships between characters as described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Character interaction detection method based on adaptive set learning prediction

    CN114241606A

  • Image human-object interaction positioning method and system based on Transform model

    CN114663915A

  • Character interaction relationship detection method and system

    CN114913546A

  • Character interaction detection method, device and equipment based on query generator

    CN116662587A

  • Multi-task deep learning-based real-time matting method for non-green-screen portraits

    US20230005160A1