Video frame processing method and system based on semantic guidance, and storage medium

This video frame processing method, which employs semantically aware frame sampling and adaptive frame cropping, addresses the shortcomings of frame selection and cropping in cross-modal text-video retrieval, improves retrieval performance, and generates efficient and accurate video representations.

CN122112302APending Publication Date: 2026-05-29XIANGTAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610000405.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-04
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In cross-modal text-video retrieval, existing technologies suffer from poor retrieval performance. Uniform sampling methods ignore query intent and miss key moments, text-guided methods ignore the diversity within the frame set, and traditional fixed-center cropping strategies lose key edge information.

Method used

A semantically guided video frame processing method is adopted. A semantically aware frame sampler selects diverse and representative key frames, and an adaptive frame cropper is used to spatially crop out the local region most similar to the semantically guided text, thereby achieving spatiotemporal co-optimization.

Benefits of technology

It significantly improves the accuracy of cross-modal retrieval in complex scenarios, generates compact, accurate and highly discriminative video representations, and enhances retrieval performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122112302A_ABST
    Figure CN122112302A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on semantic guide's video frame processing method, system and storage medium, comprising: obtaining original video, obtains semantic guide text;The time position information of each frame is encoded after fusion with the visual features of this frame, form time sequence enhancement features, according to time sequence enhancement features to video frame grouping, select multiple representative and diversity key frames from pre-sampling frame;Multiple candidate local cropping regions are generated for selected key frame, the semantic similarity between each candidate region and semantic guide text is calculated respectively, and the candidate region with the highest similarity to semantic guide text is cropped out. Through the semantic perception of key frame selection in time dimension, and adaptive frame cropping in spatial dimension, the fine-grained refinement and alignment of video content are realized, thereby the performance of cross-modal text-video retrieval is significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence and multimodal information processing technology, and specifically relates to a semantically guided video frame processing method, system and storage medium. Background Technology

[0002] With the exponential growth of online multimedia data, how to efficiently retrieve videos from massive amounts of video based on text content—that is, cross-modal text-video retrieval technology—has become a research hotspot. This technology aims to retrieve the most semantically relevant videos based on the text query input by the user.

[0003] Currently, one of the core challenges facing text-video retrieval technology is how to effectively process lengthy video data containing a large amount of temporally redundant information. Because mainstream visual models (such as ViT) have limited input lengths, they cannot encode all frames of the video; therefore, a representative subset of frames must be selected.

[0004] Existing technologies mainly employ two frame selection strategies: one is a text-independent uniform sampling strategy, which selects frames in the video at fixed time intervals, and is widely used as a baseline method due to its simplicity and efficiency. The other is a text-guided sampling strategy, which uses query text to guide frame selection, for example, by calculating the similarity between each frame and the text, and selecting the frames with the highest scores.

[0005] While the aforementioned methods are feasible to some extent, their inherent limitations result in unsatisfactory retrieval performance in complex scenarios. Specifically, uniform sampling methods completely ignore query intent, easily missing crucial video moments or selecting a large amount of redundant information. Text-guided methods, while focusing on the "relevance" between frames and text, neglect the "diversity" within the selected frame set, leading to potentially highly similar selected frames that fail to comprehensively represent the video content. Furthermore, regardless of the sampling strategy employed, existing technologies generally rely on a fixed center-cropping method when processing selected frames. This coarse-grained processing strategy assumes all key visual information is located in the center of the frame, often cropping important objects at the edges, resulting in the loss of key visual cues and weakening the final cross-modal alignment effect. Summary of the Invention

[0006] To address the aforementioned technical problems, the present invention aims to provide a semantically guided video frame processing method, system, and storage medium. By performing semantically aware keyframe selection in the temporal dimension and adaptive frame cropping in the spatial dimension, fine-grained extraction and alignment of video content are achieved, thereby significantly improving the performance of cross-modal text-video retrieval.

[0007] The technical solution of this invention is: A semantically guided video frame processing method includes the following steps: S01: Obtain the original video and get the semantic guidance text; S02: Encode the temporal location information of each frame and fuse it with the visual features of that frame to form temporal enhancement features. Group the video frames according to the temporal enhancement features and select multiple representative and diverse key frames from the pre-sampled frames. S03: Generate multiple candidate local cropping regions for the selected keyframe, calculate the semantic similarity between each candidate region and the semantic guidance text, and crop out the candidate region with the highest similarity to the semantic guidance text.

[0008] In the preferred technical solution, the semantic guidance text in step S01 is generated by inputting the original video into a language model or by user input.

[0009] In the preferred technical solution, the formation of timing enhancement features includes: A pre-trained multimodal encoder is used to extract visual features from each frame of the video, and semantic features are extracted from the semantic guidance text of the video. Normalize the timestamp of each frame to ,in, This indicates the sequence number of the current frame in the video sequence. This indicates the number of frames presampled from the original video; Encode time and location information :

[0010] in, Represents the dimensional index in visual features. d Dimensions of visual features; Combining location encoding with visual features to form temporally enhanced features:

[0011] in, It is a hyperparameter that controls the weighting of time information. It is a visual feature.

[0012] In the preferred technical solution, grouping video frames based on temporal enhancement features includes: Temporal enhancement features Clustering algorithms are used to group similar features and generate cluster labels for each video frame. ; Construct a binary mask as follows:

[0013] in, i, j This is the sequence number of a video frame.

[0014] In a preferred technical solution, selecting multiple representative and diverse keyframes from pre-sampled frames includes: Calculate the semantic relevance of each video frame to the semantic guidance text:

[0015] in, As a visual feature, Semantic features that guide the text. Represents the cosine similarity function. To convert cosine similarity from Mapped to ; Calculate frames and Diversity score between:

[0016] Introduce a weight decay factor The diversity score was adjusted, and the adjusted diversity score is shown below. for:

[0017] in, It is a binary mask. i, j This is the sequence number of a video frame; Initialize collection and iteratively add those belonging to frames This makes the following objective function reach its maximum value:

[0018] in, Used to balance correlation and diversity; The selected frame was added to In this process, the procedure is repeated until a selection is made. Frames, thus obtaining a time-ordered keyframe sequence. , Indicates the first One target keyframe.

[0019] In a preferred technical solution, selecting multiple representative and diverse keyframes from pre-sampled frames includes: Construct a kernel matrix, using the relevance of each frame to the semantically guided text as its quality score, and the visual similarity between frames as a similarity measure; By sampling from the determinant point process, an optimal subset of frames with high quality and high diversity is obtained. , Indicates the first One target keyframe, This represents the number of keyframes.

[0020] In the preferred technical solution, the candidate regions with the highest similarity to the semantic guidance text are cropped out, including: Define the side length of a square cropping window as:

[0021] in, This indicates the width of the keyframe image in pixels. This indicates the height (in pixels) of the keyframe image. On each keyframe Pixel step size sliding Window, generate Candidate regions ; For each candidate region Extracting semantic features from semantically guided text and visual features And calculate the cosine similarity between each candidate region and the semantically guided text:

[0022] The candidate region with the highest cosine similarity is selected as the best local cropping region for this frame, denoted as:

[0023] Here, argmax() returns the input value that makes the function achieve its maximum value; The optimal cropping regions of all keyframes are recombined in chronological order to form a new video representation:

[0024] in, Indicates the reorganized, containing A sequence of video features from the best locally cropped image.

[0025] In the preferred technical solution, the candidate regions with the highest similarity to the semantic guidance text are cropped out, including: Use a pre-trained object detection model to detect objects and use the bounding boxes of the objects as candidate regions; For each candidate region, an image description model is used to generate a text description of the local region; Calculate the text similarity between the local text description and the semantic guidance text, and select the candidate region with the highest similarity as the best local cropping region for that frame; The optimal cropping regions of all keyframes are recombined in chronological order to form a new video representation:

[0026] in, Indicates the reorganized, containing Best local cropping image The video feature sequence.

[0027] This invention also discloses a semantically guided video frame processing system for implementing the semantically guided video frame processing method, comprising: The semantic guidance text generation module acquires the original video and obtains the semantic guidance text. The semantically aware frame sampler encodes the temporal location information of each frame and fuses it with the visual features of that frame to form temporal enhancement features. Based on the temporal enhancement features, the video frames are grouped, and multiple representative and diverse key frames are selected from the pre-sampled frames. The adaptive frame cropper generates multiple candidate local cropping regions for the selected keyframe, calculates the semantic similarity between each candidate region and the semantic guidance text, and crops out the candidate region with the highest similarity to the semantic guidance text.

[0028] The present invention also discloses a computer storage medium storing a computer program thereon, which, when executed, implements the above-described semantically guided video frame processing method.

[0029] Compared with the prior art, the beneficial effects of the present invention are: This method first utilizes a global semantic summary generated by a large language model as guidance. Through a semantically aware frame sampler, it ensures that the selected frames are highly relevant to the core content of the video while also taking into account the diversity between frames. This overcomes the blindness of uniform sampling methods in existing technologies and the shortcomings of traditional text-guided methods that easily select redundant information. Subsequently, an adaptive frame cropper performs secondary spatial refinement on the selected keyframes, automatically locating and extracting the local regions that best match the semantics. This effectively filters out background noise in the image and solves the problem of traditional fixed-center cropping strategies easily losing key edge information.

[0030] This invention generates a more compact, accurate and highly discriminative video representation through spatiotemporal co-optimization, significantly enhancing cross-modal retrieval accuracy in complex scenarios without introducing additional trainable parameters. Attached Figure Description

[0031] The present invention will be further described below with reference to the accompanying drawings and embodiments: Figure 1 This is a flowchart of the semantically guided video frame processing method in this embodiment; Figure 2 This is an overview diagram of the model in this embodiment; Figure 3 This is a component architecture diagram for this embodiment. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments and the accompanying drawings. It should be understood that these descriptions are merely exemplary and not intended to limit the scope of the invention. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.

[0033] Example

[0034] like Figure 1 As shown, a semantically guided video frame processing method includes the following steps: S01: Obtain the original video and get the semantic guidance text; S02: Encode the temporal location information of each frame and fuse it with the visual features of that frame to form temporal enhancement features. Group the video frames according to the temporal enhancement features and select multiple representative and diverse key frames from the pre-sampled frames. S03: Generate multiple candidate local cropping regions for the selected keyframe, calculate the semantic similarity between each candidate region and the semantic guidance text, and crop out the candidate region with the highest similarity to the semantic guidance text.

[0035] The key advantage of this embodiment is: 1. A two-stage video processing framework based on global semantic guidance of a large language model (LLM).

[0036] Innovatively, LLM is first used to generate a unified global semantic summary for the video, which is then used as the sole semantic guide for subsequent temporal and spatial processing.

[0037] 2. A time frame selection method that balances relevance and diversity.

[0038] By combining time-aware clustering results with the maximum boundary relevance (MMR) criterion, the diversity of selected frames is effectively promoted while ensuring global semantic relevance, thus avoiding content redundancy.

[0039] 3. Adaptive semantic focus space clipping method.

[0040] For selected keyframes, a sliding window-style content evaluation is performed based on the global semantic summary, automatically cropping out the local regions most relevant to the semantics, thereby eliminating background noise and focusing on key information.

[0041] 4. Modular design that is plug-and-play and requires no additional training parameters.

[0042] This invention is a lightweight, training-free, standalone module that can be directly integrated into the front end of existing retrieval models to improve performance, offering advantages of high efficiency and low cost integration.

[0043] In a preferred embodiment, the semantic guidance text in step S01 is generated by inputting the original video into a language model or by user input.

[0044] In a preferred embodiment, forming the timing enhancement feature includes: A pre-trained multimodal encoder is used to extract visual features from each frame of the video, and semantic features are extracted from the semantic guidance text of the video. Normalize the timestamp of each frame to ,in, This indicates the sequence number of the current frame in the video sequence. This indicates the number of frames presampled from the original video; Encode time and location information :

[0045] in, Represents the dimensional index in visual features. d Dimensions of visual features; Combining location encoding with visual features to form temporally enhanced features:

[0046] in, It is a hyperparameter that controls the weighting of time information. It is a visual feature.

[0047] In a preferred embodiment, grouping video frames based on temporal enhancement features includes: Temporal enhancement features Clustering algorithms are used to group similar features and generate cluster labels for each video frame. ; Construct a binary mask as follows:

[0048] in, i, j This is the sequence number of a video frame.

[0049] In a preferred embodiment, selecting multiple representative and diverse keyframes from pre-sampled frames includes: Calculate the semantic relevance of each video frame to the semantic guidance text:

[0050] in, As a visual feature, Semantic features that guide the text. Represents the cosine similarity function. To convert cosine similarity from Mapped to ; Calculate frames and Diversity score between:

[0051] Introduce a weight decay factor The diversity score was adjusted, and the adjusted diversity score is shown below. for:

[0052] in, It is a binary mask. i, j This is the sequence number of a video frame; Initialize collection and iteratively add those belonging to frames This makes the following objective function reach its maximum value:

[0053] in, Used to balance correlation and diversity; The selected frame was added to In this process, the procedure is repeated until a selection is made. Frames, thus obtaining a time-ordered keyframe sequence. , Indicates the first One target keyframe.

[0054] In another embodiment, selecting multiple representative and diverse keyframes from pre-sampled frames includes: Construct a kernel matrix, using the relevance of each frame to the semantically guided text as its quality score, and the visual similarity between frames as a similarity measure; By sampling from the determinant point process, an optimal subset of frames with high quality and high diversity is obtained. , Indicates the first One target keyframe, This represents the number of keyframes.

[0055] In a preferred embodiment, cropping the candidate region with the highest similarity to the semantic guidance text includes: Define the side length of a square cropping window as:

[0056] in, This indicates the width of the keyframe image in pixels. This indicates the height (in pixels) of the keyframe image. On each keyframe Pixel step size sliding Window, generate Candidate regions ; For each candidate region Extracting semantic features from semantically guided text and visual features And calculate the cosine similarity between each candidate region and the semantically guided text:

[0057] The candidate region with the highest cosine similarity is selected as the best local cropping region for this frame, denoted as:

[0058] Here, argmax() returns the input value that makes the function achieve its maximum value; The optimal cropping regions of all keyframes are recombined in chronological order to form a new video representation:

[0059] in, Indicates the reorganized, containing A sequence of video features from the best locally cropped image.

[0060] In another embodiment, cropping the candidate region with the highest similarity to the semantic guidance text may further include the following steps: Use a pre-trained object detection model to detect objects and use the bounding boxes of the objects as candidate regions; For each candidate region, an image description model is used to generate a text description of the local region; Calculate the text similarity between the local text description and the semantic guidance text, and select the candidate region with the highest similarity as the best local cropping region for that frame; The optimal cropping regions of all keyframes are recombined in chronological order to form a new video representation:

[0061] in, Indicates the reorganized, containing Best local cropping image The video feature sequence.

[0062] Another embodiment provides a semantically guided video frame processing system for implementing the semantically guided video frame processing method, comprising: The semantic guidance text generation module acquires the original video and obtains the semantic guidance text. The semantically aware frame sampler encodes the temporal location information of each frame and fuses it with the visual features of that frame to form temporal enhancement features. Based on the temporal enhancement features, the video frames are grouped, and multiple representative and diverse key frames are selected from the pre-sampled frames. The adaptive frame cropper generates multiple candidate local cropping regions for the selected keyframe, calculates the semantic similarity between each candidate region and the semantic guidance text, and crops out the candidate region with the highest similarity to the semantic guidance text.

[0063] The following describes in detail the complete process of a semantically guided video frame processing system using a preferred embodiment as an example.

[0064] The method of this invention is a process for processing video data, which aims to automatically select and extract a series of information-rich and highly discriminative keyframe images from a raw input video for use by subsequent text-video retrieval models.

[0065] like Figure 2 As shown, the model proposed in this invention consists of two modules: 1) a frame sampler, used to select a set of information-rich and diverse keyframes from the pre-sampled candidate set; and 2) a frame cropper, which further optimizes these frames by extracting the spatial regions most relevant to the semantics of the subtitles. The resulting cropped keyframes are then fed into a text-video retrieval (TVR) model for matching.

[0066] Reference Figure 3 The workflow of this invention begins with receiving an input video. First, the video is fed into a large language model (…). Figure 2 The model (VideoLLaMA3) generates a global semantic summary as "semantic guide text" through a holistic understanding of the video content.

[0067] Next, keyframe selection in the time dimension is performed by the semantically aware frame sampler, whose internal working principle is as follows: Figure 3 As shown in (a).

[0068] 1. All frames of the original video are first converted into a series of high-dimensional feature vectors by a visual encoder.

[0069] 2. In order to take into account both content and timing when making selections, this invention encodes the temporal location information of each frame and fuses it with the visual features of that frame to form a "temporal enhancement feature".

[0070] 3. These features are grouped using the affinity propagation clustering algorithm, which allows video clips with similar content and temporal proximity to be classified into one category.

[0071] 4. Iterative selection using the Maximum Boundary Relevance (MMR) criterion: In each selection, the system chooses a frame from the unselected frames that maximizes the MMR score. This score consists of two parts: one part is the relevance of the frame to the "semantic guidance text" (…). Figure 3 (a) is the relevance score; another part is the diversity of this frame compared to other selected frames ( Figure 3 (a) Diversity score). The clustering results will also be used to adjust the dissimilarity score, prioritizing selection from different content clusters.

[0072] Then, keyframe cropping in the spatial dimension is performed, executed by an adaptive frame cropper, the internal working principle of which is as follows: Figure 3 As shown in (b).

[0073] 1. The keyframe sequence output by the semantically aware frame sampler is fed into the adaptive frame trimmer one by one.

[0074] 2. For each frame, a sliding window strategy is used to generate multiple candidate local cropping regions on it.

[0075] 3. Using the same visual encoder, calculate the semantic similarity between each candidate region and the "semantic guidance text".

[0076] 4. The system selects and outputs the candidate region with the highest similarity to the "semantic guidance text" as the final cropping result for that frame (e.g., Figure 3 (b) has the highest similarity.

[0077] like Figure 2 As shown, after processing by the adaptive frame cropper, a set of cropped frames, refined both spatiotemporally and spatially, focusing on the core content, is obtained. This set of frames is then passed to the downstream text-video retrieval (TVR) model as input for its efficient and accurate retrieval. The entire process, guided by semantics, achieves the automatic transformation from raw, lengthy video to a refined, focused video representation.

[0078] Specific implementation process: 1. Semantic-guided text generation First, the entire video is input into a pre-trained, fixed-parameter Large Language Model (LLM), such as the VideoLLaMA3 model. This model understands the overall content of the video and outputs a text describing the core events or scenes in the video. That is, semantically guided text.

[0079] It should be noted that the VideoLLaMA3 model is used in this embodiment of the invention, but the invention is not limited to it. Any other large-scale multimodal model or video language model with video understanding and text generation capabilities, such as LiveCC, Qwen2.5-VL, or other future models, can be used to generate the semantic guidance text. Experiments of this invention have shown that changing to different models has little impact on the final result, demonstrating the robustness of the framework.

[0080] In addition to generating a complete descriptive text, semantic guidance can also take other forms, such as: a list of keywords extracted by the model (e.g., "baseball", "hitting", "running bases"); or segmented summaries generated for different time periods of the video.

[0081] Besides being automatically generated using a model, the semantic guidance text can also originate from the query text entered by the user. In this case, the method of the present invention will transform from a video preprocessing module into a dynamic frame selection and cropping method that interacts with the user query in real time.

[0082] 2. Semantic-aware frame sampler

[0083] The semantically aware frame sampler process consists of two steps: temporally aware clustering and frame selection based on maximum edge correlation. These two steps aim to extract frames from the raw video... (in, This indicates the first [item] in the original video. Frame image, (This indicates the number of frames presampled from the original video) A representative and diverse keyframe (in, This indicates the first video selected from the original video. (Target keyframes) to capture the core content of the video while avoiding redundant information.

[0084] 1) Temporally Aware Clustering. We employ a pre-trained multimodal encoder (which can be CLIP, BLIP, or other models with image-text alignment capabilities) to extract a visual feature for each frame. (in, express A dimensional real vector space, i.e., the dimension of the eigenvectors is . ), and a text description for the video. Extract a semantic feature To cluster frame features, we introduce a novel time-aware method: before clustering, each visual feature is... It enhances the temporal position of the normalized data. By directly embedding temporal information into the feature space, this method prevents adjacent frames with only subtle visual changes from being scattered into different clusters, and avoids forcibly grouping temporally distant but semantically similar frames into the same cluster.

[0085] Specifically, we first normalize the timestamp of each frame to... (in, This indicates the sequence number of the current frame in the video sequence. (This represents the number of frames pre-sampled from the original video), then time position information is encoded, and sine and cosine position encoding is applied as follows:

[0086] in, Represents the dimension index in the feature vector (value range is 1). ), and These correspond to the even-numbered and odd-numbered dimensions of the feature vector, respectively.

[0087] Next, we combine positional encoding with visual features to form temporally enhanced visual features:

[0088] in It is a hyperparameter that controls the weighting of temporal information. In this way, frames that are not only visually similar but also temporally close are brought closer together in the embedding space.

[0089] Then we Run the affinity propagation clustering algorithm to generate cluster labels for each frame. Finally, we construct the binary mask as follows:

[0090] in, i, j This is the sequence number of a video frame.

[0091] This mask was subsequently used to promote cross-cluster diversity.

[0092] It should be noted that while the CLIP model is used as the feature extractor for both visual and textual data in this embodiment, any dual-tower or multimodal coding model capable of mapping video frames and text to the same latent semantic space is applicable. For example, BLIP, ALIGN, Florence, or other pre-trained visual-language models can be used instead of CLIP. These models can also calculate the cosine similarity between video regions and text, thereby supporting frame selection and cropping operations.

[0093] This invention employs affinity propagation clustering, but any clustering algorithm capable of grouping similar features is applicable, such as K-Means clustering, DBSCAN, or hierarchical clustering. The goal is to identify different content clusters within the video to guide diversity selection.

[0094] This invention can also employ action segmentation to group video frames. Specifically, an action segmentation algorithm semantically divides the video stream into several consecutive action segments along the temporal dimension. In this embodiment, each action segment is considered an independent "category" or "cluster." This method directly utilizes the action semantic boundaries of the video content to achieve a segmentation effect similar to temporal clustering, thereby providing a structured grouping basis for subsequent diversity sampling.

[0095] 2) Frame selection based on maximum marginal relevance. Building upon our time-based clustering, we now aim to select frames based on maximum marginal relevance. Select from presampled frames We selected the most representative and diverse keyframes. To simultaneously optimize relevance to the text and inter-frame diversity, we adopted the Maximum Marginal Relevance (MMR) criterion. First, we calculated the relationship between each frame and the video description. The semantic relevance is used to assess its relevance to the text:

[0096] in Represents the cosine similarity function. From cosine similarity Mapped to . Quantized frames With text description The degree of matching between them.

[0097] Next, we define the diversity score (DS) frame. and Similarity between them:

[0098] To avoid selecting multiple frames from the same cluster, we introduce a weight decay factor. Adjusted diversity score Defined as:

[0099] The smaller ones Cross-cluster frame selection is further encouraged. Subsequently, we initialize... and iteratively add those belonging to frames This makes the following objective function reach its maximum value:

[0100] in, Used to balance correlation and diversity. Selected frames are added to... In this process, the procedure is repeated until a selection is made. This process generates a keyframe sequence ordered by time.

[0101] It should be noted that this invention is not limited to the MMR formula given in the embodiments. The objective function can be modified in various ways. For example, the correlation score can be used instead. and diversity score Perform nonlinear transformations to adjust their sensitivity, such as by using their squares.

[0102] Other recommendation algorithms that can explicitly model and optimize diversity can be used to replace MMR. A typical alternative is Determinantal Point Processes (DPP). DPP is a probabilistic model suitable for subset selection tasks that require diversity. In this scenario, a kernel matrix can be constructed, where the relevance of each frame to the semantically guided text is used as its quality score, and the visual similarity between frames is used as a similarity measure. By sampling from DPP, an optimal subset of frames that combines high quality (relevance) and high diversity can be directly obtained, achieving global optimization of the entire subset.

[0103] Alternatively, a greedy algorithm can be used: in each iteration, select a frame that is least similar to the selected frame set and whose relevance score is higher than a certain preset threshold.

[0104] 3. Adaptive Frame Clipper

[0105] like Figure 2As shown, the adaptive frame cropper is applied after the semantically aware frame sampler to identify the most text-relevant local regions within each keyframe. For each keyframe... and the text description of the video This module uses a sliding window cropping technique to extract elements that are related to... Corresponding partial cropped image This partially cropped image Semantically and textual Maintaining maximum consistency results in the final cropped frame sequence. .

[0106] Specifically, for the original size is Each keyframe (in, This indicates the width of the keyframe image in pixels. (Represents the height in pixels of the keyframe image), defining the side length of a square cropping window as:

[0107] Then on the frame Pixel step size sliding Window, generate Candidate regions Using the same multimodal encoder as in the sampler, we perform [analysis] for each candidate region. Extracting text features and visual features The cosine similarity between each region and the text is calculated as follows:

[0108] The region with the highest similarity was selected as the optimal cropping region for that frame, denoted as:

[0109] The optimal cropped regions of all keyframes are recombined in chronological order to form a new video representation, denoted as:

[0110] in, Indicates the reorganized, containing A sequence of video features from the best locally cropped image.

[0111] It should be noted that the sliding window pruning strategy is usually performed during model inference to replace the traditional center pruning operation.

[0112] Specifically, during the training phase of text-video retrieval models, data augmentation techniques such as random cropping and horizontal flipping are typically used to improve the model's generalization ability, making it unsuitable to fix the cropping region at this stage. However, during the inference phase, to ensure the reproducibility and standardization of evaluation results, existing techniques usually only use deterministic center cropping to process the image into a square. This traditional center cropping method easily overlooks key semantic information located at the edges of video frames (such as key objects or actions on one side of the screen). Therefore, we apply the aforementioned sliding window cropping technique during the inference phase to dynamically locate and extract the local regions most relevant to the text description, thereby significantly improving the semantic alignment accuracy between the query text and local video content without compromising the determinism of inference.

[0113] It should be noted that the sliding window strategy is used to generate candidate regions in this embodiment of the invention. This step can be replaced by the following method: Using a pre-trained object detection model (such as YOLO, R-CNN series), all objects (people, cars, balls, etc.) in the image are directly identified, and the bounding boxes of these objects are used as candidate regions.

[0114] A saliency detection model is used to predict the most eye-catching area in the image, and candidate regions are generated based on this.

[0115] It should be noted that in this embodiment of the invention, the optimal region is selected by calculating the cosine similarity between the candidate region and the guiding text. This method can be replaced by: Text alignment based on local description: For each candidate region, an image description model is used to generate a text description of the local region, and then the text similarity between this local description and the global "semantic guide text" is calculated (e.g., using BERTScore), and the region with the highest similarity is selected.

[0116] Visual alignment based on frame-level descriptions: For each keyframe, a textual description is generated for it. Then, when cropping the frame, instead of using "semantic guide text," candidate regions are compared with the frame's own textual description, and the region with the highest similarity is selected. This method utilizes more targeted frame-level text to provide more precise local guidance for spatial cropping.

[0117] To verify the generality and effectiveness of our proposed method in text-video retrieval tasks, we conducted comparative experiments on four widely used cross-modal retrieval benchmark datasets, including MSR-VTT, MSVD, DiDeMo, and ActivityNetCaptions, as shown in Tables 1-4.

[0118] The experiments used Median Rank (MedR) and topK Recall (R@K) as evaluation metrics for the model's retrieval accuracy. Median Rank measures the median ranking of positive samples among the returned samples; a lower value indicates higher model accuracy. TopK Recall measures the proportion of positive samples within the top K returned samples; a higher value indicates higher model accuracy. SF represents the number of sampled frames used by the model to process each video. `w / ours` indicates the experimental configuration integrating our method, meaning that the experiment is built on a base model architecture (such as X-Pool, EERCF, etc.), integrating the proposed module (including a semantically aware frame sampler and an adaptive frame cropper) as a plugin, and performing frame sampling and processing according to the corresponding SF value to verify the performance gain of the method at a specific number of sampled frames.

[0119] Table 1: Comparison of search results on the MSR-VTT dataset

[0120] Table 2: Comparison of search results on the MSVD dataset

[0121] Table 3: Comparison of search results on the DiDeMo dataset

[0122] Table 4: Comparison of search results on the ActivityNetCaptions dataset

[0123] The experimental results show that the VideoFocus module of this invention can be integrated as a plug-and-play component into existing mainstream retrieval models (such as X-Pool, EERCF, and PAU). The results demonstrate that after integrating the method of this invention, the retrieval performance of each baseline model is significantly improved across all datasets. The performance improvement is particularly pronounced on long video datasets such as ActivityNetCaptions, which is attributed to the effective capture of key spatiotemporal information by this invention.

[0124] In another embodiment, a computer storage medium stores a computer program that, when executed, implements the semantically guided video frame processing method described above.

[0125] The specific implementation method is the same as the semantically guided video frame processing method described above, and will not be repeated here.

[0126] It should be understood that the specific embodiments described above are merely illustrative or explanatory of the principles of the invention and do not constitute a limitation thereof. Therefore, any modifications, equivalent substitutions, improvements, etc., made without departing from the spirit and scope of the invention should be included within the protection scope of the invention. Furthermore, the appended claims are intended to cover all variations and modifications falling within the scope and boundaries of the appended claims, or equivalent forms of such scope and boundaries.

Claims

1. A semantically guided video frame processing method, characterized in that, Includes the following steps: S01: Obtain the original video and get the semantic guidance text; S02: Encode the temporal location information of each frame and fuse it with the visual features of that frame to form temporal enhancement features. Group the video frames according to the temporal enhancement features and select multiple representative and diverse key frames from the pre-sampled frames. S03: Generate multiple candidate local cropping regions for the selected keyframe, calculate the semantic similarity between each candidate region and the semantic guidance text, and crop out the candidate region with the highest similarity to the semantic guidance text.

2. The semantically guided video frame processing method according to claim 1, characterized in that, In step S01, the semantic guidance text is generated by inputting the original video into the language model or by user input.

3. The semantically guided video frame processing method according to claim 1, characterized in that, The formation of temporal enhancement features includes: A pre-trained multimodal encoder is used to extract visual features from each frame of the video, and semantic features are extracted from the semantic guidance text of the video. Normalize the timestamp of each frame to ,in, This indicates the sequence number of the current frame in the video sequence. This indicates the number of frames presampled from the original video; Encode time and location information : in, Represents the dimensional index in visual features. d Dimensions of visual features; Combining location encoding with visual features to form temporally enhanced features: in, It is a hyperparameter that controls the weighting of time information. It is a visual feature.

4. The semantically guided video frame processing method according to claim 3, characterized in that, Grouping video frames based on temporal enhancement features includes: Temporal enhancement features Clustering algorithms are used to group similar features and generate cluster labels for each video frame. ; Construct a binary mask as follows: in, i, j This is the sequence number of a video frame.

5. The semantically guided video frame processing method according to claim 1, characterized in that, Selecting multiple representative and diverse keyframes from pre-sampled frames includes: Calculate the semantic relevance of each video frame to the semantic guidance text: in, As a visual feature, Semantic features that guide the text. Represents the cosine similarity function. To convert cosine similarity from Mapped to ; Calculate frames and Diversity score between: Introduce a weight decay factor The diversity score was adjusted, and the adjusted diversity score is shown below. for: in, It is a binary mask. i, j This is the sequence number of a video frame; Initialize collection and iteratively add those belonging to frames This makes the following objective function reach its maximum value: in, Used to balance correlation and diversity; The selected frame was added to In this process, the procedure is repeated until a selection is made. Frames, thus obtaining a time-ordered keyframe sequence. , Indicates the first One target keyframe.

6. The semantically guided video frame processing method according to claim 1, characterized in that, Selecting multiple representative and diverse keyframes from pre-sampled frames includes: Construct a kernel matrix, using the relevance of each frame to the semantically guided text as its quality score, and the visual similarity between frames as a similarity measure; By sampling from the determinant point process, an optimal subset of frames with high quality and high diversity is obtained. , Indicates the first One target keyframe, This represents the number of keyframes.

7. The semantically guided video frame processing method according to claim 1, characterized in that, The candidate regions with the highest similarity to the semantic guidance text include: Define the side length of a square cropping window as: in, This indicates the width of the keyframe image in pixels. This indicates the height (in pixels) of the keyframe image. On each keyframe Pixel step size sliding Window, generate Candidate regions ; For each candidate region Extracting semantic features from semantically guided text and visual features And calculate the cosine similarity between each candidate region and the semantically guided text: The candidate region with the highest cosine similarity is selected as the best local cropping region for this frame, denoted as: Here, argmax() returns the input value that makes the function achieve its maximum value; The optimal cropping regions of all keyframes are recombined in chronological order to form a new video representation: in, Indicates the reorganized, containing A sequence of video features from the best locally cropped image.

8. The semantically guided video frame processing method according to claim 1, characterized in that, The candidate regions with the highest similarity to the semantic guidance text include: Use a pre-trained object detection model to detect objects and use the bounding boxes of the objects as candidate regions; For each candidate region, an image description model is used to generate a text description of the local region; Calculate the text similarity between the local text description and the semantic guidance text, and select the candidate region with the highest similarity as the best local cropping region for that frame; The optimal cropping regions of all keyframes are recombined in chronological order to form a new video representation: in, Indicates the reorganized, containing Best local cropping image The video feature sequence.

9. A semantically guided video frame processing system, used to implement the semantically guided video frame processing method as described in any one of claims 1-8, characterized in that, include: The semantic guidance text generation module acquires the original video and obtains the semantic guidance text. The semantically aware frame sampler encodes the temporal location information of each frame and fuses it with the visual features of that frame to form temporal enhancement features. Based on the temporal enhancement features, the video frames are grouped, and multiple representative and diverse key frames are selected from the pre-sampled frames. The adaptive frame cropper generates multiple candidate local cropping regions for the selected keyframe, calculates the semantic similarity between each candidate region and the semantic guidance text, and crops out the candidate region with the highest similarity to the semantic guidance text.

10. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the semantically guided video frame processing method according to any one of claims 1-8.