Method and device for harmful video detection based on cross-frame temporal semantic understanding
By employing a cross-frame temporal semantic understanding method, key entities in videos are identified and semantic scene graphs are constructed, solving the problem of low accuracy in harmful video detection in existing technologies and achieving efficient harmful video detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN UNIV
- Filing Date
- 2026-02-12
- Publication Date
- 2026-06-02
AI Technical Summary
Existing video content security detection technologies struggle to accurately identify implicit semantic relationships and inter-entity interactions in harmful videos, resulting in low detection accuracy.
A method based on cross-frame temporal semantic understanding is adopted. Key entities are identified through a cross-frame entity extraction model. Combined with entity attributes, emotional features and relationship modeling, a semantic scene graph is constructed for detection.
It improves the accuracy of harmful video detection, especially in identifying complex implicit violations, with an F1-score of 97.62%.
Smart Images

Figure CN122135266A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of video content security detection, and particularly relates to a harmful video detection method and device based on cross-frame time sequence semantic understanding. BACKGROUND
[0002] With the rapid development of Internet technology, massive video content continues to grow in the network space and is widely watched and spread by users. A large amount of harmful visual content is mixed in these video contents, especially with the progress of generative artificial intelligence technology, the harmful videos generated by text-to-video generation models are growing rapidly.
[0003] The current mainstream video content security detection technology mainly relies on the pixel-level features of the visual surface, maps the whole video into a feature vector to extract the global representation, and directly determines the harmfulness according to the global representation. However, such a way is easy to lose fine-grained key information due to the compression representation of the whole video, and it is difficult to analyze the implicit harmful semantics only relying on pixel-level features. In addition, such extraction method is also difficult to identify the potential harmful relationship formed by the spatio-temporal layout and interaction behavior between entities, thereby limiting the accuracy of harmful video detection.
[0004] Therefore, there is an urgent need for a harmful video detection method with higher detection accuracy. SUMMARY
[0005] The present application provides a harmful video detection method and device based on cross-frame time sequence semantic understanding, to solve the defect that the monitoring method in the prior art lacks the ability to recognize implicit semantic association in long videos, and to realize a harmful video detection method based on cross-frame time sequence semantic reasoning, to improve the accuracy of harmful video detection.
[0006] The present application provides a harmful video detection method based on cross-frame time sequence semantic understanding, comprising: inputting a to-be-tested video into a cross-frame entity extraction model to identify key entities appearing in the to-be-tested video, and obtaining a unique code and an entity region time sequence mask of each key entity output by the cross-frame entity extraction model; inputting the entity region time sequence mask of the key entity and the to-be-tested video into an entity attribute extraction model to obtain an attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model; inputting the entity region time sequence mask of the key entity and the to-be-tested video into an emotion perception model, and constructing an emotion feature representation of the key entity in the time dimension based on the output of the emotion perception model; Multiple key entities appearing within the same time window are identified, a set of candidate entity pairs is constructed, and the attribute feature representations of each candidate entity pair are input into a temporal network based on an attention mechanism to obtain the temporal relationship of the candidate entity pairs. The system integrates the attribute feature representations and emotion feature representations of key entities with the temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships. This graph is then input into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
[0007] According to the harmful video detection method based on cross-frame temporal semantic understanding provided by the present invention, before the step of inputting the video to be tested into a cross-frame entity extraction model to identify key entities appearing in the video to be tested, the method further includes: Collect various types of harmful videos and annotate key entity regions in the harmful videos based on visual content to construct a training dataset; The entity extraction model is trained on the training dataset to obtain the cross-frame entity extraction model with minimal loss. The loss function includes object detection loss, mask segmentation loss, and identity consistency loss.
[0008] According to the harmful video detection method based on cross-frame temporal semantic understanding provided by the present invention, before the step of inputting the entity region temporal mask of the key entity and the video to be tested into the entity attribute extraction model, the method further includes: A dual-stream attribute extraction network comprising a visual feature encoding stream and a text semantic encoding stream is constructed. The visual features and text semantic features are trained with attribute alignment in a shared embedding space to obtain the entity attribute extraction model.
[0009] According to the harmful video detection method based on cross-frame temporal semantic understanding provided by the present invention, the step of constructing the temporal feature representation of key entities based on the output of the emotion perception model specifically includes: The entity region temporal mask of the key entity and the video to be tested are input into the emotion perception model to obtain the emotion feature vector of the corresponding key entity at each time step output by the emotion perception model, and then integrated to obtain the emotion feature sequence. Based on temporal difference modeling, the emotional state of key entities at adjacent time steps is modeled to obtain the emotional change sequence of key entities. Global modeling of emotion feature sequences and emotion change sequences yields emotion feature representations for corresponding key entities.
[0010] According to the harmful video detection method based on cross-frame temporal semantic understanding provided by the present invention, the step of inputting the attribute feature representations of each candidate entity pair into a temporal network constructed based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs specifically includes: The attribute feature representations of candidate entity pairs are input into a temporal network to obtain the interaction dynamic features of entities in the entity pair in the time dimension. Based on the aforementioned interactive dynamic features, a weight matrix of the relationship between two entities in an entity pair is calculated using an attention mechanism, which serves as the temporal relationship of the corresponding candidate entity pair.
[0011] According to the harmful video detection method based on cross-frame temporal semantic understanding provided by the present invention, the step of integrating the attribute feature representations, emotion feature representations, and temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships, and inputting it into a graph judgment network for detection, specifically includes: For each key entity, its corresponding attribute feature representation and sentiment feature representation are concatenated to obtain a comprehensive state representation of the key entity; Integrate the comprehensive state representations of all key entities and the temporal relationships of all candidate entity pairs to form a semantic scene graph; The semantic scene graph is input into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
[0012] The present invention also provides a harmful video detection device based on cross-frame temporal semantic understanding, comprising: The key entity extraction module is used to input the video under test into the cross-frame entity extraction model to identify key entities appearing in the video under test, and to obtain the unique code and entity region temporal mask of each key entity output by the cross-frame entity extraction model. The attribute feature extraction module is used to input the entity region temporal mask of the key entity and the video under test into the entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model. The emotion feature extraction module is used to input the temporal mask of the entity region of the key entity and the video to be tested into the emotion perception model, and construct the emotion feature representation of the key entity in the time dimension based on the output of the emotion perception model. The relation feature extraction module is used to identify multiple key entities that appear within the same time window, construct a set of candidate entity pairs, and input the attribute feature representations of each candidate entity pair into a temporal network based on an attention mechanism to obtain the temporal relationship of the candidate entity pairs. The video category determination module is used to integrate the attribute feature representations, emotion feature representations, and temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships. This graph is then input into a graph determination network for detection to determine whether the video to be tested is a harmful or harmless video.
[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the harmful video detection method based on cross-frame temporal semantic understanding as described above.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the harmful video detection method based on cross-frame temporal semantic understanding as described above.
[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the harmful video detection method based on cross-frame temporal semantic understanding as described above.
[0016] The harmful video detection method and apparatus based on cross-frame temporal semantic understanding provided by this invention divides the modeling of harmful semantics into three sub-tasks: entity attribute temporal modeling, entity emotion temporal modeling, and entity relationship temporal modeling. A divide-and-conquer strategy is adopted to model them separately, and then a unified reasoning is performed through a graph structure, which ultimately improves the detection capability of complex implicit violations. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is one of the flowcharts of the harmful video detection method based on cross-frame temporal semantic understanding provided by the present invention; Figure 2 This is a schematic diagram of the semantic scene graph in the harmful video detection method based on cross-frame temporal semantic understanding provided by the invention; Figure 3 This is the second flowchart of the harmful video detection method based on cross-frame temporal semantic understanding provided by the present invention; Figure 4 This is a schematic diagram of the harmful video detection device based on cross-frame temporal semantic understanding provided by the present invention; Figure 5This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0020] The following is combined Figures 1 to 3 This invention introduces a harmful video detection method based on cross-frame temporal semantic understanding, such as... Figure 1 As shown, it includes: Step 101: Input the video to be tested into the cross-frame entity extraction model to identify key entities appearing in the video to be tested, and obtain the unique code and entity region temporal mask of each key entity output by the cross-frame entity extraction model. Since this invention addresses the specific goal of NSFW (Not Safe For Work) safety assessment, unlike traditional computer vision tasks that pursue a complete analysis of semantic scenes, this invention uses a semantic selection mechanism oriented towards harmful assessment targets. Through a pre-trained cross-frame entity extraction model, it prioritizes retaining key entities in the video under test that are strongly correlated with violation assessment.
[0021] Specifically, key entities include people and entities that interact with people.
[0022] Optionally, the semantic extraction model is pre-trained with fine-tuning so that it only identifies and outputs key entities, resulting in a cross-frame entity extraction model. The test video is then input into the cross-frame entity extraction model to obtain the unique encoded ID of each key entity identified by the model. K And the entity region timing mask M of this key entity K The entity region temporal mask describes the region of the corresponding key entity K in the video image from its appearance to its disappearance in each frame.
[0023] Step 102: Input the entity region temporal mask of the key entity and the video to be tested into the entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model. Because a large number of illegal semantics in existing harmful videos do not originate from significant visual features in a single frame, but rather from the combined expression of the evolution of entity behavior over time and the interaction relationships between entities, it is often difficult to accurately detect such information from the level of single-frame perturbation or local visual features.
[0024] For example, one type of harmful video is a semantically progressive harmful sample, where the content of a single frame seems normal, but as time goes on, the attribute state of key entities changes and gradually forms illegal semantics. For example, an entity changes from "walking normally" to "chasing with weapons". This kind of semantics depends on the continuous numbering of entity attributes in the time dimension, which is difficult to detect by traditional static visual classification methods.
[0025] To this end, the entity attribute extraction model pre-trained in this invention obtains the attribute information of each key entity in the time dimension by performing sequence modeling on the attribute features of the same entity with the same encoding in multiple frames, thereby realizing the recognition of behavior evolution patterns.
[0026] Among them, the attributes of key entities are semantic information extracted from a predefined set of discriminant attributes to describe the static or dynamic features of key entities. The predefined set of discriminant attributes includes attributes related to people, such as identity, gender, age group, occupation and actions; and attributes related to objects, such as object category, material (metal, glass, plastic), state (sharp, intact, broken) and color.
[0027] Optionally, the predefined set of discriminant attributes can be configured and expanded according to the needs of the video content security inspection task.
[0028] Optionally, the entity attribute extraction model can be fine-tuned using training video data labeled with a predefined set of discriminative attributes, based on an existing visual-language model such as CLIP. During the inference phase, the entity attribute extraction model receives a temporal mask of the entity region of the key entity and the video to be tested, and analyzes the region covered by the mask frame by frame, outputting the attribute feature representation Fattr(k,t) of the key entity at each time frame.
[0029] Based on this, by inputting the attribute feature sequence, which consists of the attribute features of the same entity encoded at different time steps, into the temporal coding network (Transformer Encoder), the temporal attribute representation of the entity, Fattr(k,1:T), can be obtained, which is the attribute feature representation of the key entity in the time dimension. Here, T represents the total number of time frames of the video under test.
[0030] Optionally, the attribute feature representation can be an attribute encoding vector or an attribute text description.
[0031] On the one hand, the continuous attribute features of each key entity in the time dimension obtained through the above method can characterize the state evolution and behavioral dynamics of the key entity in the video process, thereby providing a gradual process of satisfying the illegal semantic triggering conditions for the identification of harmful videos.
[0032] On the other hand, the identity information in the attribute feature representation also provides fine-grained prior information for the final judgment. For example, even if there are videos with the same content of "shooting with a gun", the identities of the key entities are different. It may be a harmless military propaganda video or a prohibited video containing harmful content.
[0033] Step 103: Input the temporal mask of the entity region of the key entity and the video to be tested into the emotion perception model, and construct the emotion feature representation of the key entity in the time dimension based on the output of the emotion perception model; Furthermore, since the emotional evolution of key entities during the video process also has a positive impact on the judgment of video category, this embodiment also uses an emotion perception model to identify the emotional features of key entities in each time frame, using the entity region temporal mask of key entities and the video to be tested as input.
[0034] Alternatively, an existing emotion recognition model, such as one built on a convolutional neural network, can be used as the emotion perception model.
[0035] Step 104: Identify multiple key entities that appear within the same time window, construct a set of candidate entity pairs, and input the attribute feature representations of each candidate entity pair into a temporal network constructed based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs. In addition, there is another type of harmful video that manifests as relationship-triggered harmful samples. That is, a single entity itself does not have obvious illegal features, but the interaction relationship between multiple entities constitutes illegal semantics under a specific temporal structure, such as "one person controls another person" or "multiple people attack one person". This type of semantics is mainly reflected in the interaction strength and relationship direction between entities.
[0036] To this end, we first identify all key entities that appear within the same time window, and then construct a set of candidate entity pairs based on this, with each set of candidate entity pairs including two key entities.
[0037] Optionally, in this embodiment, the same time window is the same time frame. For multiple key entities that appear in the same time frame, they are combined in pairs to form a set of non-repeating candidate entity pairs.
[0038] Based on this, the system performs temporal modeling on the attribute feature representations of two key entities in the candidate entity pair set, and uses an attention mechanism to characterize the semantic dependency between the two key entities. The relation weights are then extracted as the temporal relation of the corresponding candidate entity pair to achieve the recognition of complex interactive behaviors.
[0039] Step 105: Integrate the attribute feature representations, emotion feature representations, and temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships. Input the graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
[0040] After obtaining the attribute feature representations, emotion feature representations, and temporal relationships of all candidate entity pairs in the video under test, all the above features are integrated to obtain a temporal semantic scene graph containing entity attributes, emotions, and relationships, such as... Figure 2 As shown.
[0041] Then, a graph judgment network is used to reason about the integrated semantic scene graph to determine whether the video under test is harmful or harmless. A complete detection process is as follows: Figure 3 As shown.
[0042] In summary, the video under test first undergoes entity perception and cross-frame association to obtain the temporal trajectory of key entities. Then, by modeling attribute features and emotional features, the evolution trend of the key entities' own state over time is characterized. By modeling the relationship between candidate entity pairs, the interaction pattern between key entities is characterized. Finally, the data is integrated and constructed into a spatiotemporal semantic scene graph. The graph judgment network outputs the video-level harmfulness determination result. In this embodiment, as long as the graph judgment network determines that the video under test has a violation of semantic structure, the video under test is identified as a harmful video.
[0043] This invention divides the modeling of harmful semantics into three sub-tasks: entity attribute temporal modeling, entity sentiment temporal modeling, and entity relationship temporal modeling. It adopts a divide-and-conquer strategy to model these sub-tasks separately, and then performs unified reasoning through a graph structure, ultimately improving the detection capability of complex implicit violations.
[0044] In the harmful video detection method based on cross-frame temporal semantic understanding of the present invention, before the step of inputting the video to be tested into the cross-frame entity extraction model to identify key entities appearing in the video to be tested, the method further includes: Collect various types of harmful videos and annotate key entity regions in the harmful videos based on visual content to construct a training dataset; To obtain a cross-frame entity extraction model that identifies and extracts only key entities, we first collected various types of harmful videos and collected various prompt words to guide the synthesis of harmful videos as the initial dataset.
[0045] Using a generative model, simulated harmful videos are generated for the collected prompt words. The real harmful videos Vi and simulated harmful videos Yi are then integrated to construct a multi-distribution mixed dataset D={Vi, Yi}.
[0046] Data cleaning is performed on the video data in dataset D to remove noisy and non-compliant data, such as advertisements interspersed in the videos that are irrelevant to the video's semantics.
[0047] Entity regions are labeled for each video content in the cleaned dataset D, marking the outlines of all key entities that need to be identified. A unique encoded ID is assigned to each key entity to be identified, which serves as a label during training. This ID forms video-label pairs with the collected harmful videos, resulting in the training dataset.
[0048] The entity extraction model is trained on the training dataset to obtain the cross-frame entity extraction model with minimal loss. The loss function includes object detection loss, mask segmentation loss, and identity consistency loss.
[0049] Furthermore, a cross-frame entity extraction model is designed. In this embodiment, the cross-frame entity extraction model is based on the general segmentation framework GSF for pixel-level entity segmentation, and combined with the unified multi-target tracking framework OBTrack to realize cross-frame identity association, so as to output the key entities and entity region temporal masks identified from the input test video.
[0050] Among them, GSF achieves instance-level segmentation through a Transformer-based mask attention mechanism, which can output high-quality segmentation masks for different entities in each frame; OBTrack performs data association on entities in the time dimension by embedding appearance features and jointly modeling motion information, thereby ensuring the consistency of the identity of the same entity in different frames.
[0051] During the training of the cross-frame entity extraction model, a detection backbone network based on Vision Transformer is constructed, and training is performed by minimizing the multi-task joint loss function: ; In the formula, L represents the total loss. Let the target detection loss function be... For the segmentation mask loss function, The cross-frame identity consistency loss function uses the Triplet Loss form to constrain the feature distance of the same entity in different frames.
[0052] Optionally, in this embodiment, the identity consistency encoding uses a feature re-identification network to extract the entity appearance feature vector f. k Cross-frame matching degree is calculated using cosine similarity: ; In the formula, and They represent from the first i Frame and the j The entity appearance feature vector extracted from it. Using the L2 norm, when the similarity exceeds a threshold, they are determined to be the same entity and assigned a unified identity ID. k .
[0053] In the harmful video detection method based on cross-frame temporal semantic understanding of the present invention, before the step of inputting the entity region temporal mask of the key entity and the video to be tested into the entity attribute extraction model, the method further includes: A dual-stream attribute extraction network comprising a visual feature encoding stream and a text semantic encoding stream is constructed. The visual features and text semantic features are trained with attribute alignment in a shared embedding space to obtain the entity attribute extraction model.
[0054] In this embodiment, a dual-stream attribute extraction network is constructed as the entity attribute extraction network, including a visual feature encoding stream for high-dimensional representation learning of visual features of entity regions, and a text semantic encoding stream for semantic embedding representation of attribute label text. The visual features and text semantic features are trained for attribute alignment within a shared embedding space, and the attribute alignment capability is optimized through contrastive learning. The following loss function is used during training: ; In the formula, Indicates the first i The visual attributes of an entity, This represents the semantic features of the corresponding text. This is the temperature coefficient.
[0055] During the training phase, the ground truth mask of the labeled entity region is used to extract the features of the corresponding region from the feature map of the backbone visual coding network through the AreaAlign operation, so as to obtain the local visual representation of the entity.
[0056] During the inference phase, the temporal mask of the entity region of the key entity and the video to be tested are input together into the visual feature encoding stream of the trained two-stream attribute extraction network, thereby obtaining the local visual representation V of the corresponding key entity. (k,t) Subsequently, the visual feature encoding stream performs high-dimensional mapping and representation learning on the local visual representation, and outputs the corresponding visual attribute feature vector.
[0057] It is understandable that, since the visual feature encoding stream has achieved precise alignment between visual features and attribute semantic space through comparative learning with the text semantic encoding stream during the training phase, the visual attribute feature vector itself has a clear semantic meaning and can be directly output as the attribute feature representation Fattr(k,t) of the entity in the current frame to obtain the attribute feature representation in encoded form; in other feasible implementations, the attribute feature representation in encoded form can also be mapped to text description output based on a predefined attribute text feature library and similarity calculation.
[0058] In the harmful video detection method based on cross-frame temporal semantic understanding of this invention, the step of inputting the temporal mask of the entity region of the key entity and the video to be tested into an emotion perception model, and constructing the emotional feature representation of the key entity in the temporal dimension based on the output of the emotion perception model, specifically includes: The entity region temporal mask of the key entity and the video to be tested are input into the emotion perception model to obtain the emotion feature vector of the corresponding key entity at each time step output by the emotion perception model, and then integrated to obtain the emotion feature sequence. In this embodiment, the temporal mask of the entity region of the key entity and the video to be tested are jointly input into the emotion perception model. The emotion perception model extracts the visual representation V(k,t) of the region of the key entity k at time step t, and then inputs it into the emotion perception subnetwork. This yields the corresponding emotion feature vector: ; In the formula, This represents the semantic embedding representation of the entity's emotion at time k t.
[0059] In other feasible implementations, the local visual representation V extracted by the entity attribute extraction model can also be directly extracted. (k,t) As input to the emotion perception model.
[0060] Integrate key entities in each time frame This yields the emotional feature sequences of key entities across all time series.
[0061] Based on temporal difference modeling, the emotional state of key entities at adjacent time steps is modeled to obtain the emotional change sequence of key entities. Furthermore, in order to characterize the trend of emotion changes over time, this embodiment also introduces a time difference operator to model the emotional state at adjacent time steps: ; In the formula, This indicates the amount of emotional change of an entity between adjacent frames, used to reflect the intensity and direction of emotional fluctuations.
[0062] Integrate key entities in each time frame This yields the emotional change sequence of key entities across the entire time series.
[0063] Global modeling of emotion feature sequences and emotion change sequences yields emotion feature representations for corresponding key entities.
[0064] The emotion feature sequence and the emotion change sequence are jointly input into the temporal emotion encoding network for global modeling: ; In the formula, Representation of the emotional characteristics of key entities.
[0065] In the harmful video detection method based on cross-frame temporal semantic understanding of the present invention, the step of inputting the attribute feature representations of each candidate entity pair into a temporal network constructed based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs specifically includes: The attribute feature representations of candidate entity pairs are input into a temporal network to obtain the interaction dynamic features of entities in the entity pair in the time dimension. Based on the aforementioned interactive dynamic features, the weight matrix of the relationship between two entities in an entity pair is calculated through an attention mechanism, which serves as the temporal relationship of the corresponding candidate entity pair.
[0066] For each candidate entity pair (e i ,e j First, the attribute feature sequence Fattr(k,1:T) of each key entity in the candidate entity pair is obtained. Then, the attribute feature sequence of the entity pair is input into a temporal network for relation modeling to capture the dynamic interaction features between entities in the time dimension.
[0067] Based on interactive dynamic features, the weight value of the relationship between two entities is calculated through an attention mechanism: ; In the formula, For entities i The query vector, For entities j The key vector.
[0068] In the harmful video detection method based on cross-frame temporal semantic understanding of this invention, the step of integrating the attribute feature representations, emotion feature representations, and temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships, and inputting it into a graph judgment network for detection, specifically includes: For each key entity, its corresponding attribute feature representation and sentiment feature representation are concatenated to obtain a comprehensive state representation of the key entity; In this embodiment, when integrating the attribute feature representations, sentiment feature representations, and temporal relationships of all candidate entity pairs, the attribute feature representations and sentiment feature representations of each key entity are first concatenated to obtain a comprehensive state representation. S K : .
[0069] Then determine the state set of all key entities. .
[0070] Integrate the comprehensive state representations of all key entities and the temporal relationships of all candidate entity pairs to form a semantic scene graph; Furthermore, integrate the temporal relationships of all candidate entity pairs: This leads to the construction of a unified spatiotemporal semantic structured representation, namely, a semantic scene graph: .
[0071] The semantic scene graph is input into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
[0072] The graph decision network in this embodiment includes a relation-aware semantic reasoning network, used to jointly model entity states and relationships between entities. Specifically, for any entity i, its context-enhanced representation is as follows: ; In the formula, This represents a relation modulation function used to characterize the semantic influence of interactions between entity i and other entities; This represents the entity state update function, used to fuse its own state with the external relational context. Through this mechanism, high-level semantic reasoning based on multi-entity interactions is achieved, resulting in a set of enhanced relational representations for all entities.
[0073] To obtain video-level semantic representations, the augmented relation representations of all entities are globally aggregated: ; In the formula, This is a global semantic readout function used to synthesize the semantic contributions of different entities in a temporal process and generate video-level semantic vectors. Z .
[0074] Finally, Z The harmfulness determination layer of the input graph judgment network calculates the probability that the video contains harmful semantics: ; In the formula, and b For learnable parameters, σ ( ) is the Sigmoid function. When P>θ, the video sample is determined to contain harmful semantics; otherwise, it is determined to be a harmless video, where θ is a preset threshold.
[0075] The following describes the harmful video detection device based on cross-frame temporal semantic understanding provided by the present invention. The harmful video detection device based on cross-frame temporal semantic understanding described below can be referred to in correspondence with the harmful video detection method based on cross-frame temporal semantic understanding described above.
[0076] In one specific implementation, the F1-score is used as a comprehensive performance evaluation metric to assess the detection performance of this invention. The F1-score comprehensively considers the precision and recall of the detection results; a higher F1-score indicates better overall detection performance of the model in the harmful content identification task. In the actual evaluation process, positive and negative sample pairs (harmful video samples and normal video samples) are randomly selected from the test set. The trained detection model is used to distinguish the samples. The overall F1-score is calculated by statistically analyzing the model's ability to correctly identify harmful samples and its ability to control false positives for normal samples. This score is used to intuitively reflect the comprehensive discrimination effect of the classification model in complex scenarios. Experimental results show that the proposed video harmful content detection method based on temporal semantic reasoning achieves an average F1-score of 97.62% on multiple publicly available video datasets and a self-built complex semantic scene dataset. It maintains stable detection performance even in scenarios containing implicit semantic expressions, cross-frame behavioral associations, and complex contextual interference.
[0077] like Figure 4 As shown, the harmful video detection device based on cross-frame temporal semantic understanding includes a key entity extraction module 401, an attribute feature extraction module 402, an emotion feature extraction module 403, a relationship feature extraction module 404, and a video category judgment module 405. The key entity extraction module 401 is used to input the video under test into the cross-frame entity extraction model to identify key entities appearing in the video under test, and to obtain the unique code and entity region temporal mask of each key entity output by the cross-frame entity extraction model. Since this invention addresses the specific goal of NSFW (Not Safe For Work) safety assessment, unlike traditional computer vision tasks that pursue a complete analysis of semantic scenes, this invention uses a semantic selection mechanism oriented towards harmful assessment targets. Through a pre-trained cross-frame entity extraction model, it prioritizes retaining key entities in the video under test that are strongly correlated with violation assessment.
[0078] Specifically, key entities include people and entities that interact with people.
[0079] Optionally, the semantic extraction model is pre-trained with fine-tuning so that it only identifies and outputs key entities, resulting in a cross-frame entity extraction model. The test video is then input into the cross-frame entity extraction model to obtain the unique encoded ID of each key entity identified by the model. K And the entity region timing mask M of this key entity K The entity region temporal mask describes the region of the corresponding key entity K in the video image from its appearance to its disappearance in each frame.
[0080] The attribute feature extraction module 402 is used to input the entity region temporal mask of the key entity and the video to be tested into the entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model. Because a large number of illegal semantics in existing harmful videos do not originate from significant visual features in a single frame, but rather from the combined expression of the evolution of entity behavior over time and the interaction relationships between entities, it is often difficult to accurately detect such information from the level of single-frame perturbation or local visual features.
[0081] For example, one type of harmful video is a semantically progressive harmful sample, where the content of a single frame seems normal, but as time goes on, the attribute state of key entities changes and gradually forms illegal semantics. For example, an entity changes from "walking normally" to "chasing with weapons". This kind of semantics depends on the continuous numbering of entity attributes in the time dimension, which is difficult to detect by traditional static visual classification methods.
[0082] To this end, the entity attribute extraction model pre-trained in this invention obtains the attribute information of each key entity in the time dimension by performing sequence modeling on the attribute features of the same entity with the same encoding in multiple frames, thereby realizing the recognition of behavior evolution patterns.
[0083] The emotion feature extraction module 403 is used to input the entity region temporal mask of the key entity and the video to be tested into the emotion perception model, and construct the emotion feature representation of the key entity in the time dimension based on the output of the emotion perception model. Furthermore, since the emotional evolution of key entities during the video process also has a positive impact on the judgment of video category, this embodiment also uses an emotion perception model to identify the emotional features of key entities in each time frame, using the entity region temporal mask of key entities and the video to be tested as input.
[0084] Alternatively, an existing emotion recognition model, such as one built on a convolutional neural network, can be used as the emotion perception model.
[0085] The relation feature extraction module 404 is used to identify multiple key entities that appear within the same time window, construct a set of candidate entity pairs, and input the attribute feature representation of each candidate entity pair into a temporal network constructed based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs. First, identify all key entities that appear within the same time window, and then construct a set of candidate entity pairs based on this, with each set of candidate entity pairs including two key entities.
[0086] Optionally, in this embodiment, the same time window is the same time frame. For multiple key entities that appear in the same time frame, they are combined in pairs to form a set of non-repeating candidate entity pairs.
[0087] Based on this, the system performs temporal modeling on the attribute feature representations of two key entities in the candidate entity pair set, and uses an attention mechanism to characterize the semantic dependency between the two key entities. The relation weights are then extracted as the temporal relation of the corresponding candidate entity pair to achieve the recognition of complex interactive behaviors.
[0088] The video category judgment module 405 is used to integrate the attribute feature representation, emotion feature representation and temporal relationship of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions and relationships, and input it into the graph judgment network for detection to determine whether the video to be tested is a harmful video or a harmless video.
[0089] After obtaining the attribute feature representations, emotion feature representations, and temporal relationships of all candidate entity pairs in the video under test, all the above features are integrated to obtain a temporal semantic scene graph containing entity attributes, emotions, and relationships, such as... Figure 2 As shown.
[0090] Then, a graph judgment network is used to reason about the integrated semantic scene graph to determine whether the video under test is harmful or harmless. A complete detection process is as follows: Figure 3 As shown.
[0091] In summary, the video under test first undergoes entity perception and cross-frame association to obtain the temporal trajectory of key entities. Then, by modeling attribute features and emotional features, the evolution trend of the key entities' own state over time is characterized. By modeling the relationship between candidate entity pairs, the interaction pattern between key entities is characterized. Finally, the data is integrated and constructed into a spatiotemporal semantic scene graph. The graph judgment network outputs the video-level harmfulness determination result. In this embodiment, as long as the graph judgment network determines that the video under test has a violation of semantic structure, the video under test is identified as a harmful video.
[0092] This invention divides the modeling of harmful semantics into three sub-tasks: entity attribute temporal modeling, entity sentiment temporal modeling, and entity relationship temporal modeling. It adopts a divide-and-conquer strategy to model these sub-tasks separately, and then performs unified reasoning through a graph structure, ultimately improving the detection capability of complex implicit violations.
[0093] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a harmful video detection method based on cross-frame temporal semantic understanding. This method includes: inputting the video to be tested into a cross-frame entity extraction model to identify key entities appearing in the video to be tested, and obtaining a unique code and entity region temporal mask for each key entity output by the cross-frame entity extraction model; inputting the entity region temporal mask of the key entity and the video to be tested together into an entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model; inputting the entity region temporal mask of the key entity and the video to be tested together into an entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model; and inputting the entity region temporal mask of the key entity and the video to be tested together into an entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model; and inputting the entity region temporal mask of the key entity and the video to be tested into an entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension. The video is input into an emotion perception model. Based on the output of the emotion perception model, the emotional feature representations of key entities in the time dimension are constructed. Multiple key entities appearing within the same time window are identified, and a set of candidate entity pairs is constructed. The attribute feature representations of each candidate entity pair are input into a temporal network constructed based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs. The attribute feature representations of key entities, the emotional feature representations, and the temporal domain relationship of all candidate entity pairs are integrated to form a semantic scene graph containing entity attributes, emotions, and relationships. This graph is then input into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
[0094] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0095] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the harmful video detection method based on cross-frame temporal semantic understanding provided by the above methods. The method includes: inputting the video to be tested into a cross-frame entity extraction model to identify key entities appearing in the video to be tested, and obtaining a unique code and entity region temporal mask of each key entity output by the cross-frame entity extraction model; inputting the entity region temporal mask of the key entity and the video to be tested together into an entity attribute extraction model to obtain the key entity output by the entity attribute extraction model. The system represents the attribute features of entities in the time dimension; it inputs the temporal mask of the entity region of the key entity and the video to be tested into an emotion perception model, and constructs the emotion feature representation of the key entity in the time dimension based on the output of the emotion perception model; it identifies multiple key entities appearing within the same time window, constructs a candidate entity pair set, and inputs the attribute feature representation of each candidate entity pair into a temporal network based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs; it integrates the attribute feature representation of the key entity, the emotion feature representation, and the temporal domain relationship of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships, and inputs it into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
[0096] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the harmful video detection method based on cross-frame temporal semantic understanding provided by the methods described above. This method includes: inputting a video to be tested into a cross-frame entity extraction model to identify key entities appearing in the video to be tested, and obtaining a unique code and entity region temporal mask for each key entity output by the cross-frame entity extraction model; inputting the entity region temporal mask of the key entity and the video to be tested together into an entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model; and inputting... The temporal mask of the entity region of the key entity and the video to be tested are jointly input into the emotion perception model. Based on the output of the emotion perception model, the emotion feature representation of the key entity in the time dimension is constructed. Multiple key entities appearing in the same time window are identified, a candidate entity pair set is constructed, and the attribute feature representation of each candidate entity pair is input into a temporal network constructed based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs. The attribute feature representation of the key entity, the emotion feature representation, and the temporal domain relationship of all candidate entity pairs are integrated to form a semantic scene graph containing entity attributes, emotions, and relationships. This graph is then input into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
[0097] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0098] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting harmful videos based on cross-frame temporal semantic understanding, characterized in that, include: The video to be tested is input into the cross-frame entity extraction model to identify key entities appearing in the video to be tested, and to obtain the unique code and entity region temporal mask of each key entity output by the cross-frame entity extraction model. The entity region temporal mask of the key entity and the video under test are input together into the entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model. The temporal mask of the entity region of the key entity and the video to be tested are input into the emotion perception model, and the emotion feature representation of the key entity in the time dimension is constructed based on the output of the emotion perception model. Multiple key entities appearing within the same time window are identified, a set of candidate entity pairs is constructed, and the attribute feature representations of each candidate entity pair are input into a temporal network based on an attention mechanism to obtain the temporal relationship of the candidate entity pairs. The system integrates the attribute feature representations and emotion feature representations of key entities with the temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships. This graph is then input into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
2. The harmful video detection method based on cross-frame temporal semantic understanding according to claim 1, characterized in that, Before the step of inputting the video under test into the cross-frame entity extraction model to identify key entities appearing in the video under test, the method further includes: Collect various types of harmful videos and annotate key entity regions in the harmful videos based on visual content to construct a training dataset; The entity extraction model is trained on the training dataset to obtain the cross-frame entity extraction model with minimal loss. The loss function includes object detection loss, mask segmentation loss, and identity consistency loss.
3. The harmful video detection method based on cross-frame temporal semantic understanding according to claim 1, characterized in that, Before the step of inputting the entity region temporal mask of the key entity and the video to be tested into the entity attribute extraction model, the method further includes: A dual-stream attribute extraction network comprising a visual feature encoding stream and a text semantic encoding stream is constructed. The visual features and text semantic features are trained with attribute alignment in a shared embedding space to obtain the entity attribute extraction model.
4. The harmful video detection method based on cross-frame temporal semantic understanding according to claim 1, characterized in that, The step of inputting the temporal mask of the entity region of the key entity and the video to be tested into the emotion perception model, and constructing the emotional feature representation of the key entity in the time dimension based on the output of the emotion perception model, specifically includes: The entity region temporal mask of the key entity and the video to be tested are input into the emotion perception model to obtain the emotion feature vector of the corresponding key entity at each time step output by the emotion perception model, and then integrated to obtain the emotion feature sequence. Based on temporal difference modeling, the emotional state of key entities at adjacent time steps is modeled to obtain the emotional change sequence of key entities. Global modeling of emotion feature sequences and emotion change sequences yields emotion feature representations for corresponding key entities.
5. The harmful video detection method based on cross-frame temporal semantic understanding according to claim 1, characterized in that, The step of inputting the attribute feature representations of each candidate entity pair into a temporal network constructed based on an attention mechanism to obtain the temporal domain relationship of the candidate entity pairs specifically includes: The attribute feature representations of candidate entity pairs are input into a temporal network to obtain the interaction dynamic features of entities in the entity pair in the time dimension. Based on the aforementioned interactive dynamic features, the weight value of the relationship between two entities in an entity pair is calculated through an attention mechanism, which serves as the temporal relationship of the corresponding candidate entity pair.
6. The harmful video detection method based on cross-frame temporal semantic understanding according to claim 1, characterized in that, The step of integrating the attribute feature representations, sentiment feature representations, and temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, sentiments, and relationships, and then inputting it into a graph judgment network for detection, specifically includes: For each key entity, its corresponding attribute feature representation and sentiment feature representation are concatenated to obtain a comprehensive state representation of the key entity; Integrate the comprehensive state representations of all key entities and the temporal relationships of all candidate entity pairs to form a semantic scene graph; The semantic scene graph is input into a graph judgment network for detection to determine whether the video to be tested is a harmful or harmless video.
7. A harmful video detection device based on cross-frame temporal semantic understanding, characterized in that, include: The key entity extraction module is used to input the video under test into the cross-frame entity extraction model to identify key entities appearing in the video under test, and to obtain the unique code and entity region temporal mask of each key entity output by the cross-frame entity extraction model. The attribute feature extraction module is used to input the entity region temporal mask of the key entity and the video under test into the entity attribute extraction model to obtain the attribute feature representation of the key entity in the time dimension output by the entity attribute extraction model. The emotion feature extraction module is used to input the temporal mask of the entity region of the key entity and the video to be tested into the emotion perception model, and construct the emotion feature representation of the key entity in the time dimension based on the output of the emotion perception model. The relation feature extraction module is used to identify multiple key entities that appear within the same time window, construct a set of candidate entity pairs, and input the attribute feature representations of each candidate entity pair into a temporal network based on an attention mechanism to obtain the temporal relationship of the candidate entity pairs. The video category determination module is used to integrate the attribute feature representations, emotion feature representations, and temporal relationships of all candidate entity pairs to form a semantic scene graph containing entity attributes, emotions, and relationships. This graph is then input into a graph determination network for detection to determine whether the video to be tested is a harmful or harmless video.
8. An electronic 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 program, it implements the harmful video detection method based on cross-frame temporal semantic understanding as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the harmful video detection method based on cross-frame temporal semantic understanding as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the harmful video detection method based on cross-frame temporal semantic understanding as described in any one of claims 1 to 6.