Long video positioning method and device, computer equipment and storage medium

By extracting target images and obtaining timestamps from short videos, combining them with target detection boxes for matching, expanding the time range and performing confidence scoring, and utilizing the spatial features of target detection boxes for image content matching, the problem of inaccurate localization in long videos is solved, achieving fast and accurate localization.

CN122024129APending Publication Date: 2026-05-12SHENZHEN ARATEK BIOMETRICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN ARATEK BIOMETRICS TECH CO LTD
Filing Date
2025-12-30
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In existing technologies, when relying on timestamps for long video positioning, inaccurate positioning can occur due to device clock deviation, system recording delay, or storage synchronization error, making it difficult to achieve frame-level accuracy matching.

Method used

By extracting target images and obtaining timestamps from short videos, matching them with target detection boxes, expanding the time range and performing confidence scoring, dynamically adjusting the search range, and utilizing the spatial features of target detection boxes to perform image content matching.

Benefits of technology

It enables the rapid and accurate location of short videos within long videos without relying on accurate timestamps, overcoming the positioning deviation caused by inaccurate timestamps and improving the efficiency and accuracy of positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122024129A_ABST
    Figure CN122024129A_ABST
Patent Text Reader

Abstract

The invention discloses a long video positioning method and device, computer equipment and a storage medium, and relates to the field of artificial intelligence, and the method comprises the steps: responding to a received abnormal short video, extracting a first target image, obtaining a timestamp associated with the first target image, and determining a target positioning time range in an original long video stream corresponding to the abnormal short video; performing target detection on the first target image, and extracting at least one first target detection frame of the first target image; performing target detection on a second target image in the original long video stream within the target positioning time range, and extracting at least one second target detection frame of the second target image; matching the first target image with the second target image based on the first target detection frame and the second target detection frame; and determining an accurate positioning position of the abnormal short video in the original long video stream based on the second target image successfully matched with the first target image. According to the invention, accurate and efficient positioning from an abnormal short video to an original long video is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a long video positioning method, apparatus, computer device, and storage medium. Background Technology

[0002] In the field of video surveillance, to quickly present abnormal events, short video clips containing abnormal content are typically extracted from long-recorded raw video streams. While short videos can quickly showcase abnormal events, their limited length often prevents them from fully displaying the entirety of the event, such as the triggers, subsequent developments, or key contextual information like related environmental changes.

[0003] Therefore, in practical applications, it is often necessary to reverse-engineer the generated short video to its corresponding time segment in the original long video in order to perform full-process backtracking and analysis. Currently, common positioning methods rely on the generation timestamp attached to the short video. However, due to reasons such as device clock deviation, system recording delay, or storage synchronization errors, timestamp information is often inaccurate or offset, making it difficult to achieve frame-level precision matching when searching within a long video based solely on the timestamp, and may even lead to positioning in completely unrelated video segments. Summary of the Invention

[0004] This invention provides a long video positioning method, apparatus, computer device, and storage medium, aiming to solve the technical problem of how to achieve fast and accurate positioning of short video content in long videos without relying on accurate timestamps.

[0005] In a first aspect, embodiments of the present invention provide a long video localization method, comprising: In response to receiving an abnormal short video, a first target image is extracted from the abnormal short video, a timestamp associated with the first target image is obtained, and a target location time range is determined in the original long video stream corresponding to the abnormal short video based on the timestamp. Target detection is performed on the first target image to extract at least one first target detection box from the first target image; Target detection is performed on the second target image in the original long video stream within the target positioning time range, and at least one second target detection box is extracted from the second target image; The first target image and the second target image are matched based on the first target detection box and the second target detection box; Based on the second target image that is successfully matched with the first target image, the precise location of the abnormal short video in the original long video stream is determined.

[0006] A further technical solution is that determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Based on the time indicated by the timestamp, the target positioning time range is formed by extending forward and backward by a preset time period.

[0007] A further technical solution is that determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Obtain a confidence score for the timestamp, the confidence score being determined based on the reliability of the device or system that generated the timestamp; The duration of the target location time range is determined based on the confidence score, wherein the higher the confidence score, the shorter the duration; The target positioning time range is determined based on the duration, wherein the timestamp is located at the midpoint of the target positioning time range.

[0008] A further technical solution is that, if the first target image has only one first target detection box and the second target image has only one second target detection box, the matching of the first target image and the second target image based on the first target detection box and the second target detection box includes: A first similarity between the first target image and the second target image is determined based on the first target detection box and the second target detection box; If the first similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the first similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0009] A further technical solution is that determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: Based on the position and size parameters of the first target detection box and the second target detection box, the position similarity component and the size similarity component are calculated respectively. The position similarity component and the size similarity component are weighted according to preset position weights and size weights to obtain the first similarity.

[0010] A further technical solution is that determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: The first feature vector of the first target detection box is determined based on the position and size parameters of the first target detection box; The second feature vector of the first target detection box is determined based on the position and size parameters of the second target detection box; The first similarity is determined by similarity calculation based on the first feature vector and the second feature vector.

[0011] A further technical solution is that, if the first target image includes multiple first target detection boxes and the second target image includes multiple second target detection boxes, the matching of the first target image and the second target image based on the first target detection boxes and the second target detection boxes includes: If the number of the first target detection boxes is different from the number of the second target detection boxes, it is determined that the first target image and the second target image do not match. If the number of the first target detection boxes is the same as the number of the second target detection boxes, then the second target detection boxes corresponding to the first target detection boxes are determined respectively; Calculate the first similarity between each of the first target detection boxes and the corresponding second target detection boxes; Obtain the first relative position features of multiple first target detection boxes in the first target image and the second relative position features of multiple second target detection boxes in the second target image, and determine the second similarity based on the first relative position features and the second relative position features; Based on the first similarity and the second similarity between each of the first target detection boxes and the corresponding second target detection boxes, the overall similarity between the first target image and the second target image is determined; If the overall similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the overall similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0012] Secondly, embodiments of the present invention also provide a long video positioning device, which includes a unit for performing the above-described method.

[0013] Thirdly, embodiments of the present invention also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0014] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the above-described method.

[0015] This invention provides a long video localization method, apparatus, computer device, and storage medium. The method includes: in response to receiving an abnormal short video, extracting a first target image from the abnormal short video, obtaining a timestamp associated with the first target image, and determining a target localization time range in the original long video stream corresponding to the abnormal short video based on the timestamp; performing target detection on the first target image and extracting at least one first target detection box of the first target image; performing target detection on a second target image in the original long video stream within the target localization time range and extracting at least one second target detection box of the second target image; matching the first target image and the second target image based on the first target detection box and the second target detection box; and determining the precise localization position of the abnormal short video in the original long video stream based on the second target image that successfully matches the first target image. This invention enables accurate localization of a short video within an original long video. Firstly, this invention determines an initial search range in the original long video based on the timestamp of the abnormal short video, effectively narrowing the localization interval. Subsequently, by performing target detection on images in both the short and long videos, target detection boxes are extracted as matching features. Finally, image content matching is achieved by comparing the spatial features of the detection boxes, thereby determining the precise location. This method effectively overcomes the positioning deviation caused by inaccurate timestamps. By combining time reference and content matching, it achieves accurate and efficient positioning from abnormal short videos to original long videos. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating a long video localization method provided in an embodiment of the present invention; Figure 2 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present 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 the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0020] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0021] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0022] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0023] Please see Figure 1 This invention provides a long video localization method, which includes the following steps: S1, in response to receiving an abnormal short video, extract a first target image from the abnormal short video, obtain a timestamp associated with the first target image, and determine the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp.

[0024] In practice, in response to receiving an abnormal short video, a first target image is extracted from the abnormal short video, and a timestamp associated with the first target image is obtained. Based on the timestamp, the target location time range is determined in the original long video stream corresponding to the abnormal short video. The core purpose is to establish a preliminary search range, effectively balancing search efficiency and fault tolerance requirements. Although timestamps may contain systematic errors, they still provide valuable time references. By expanding a single point in time into a time range, the system avoids the resource consumption of blindly searching the entire video and reserves sufficient correction space for subsequent precise location. For example, when the monitoring system has a fixed time delay, this step ensures that the video segment containing the real scene is included in the target location time range, laying the foundation for subsequent processing.

[0025] The first target image may be selected by the user or it may be an image reflecting an abnormal event determined based on semantic analysis of the abnormal short video. This invention does not specifically limit the specific type of image.

[0026] In some preferred embodiments, the above step "determine the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp" specifically includes the following steps: using the time indicated by the timestamp as a reference, extend forward and backward by a preset duration to form the target location time range.

[0027] In practical implementation, by symmetrically expanding a preset time range forward and backward based on the timestamp to form the target positioning time range, a simple and easy-to-implement range delineation strategy is provided, which can effectively cover the possible positive and negative deviation range of the timestamp while ensuring retrieval efficiency. The preset time range can be set by those skilled in the art, and this invention is not specifically limited thereto.

[0028] Since timestamp errors are typically bidirectional—that is, they may be ahead of or behind the actual time—symmetrical expansion can include the target image frame within the defined time window with a high probability, avoiding target loss due to unidirectional bias. Furthermore, the preset duration can be optimized and adjusted according to specific application scenarios. For example, a shorter interval can be set in rapidly changing scenarios to improve search speed, while a wider interval can be set in systems with significant timing jitter to enhance fault tolerance. This embodiment provides a reliable search foundation for subsequent image content matching without excessively increasing the computational burden, and is an important guarantee for achieving efficient and reliable positioning.

[0029] In some preferred embodiments, the above step "determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp" specifically includes the following steps: obtaining a confidence score for the timestamp, the confidence score being determined based on the reliability of the device or system that generated the timestamp; determining the duration of the target location time range based on the confidence score, wherein the higher the confidence score, the shorter the duration; and determining the target location time range based on the duration, wherein the timestamp is located at the midpoint of the target location time range.

[0030] In practical implementation, by introducing a confidence score for timestamps and dynamically adjusting the duration of the target positioning time range accordingly, intelligent and adaptive optimization of the positioning strategy is achieved. The confidence score is determined based on the reliability of the device or system generating the timestamps. For example, timestamps generated by high-precision time synchronization devices have high confidence, while time-series signals generated by low-reliability systems correspond to low confidence. The system automatically adjusts the search range according to the confidence level: when the confidence level is high, the target positioning time range is narrowed to reduce unnecessary image processing and improve positioning efficiency; when the confidence level is low, the search range is expanded to compensate for temporal uncertainties and ensure that no target frames are missed. This embodiment effectively solves the problem of positioning adaptability under different quality signal sources, enabling the system to maintain stable performance when facing heterogeneous video sources, and improving the versatility and engineering practical value of the method.

[0031] In one embodiment, the specific implementation is as follows: First, the confidence score acquisition step is performed. The system obtains the unique identifier of the source device or system that generated the timestamp by parsing the metadata of the video file or querying the device registration information generated by the video. This identifier is then matched against a pre-established device reliability database, which stores reliability ratings corresponding to different device models or system versions. This reliability rating is determined based on a combination of objective factors, including but not limited to the crystal oscillator accuracy of the device's built-in clock, the type of time synchronization protocol supported by the device and its theoretical accuracy, and statistical results of the accuracy of the device's time recordings during historical use. Based on the reliability rating obtained from the query, the system quantifies it into a numerical confidence score according to a preset scoring comparison table.

[0032] Further, a dynamic duration calculation step is performed. The system has a preset mapping relationship between confidence scores and duration, and the target duration corresponding to the target positioning time range is determined based on this mapping relationship. Specifically, in the mapping relationship, the higher the confidence score, the shorter the duration.

[0033] Further, the time range determination step is performed. The absolute time point indicated by the timestamp is used as the reference center point of the target positioning time range. The target duration calculated in the previous steps is divided into two equal time periods, which are used as the forward expansion amount and the backward expansion amount, respectively. Using the reference center point as the symmetrical point, the forward expansion amount is traced forward, and the backward expansion amount is extended backward, thereby forming a target positioning time range that is completely symmetrical with the timestamp as the center. This symmetrical design can evenly cover the possible positive and negative deviations of the timestamp, ensuring that the target frame is included in the range while minimizing the search range to improve the efficiency of subsequent processing.

[0034] S2, perform target detection on the first target image and extract at least one first target detection box from the first target image.

[0035] In specific implementation, target detection is performed on the first target image, and at least one first target detection box is extracted from the first target image. This transforms the visual content into structured data, providing a stable and reliable feature basis for image matching. The target detection box precisely describes the position and size of the target in a quantified form. This spatial feature is insensitive to temporal errors but highly sensitive to scene content. Even if changes in illumination cause alterations in image color or texture, the core spatial distribution features of the target remain stable, making it possible to identify the same scene in different video segments. Target detection can be based on a pre-trained target detection model (e.g., YOLO), and this invention does not limit the specific model.

[0036] S3, perform target detection on the second target image in the original long video stream within the target positioning time range, and extract at least one second target detection box from the second target image.

[0037] In specific implementation, target detection is performed on the second target image in the original long video stream within the target positioning time range, and at least one second target detection box is extracted from the second target image. The purpose is to construct a feature set to be matched, thereby achieving intelligent compression of the search space. The system can perform full or partial comparison of the second target images within the target positioning time range; the specific comparison method is not limited in this invention. Second target detection boxes are extracted for each second target image. Target detection can be based on a pre-trained target detection model (e.g., YOLO); this invention does not limit the specific model.

[0038] S4, Match the first target image and the second target image based on the first target detection box and the second target detection box.

[0039] In practice, the system matches the first and second target images based on the first and second target detection boxes, achieving accurate content-level recognition. This overcomes the limitations of timestamp accuracy and establishes a reliable matching mechanism. By comparing the spatial features of the detection boxes, the system can identify image frames with consistent content, even if these frames deviate in the temporal dimension. For example, in multi-person scenarios, by comparing the positional relationships and relative sizes of multiple individuals, the system can accurately identify identical monitoring scenes, effectively overcoming the positioning difficulties caused by time synchronization issues.

[0040] In some preferred embodiments, if the first target image has only one first target detection box and the second target image has only one second target detection box, the above step "matching the first target image and the second target image based on the first target detection box and the second target detection box" specifically includes the following steps: determining a first similarity between the first target image and the second target image based on the first target detection box and the second target detection box; if the first similarity is greater than a preset similarity threshold, determining that the first target image and the second target image match; if the first similarity is not greater than the preset similarity threshold, determining that the first target image and the second target image do not match.

[0041] In practical implementation, for single-target detection box scenarios, image matching is achieved by calculating a first similarity and comparing it with a preset threshold. This provides a quantitative and deterministic matching mechanism, significantly improving the objectivity and accuracy of the matching process. When only a single target exists, directly comparing the similarity of two detection boxes avoids the complex association problems in multi-target scenarios, making the matching logic simple and efficient. By setting a similarity threshold, the system can clearly distinguish between successful and failed matches, avoiding misjudgments due to slight positional or size fluctuations. For example, when tracking a single moving object in surveillance, even if the detection boxes differ slightly due to changes in shooting angle or lighting, as long as the overall similarity exceeds the threshold, the system can still correctly identify it as the same scene. This method provides a stable and reliable matching benchmark for single-target scenarios, which is an important foundation for achieving accurate localization.

[0042] In some preferred embodiments, the above step "determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box" specifically includes the following steps: calculating the position similarity component and the size similarity component based on the position parameters and size parameters of the first target detection box and the second target detection box, respectively; and performing a weighted calculation on the position similarity component and the size similarity component according to preset position weights and size weights to obtain the first similarity.

[0043] In practice, by calculating the positional similarity component and the size similarity component separately, and then performing weighted fusion based on preset weights to obtain the first similarity score, a refined matching of multiple features is achieved, making the similarity measurement more consistent with the principle of visual consistency. Positional parameters reflect the spatial distribution of the target in the image, while size parameters characterize the salience of the target in the scene; together, they define the visual morphology of the target. By assigning different weights to position and size, the system can flexibly adjust the contribution of each feature in the matching process according to actual needs. For example, in scenarios requiring high spatial consistency, a higher positional weight can be set; while in scenarios where the target scale changes significantly, the size weight can be increased to enhance adaptability. This weighting mechanism makes the matching process both robust and flexible, effectively improving the recognition accuracy of a single target under different imaging conditions.

[0044] In one embodiment, the specific implementation is as follows: First, positional similarity component calculation is performed. The coordinates of the target point (x1, y1) of the first target detection box and the coordinates of the target point (x2, y2) of the second target detection box are obtained. The target point can be the center point or a vertex; this invention is not specifically limited. The absolute difference between the coordinates of the two detection boxes in the horizontal and vertical directions is calculated, i.e., Δx = |x1 - x2|, Δy = |y1 - y2|. These absolute differences are then normalized to the corresponding image dimensions: Δx is divided by the image width W, and Δy is divided by the image height H, yielding normalized positional offsets δx and δy. The positional similarity component S_position is calculated using the following formula: S_position = 1 - √(δx² + δy²). This calculation method ensures a negative correlation between the positional similarity component and the normalized Euclidean distance between the target points of the detection boxes, with a value ranging from 0 to 1.

[0045] Further, the size similarity component is calculated. The width w1 and height h1 of the first target detection box, and the width w2 and height h2 of the second target detection box are obtained. The width ratio r_w = min(w1 / w2, w2 / w1) and the height ratio r_h = min(h1 / h2, h2 / h1) are calculated respectively, where the min function ensures that the ratio is no greater than 1. The size similarity component S_size is calculated using the following formula: S_size = (r_w + r_h) / 2. This calculation method ensures that when the two detection boxes are exactly the same size, the size similarity component is 1; as the size difference increases, the component value gradually approaches 0.

[0046] Further, a weighted fusion step is performed. The preset position weight α and size weight β are read from the system configuration, where α + β = 1. The first similarity is calculated using the weighted summation formula: Similarity = α × S_position + β × S_size. The values ​​of the position weight α and size weight β are set according to the specific application scenario: a larger position weight is set in scenarios requiring precise spatial positioning; a larger size weight is set in scenarios where changes in target scale are significant.

[0047] In some preferred embodiments, the above step "determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box" specifically includes the following steps: determining the first feature vector of the first target detection box based on the position parameters and size parameters of the first target detection box; determining the second feature vector of the first target detection box based on the position parameters and size parameters of the second target detection box; and calculating the first similarity based on the first feature vector and the second feature vector.

[0048] In practice, by mapping the parameters of the target detection box to feature vectors and calculating the first similarity based on the similarity between vectors, the matching process is structured and mathematically quantified, providing a unified and scalable framework for similarity measurement in complex scenarios. Feature vectors integrate multi-dimensional parameters such as position and size into a single mathematical entity, facilitating similarity analysis using mature vector space models, such as cosine similarity or Euclidean distance.

[0049] In one embodiment, the specific implementation is as follows: First, the feature vector construction step is performed. The original position and size parameters of the first target detection box are obtained, including the target point coordinates, width, and height values. The target point can be the center point or a vertex; this invention is not specifically limited. The position parameters are normalized, specifically by dividing the target point's x-coordinate by the image width to obtain a normalized x-coordinate, and dividing the target point's y-coordinate by the image height to obtain a normalized y-coordinate. Simultaneously, the size parameters are normalized by dividing the detection box width by the image width to obtain a normalized width, and dividing the detection box height by the image height to obtain a normalized height. These four normalized parameters are combined into a first feature vector according to a pre-defined arrangement order, typically a fixed order of x-coordinate, y-coordinate, width, and height. The second target detection box is processed in the same way, including the same normalization reference and the same parameter arrangement order, to generate the corresponding second feature vector.

[0050] Further, the similarity calculation step is performed. The cosine similarity algorithm from the vector space model is used to calculate the similarity between two feature vectors. The specific calculation process includes three main steps: first, calculating the sum of the element-wise products of the two feature vectors, i.e., the vector dot product operation; then, calculating the square root of the sum of the squares of each element of the two feature vectors, i.e., calculating the vector magnitude; finally, dividing the dot product result by the product of the two vector magnitudes to obtain the final similarity value. This calculation process effectively measures the directional proximity of two feature vectors, and its output value ranges from zero to one. The closer the value is to one, the higher the similarity between the two target detection boxes in terms of position and size features. This similarity calculation method based on the vector space model can comprehensively consider the coordinated changes in position and size features, providing an accurate quantitative basis for image matching.

[0051] In some preferred embodiments, if the first target image includes multiple first target detection boxes and the second target image includes multiple second target detection boxes, the above step "matching the first target image and the second target image based on the first target detection boxes and the second target detection boxes" includes: if the number of first target detection boxes is different from the number of second target detection boxes, it is determined that the first target image and the second target image do not match; if the number of first target detection boxes is the same as the number of second target detection boxes, the second target detection boxes corresponding to the first target detection boxes are determined respectively; the first similarity between each first target detection box and the corresponding second target detection box is calculated respectively; the first relative position features of the multiple first target detection boxes of the first target image and the second relative position features of the multiple second target detection boxes of the second target image are obtained, and the second similarity is determined based on the first relative position features and the second relative position features; the overall similarity between the first target image and the second target image is determined based on the first similarity between each first target detection box and the corresponding second target detection box and the second similarity; if the overall similarity is greater than a preset similarity threshold, it is determined that the first target image and the second target image match; if the overall similarity is not greater than the preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0052] In practical implementation, in multi-target detection scenarios, by introducing quantity consistency checks, individual detection box similarity calculations, and relative position feature similarity calculations, the overall similarity is finally fused to achieve a multi-level comprehensive judgment of image content consistency in complex scenes. Quantity consistency, as a preliminary screening condition, can quickly eliminate image pairs with mismatched target numbers, significantly improving processing efficiency. Based on this, the similarity of each corresponding detection box is evaluated separately to capture the visual consistency of individual targets, while the relative position features between targets are extracted to capture the spatial structure information of the scene. For example, in multi-person monitoring scenarios, even if the positions of individual individuals change slightly, as long as the overall crowd distribution pattern remains consistent, the system can still determine it as the same scene. This matching strategy combining local features and global structure greatly enhances the system's ability to identify group targets and complex scenes, improving the applicability and reliability of the localization method in real-world environments.

[0053] In some preferred embodiments, the above step of "determining the second target detection box corresponding to the first target detection box" specifically includes the following steps: generating all possible pairing combinations between the plurality of first target detection boxes and the plurality of second target detection boxes; for each pairing combination, calculating the matching degree between all paired first target detection boxes and second target detection boxes, and accumulating the overall matching degree score of the pairing combination; selecting the pairing combination with the highest overall matching degree score from all possible pairing combinations as the final correspondence determination result.

[0054] In practical implementation, a globally optimal search strategy is adopted to determine the correspondence between multi-target detection boxes, significantly improving the accuracy of target identity association in complex scenarios and effectively solving the target identity confusion problem that easily occurs in traditional pairwise matching methods. Specifically, in scenarios with multiple targets that are similar in appearance or spatially adjacent, such as dense crowds in surveillance footage or multiple vehicles at a traffic intersection, simply searching for the most similar single second target detection box for each first target detection box may lead to incorrect pairings due to local similarity interference, thereby compromising the overall scene consistency. This scheme generates all possible pairing combinations and calculates the overall matching score for each combination, ultimately selecting the combination with the highest score as the correspondence. In essence, it transforms the matching problem from a series of independent local decisions into a global optimization problem. This method can systematically consider the mutual constraints between all targets, ensuring that the final determined pairing scheme achieves the optimal overall matching degree for all target pairs.

[0055] In one embodiment, the specific implementation is as follows: First, the system performs a pairing combination generation step. When the number of first object detection boxes equals the number of second object detection boxes, the system generates all possible bidirectional one-to-one mappings. Specifically, for a scene containing N first object detection boxes and N second object detection boxes, the system constructs a set of all possible pairing combinations using a recursive algorithm or a factorial-based permutation generation algorithm. Each pairing combination contains N pairing units, each pairing unit consisting of one first object detection box and one second object detection box, and it is guaranteed that each detection box is used only once in each pairing combination. This step ensures that all possible correspondences are taken into consideration.

[0056] Further, the overall matching degree calculation step is performed. The system iterates through each pairing combination generated above, and for the currently processed pairing combination, it processes each pairing unit in turn. For each pairing unit, based on the position and size parameters of the first and second target detection boxes contained therein, the individual matching degree of the pairing is obtained according to a preset similarity calculation method. The individual matching degrees of all pairing units in the current pairing combination are summed to obtain the overall matching degree score, which represents the overall matching degree of the pairing combination. The calculation method of the individual matching degree includes, but is not limited to, similarity calculation based on the distance between the center points of the detection boxes, similarity calculation based on the size ratio of the detection boxes, or similarity calculation based on the intersection-union ratio of the detection boxes; this invention is not specifically limited to these methods.

[0057] Further, the optimal combination selection step is performed. After calculating the overall matching score for all paired combinations, the system compares the overall matching scores of all paired combinations and selects the pair with the highest overall matching score as the final correspondence determination result. When multiple paired combinations obtain the same highest overall matching score, the system handles the situation according to a preset conflict resolution strategy, including randomly selecting one of the paired combinations or selecting the paired combination with the most even distribution of individual matching scores. Through the above steps, the system can find the globally optimal detection box pairing scheme from all possible correspondences, providing an accurate correspondence basis for subsequent image matching.

[0058] In some preferred embodiments, the above step of "obtaining the first relative position features of multiple first target detection boxes of the first target image and the second relative position features of multiple second target detection boxes of the second target image, and determining the second similarity based on the first relative position features and the second relative position features" specifically includes the following steps: selecting one first target detection box from multiple first target detection boxes as a first reference detection box, taking the center point of the first reference detection box as the first origin, calculating the distance ratio and angle difference of the center points of the remaining first target detection boxes relative to the first origin, which together constitute the first relative position feature; taking the second target detection box corresponding to the first reference detection box as the second reference detection box, taking the center point of the second reference detection box as the second origin, calculating the distance ratio and angle difference of the center points of the remaining second target detection boxes relative to the second origin, which together constitute the second relative position feature; representing the first relative position feature and the second relative position feature as a first relative position feature vector and a second relative position feature vector, respectively; and obtaining the second similarity by calculating the vector similarity between the first relative position feature vector and the second relative position feature vector.

[0059] In specific implementation, by employing distance ratios and angle differences to construct relative positional features describing the spatial layout of multiple targets, a spatial relationship description method with strong invariance to image scaling and translation transformations is created. This significantly improves the robustness of image matching in practical application scenarios such as changes in viewing angle and camera distance adjustments. The distance ratio (i.e., the ratio of the distance between targets to a certain reference distance) eliminates the dependence of absolute distance on image scale; regardless of whether the camera moves closer to or further from the scene, the relative distance ratio between targets remains essentially unchanged. Simultaneously, the angle difference (i.e., the relative azimuth angle between targets) is insensitive to image translation changes; even if the entire scene moves within the frame, the angular relationship between targets remains stable. Combining these two geometric invariants into a feature vector and performing similarity comparisons allows the system to capture the most essential and stable topological structural features in the scene's spatial layout. This embodiment utilizes this characteristic, enabling the matching process to penetrate these changes in appearance and directly compare their inherent geometric structural consistency. Therefore, even when camera parameters change or some targets undergo non-rigid deformation, accurate and reliable scene recognition and localization can still be achieved.

[0060] In one embodiment, the specific implementation is as follows: First, a baseline detection box selection step is performed. The detection box with the largest area among multiple first target detection boxes is selected as the first baseline detection box. If multiple detection boxes with the same area exist, the detection box located in the center region of the image is selected first. Simultaneously, among the second target detection boxes, the detection box with the highest individual matching degree to the first baseline detection box is selected as the second baseline detection box, ensuring that the two baseline detection boxes represent the same target in their respective images.

[0061] Further, the relative position feature calculation steps are performed. A first relative coordinate system is established with the center point of the first reference detection box as the origin. Specifically, this includes: calculating the straight-line distance between each center point and the origin, and dividing this distance by the diagonal length of the reference detection box to obtain a standardized distance ratio; calculating the angle between the line connecting each center point and the origin and the horizontal axis, and subtracting this angle from the angle along the principal axis of the reference detection box to obtain an angle difference. This process is repeated for all remaining first target detection boxes, and the obtained distance ratios and angle differences are arranged in a fixed order to form the first relative position feature. The same operation is performed on the second target image, establishing a second relative coordinate system with the center point of the second reference detection box as the origin, and calculating the relative position parameters of the remaining detection boxes to form the second relative position feature.

[0062] Further, the feature vector construction step is performed. All distance ratios and angle differences in the first relative position features are concatenated into a first relative position feature vector according to a preset order, where the distance ratios and angle differences are arranged in an alternating manner. The same arrangement order and processing method are used for the second relative position features to construct the second relative position feature vector. The two feature vectors maintain the same dimensions and element order to ensure the comparability of subsequent similarity calculations.

[0063] Further, a similarity calculation step is performed. The cosine similarity algorithm is used to calculate the similarity between the first and second relative position feature vectors. The calculation process includes: calculating the dot product of the two feature vectors, calculating the magnitude of each feature vector, and then dividing the dot product by the product of the two magnitudes. The quotient is the second similarity. This similarity value ranges from zero to one; a higher value indicates a higher spatial layout similarity between multiple targets in the two images.

[0064] In some preferred embodiments, the above step "determining the overall similarity between the first target image and the second target image based on the first similarity and the second similarity between each first target detection box and the corresponding second target detection box" specifically includes the following steps: calculating the average value of each first similarity as an individual matching similarity; calculating the overall similarity based on the individual matching similarity and the second similarity; wherein the weight coefficients of the weighted calculation are dynamically adjusted according to the difference between the individual matching similarity and the second similarity: when the difference between the individual matching similarity and the second similarity increases, the weight of the higher weight coefficient is reduced, and the weight of the lower weight coefficient is increased accordingly.

[0065] In practical implementation, a dynamic weight adjustment mechanism based on the difference between individual matching similarity and spatial structure similarity is introduced, and a weighted geometric mean is used to calculate the overall similarity. This achieves an intelligent multi-source information fusion strategy, which can automatically adopt conservative decisions when internal inconsistencies occur in matching evidence, thereby significantly improving the system's discrimination reliability and fault tolerance in cases of partial target anomalies or local scene changes. Individual matching similarity (reflecting the visual consistency of each independent target) and second similarity (reflecting the consistency of the spatial layout of multiple targets) should be mutually corroborating matching evidence. When their values ​​are similar, it indicates high credibility of the matching result; when they differ significantly, it suggests that some anomaly may have occurred, such as individual targets being occluded, undergoing drastic shape changes, or being interfered with by external objects, leading to a decrease in the reliability of matching evidence in one aspect. In this case, this scheme dynamically reduces the weight of the higher one and correspondingly increases the weight of the lower one. In essence, this avoids allowing the potentially questionable "high confidence" indicator to dominate the final decision, and instead tends to adopt a conservative estimate that is closer to the lower of the two values. For example, in surveillance footage, if an individual's posture changes significantly, causing a decrease in the matching score of their individual bounding box, but the overall group layout remains unchanged (high spatial structural similarity), the system will not easily pass the match simply because the layout matches well. Instead, it will lower the weight of layout matching as the difference increases, making the final overall similarity score more reflective of the decrease in individual matching scores. This may trigger a more stringent review or directly determine a mismatch, effectively preventing false matches. This dynamic fusion mechanism based on evidence consistency gives the system a human-like ability to make careful judgments, greatly enhancing its practicality and reliability under complex and non-ideal conditions.

[0066] In one embodiment, the specific implementation is as follows: First, the individual matching similarity calculation step is performed. The system obtains the first similarity values ​​between all successfully paired first target detection boxes and second target detection boxes, calculates the arithmetic mean of these values, and uses the average value as the individual matching similarity. This value reflects the average matching degree of all paired targets at the individual level.

[0067] Further, a dynamic adjustment step for the weight coefficients is performed. The system calculates the absolute value of the difference between the individual matching similarity and the second similarity, and inputs this absolute value into a preset weight adjustment function to obtain the corresponding weight adjustment amount. The weight adjustment function is configured to output a larger weight adjustment amount when the absolute value of the difference increases, and a smaller weight adjustment amount when the absolute value of the difference decreases. Based on this weight adjustment amount, the system adjusts the initial weight coefficients of the individual matching similarity and the second similarity respectively: for similarity components with higher current values, the difference between their initial weight coefficient and the adjustment factor is calculated as the adjusted weight coefficient, thereby reducing their weight coefficient; for similarity components with lower current values, the sum of their initial weight coefficient and the adjustment factor is calculated as the adjusted weight coefficient, thereby increasing their weight coefficient, while ensuring that the sum of the two adjusted weight coefficients remains constant.

[0068] Finally, a weighted summation step is performed. The adjusted weight coefficient of the individual matching similarity is used as the first weight parameter, and the adjusted weight coefficient of the second similarity is used as the second weight parameter. The individual matching similarity and the second similarity are then weighted and summed to obtain the overall similarity. The system automatically assigns higher weights to components with lower similarity, making the final overall similarity more conservatively estimated and effectively avoiding the risk of mismatches caused by an abnormally high similarity component.

[0069] S5, based on the second target image that was successfully matched with the first target image, determine the precise location of the abnormal short video in the original long video stream.

[0070] In practice, based on the second target image that successfully matches the first target image, the precise location of the abnormal short video within the original long video stream is determined. The aim is to output the final location result, transforming the image-level matching result into a precise time-level location. Once the system finds a matching second target image, it can determine the accurate location of the abnormal short video based on the image's time point within the original long video, providing users with directly usable location information.

[0071] This invention proposes a long video localization method, comprising: in response to receiving an abnormal short video, extracting a first target image from the abnormal short video, obtaining a timestamp associated with the first target image, and determining a target localization time range in the original long video stream corresponding to the abnormal short video based on the timestamp; performing target detection on the first target image and extracting at least one first target detection box of the first target image; performing target detection on a second target image in the original long video stream within the target localization time range and extracting at least one second target detection box of the second target image; matching the first target image and the second target image based on the first target detection box and the second target detection box; and determining the precise localization position of the abnormal short video in the original long video stream based on the second target image that is successfully matched with the first target image. This invention can accurately locate the position of a short video in the original long video. Firstly, this invention determines a preliminary search range in the original long video based on the timestamp of the abnormal short video, effectively narrowing the localization interval. Subsequently, by performing target detection on images in both the short and long videos, target detection boxes are extracted as matching features. Finally, by comparing the spatial features of the detection boxes, image content matching is achieved, thereby determining the precise localization position. This method effectively overcomes the positioning deviation caused by inaccurate timestamps. By combining time references with content matching, it achieves accurate and efficient positioning from abnormal short videos to original long videos.

[0072] Corresponding to the above-described long video positioning method, the present invention also provides a long video positioning device. This long video positioning device includes a unit for performing the aforementioned long video positioning method, and can be configured in a terminal or a server. Specifically, the long video positioning device includes: A determining unit is configured to, in response to receiving an abnormal short video, extract a first target image from the abnormal short video, obtain a timestamp associated with the first target image, and determine a target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp. The first extraction unit is used to perform target detection on the first target image and extract at least one first target detection box from the first target image; The second extraction unit is used to perform target detection on the second target image in the original long video stream within the target positioning time range, and extract at least one second target detection box of the second target image; A matching unit is configured to match the first target image and the second target image based on the first target detection box and the second target detection box; The positioning unit is used to determine the precise location of the abnormal short video in the original long video stream based on the second target image that is successfully matched with the first target image.

[0073] In some preferred embodiments, determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Based on the time indicated by the timestamp, the target positioning time range is formed by extending forward and backward by a preset time period.

[0074] In some preferred embodiments, determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Obtain a confidence score for the timestamp, the confidence score being determined based on the reliability of the device or system that generated the timestamp; The duration of the target location time range is determined based on the confidence score, wherein the higher the confidence score, the shorter the duration; The target positioning time range is determined based on the duration, wherein the timestamp is located at the midpoint of the target positioning time range.

[0075] In some preferred embodiments, if the first target image has only one first target detection box and the second target image has only one second target detection box, the matching of the first target image and the second target image based on the first target detection box and the second target detection box includes: A first similarity between the first target image and the second target image is determined based on the first target detection box and the second target detection box; If the first similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the first similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0076] In some preferred embodiments, determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: Based on the position and size parameters of the first target detection box and the second target detection box, the position similarity component and the size similarity component are calculated respectively. The position similarity component and the size similarity component are weighted according to preset position weights and size weights to obtain the first similarity.

[0077] In some preferred embodiments, determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: The first feature vector of the first target detection box is determined based on the position and size parameters of the first target detection box; The second feature vector of the first target detection box is determined based on the position and size parameters of the second target detection box; The first similarity is determined by similarity calculation based on the first feature vector and the second feature vector.

[0078] In some preferred embodiments, if the first target image includes a plurality of first target detection boxes and the second target image includes a plurality of second target detection boxes, the matching of the first target image and the second target image based on the first target detection boxes and the second target detection boxes includes: If the number of the first target detection boxes is different from the number of the second target detection boxes, it is determined that the first target image and the second target image do not match. If the number of the first target detection boxes is the same as the number of the second target detection boxes, then the second target detection boxes corresponding to the first target detection boxes are determined respectively; Calculate the first similarity between each of the first target detection boxes and the corresponding second target detection boxes; Obtain the first relative position features of multiple first target detection boxes in the first target image and the second relative position features of multiple second target detection boxes in the second target image, and determine the second similarity based on the first relative position features and the second relative position features; Based on the first similarity and the second similarity between each of the first target detection boxes and the corresponding second target detection boxes, the overall similarity between the first target image and the second target image is determined; If the overall similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the overall similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0079] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned long video positioning device and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.

[0080] The aforementioned long video positioning device can be implemented as a computer program, which can, for example... Figure 2 It runs on the computer device shown.

[0081] Please see Figure 2 , Figure 2This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 500 can be a terminal or a server, wherein the server can be a standalone server or a server cluster composed of multiple servers.

[0082] The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and internal memory 504.

[0083] The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, it causes the processor 502 to perform a long video positioning method.

[0084] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.

[0085] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can perform a long video positioning method.

[0086] The network interface 505 is used for network communication with other devices. Those skilled in the art will understand that the above structure is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 500 to which the present application is applied. A specific computer device 500 may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements.

[0087] The processor 502 is used to run a computer program 5032 stored in the memory to perform the following steps: In response to receiving an abnormal short video, a first target image is extracted from the abnormal short video, a timestamp associated with the first target image is obtained, and a target location time range is determined in the original long video stream corresponding to the abnormal short video based on the timestamp. Target detection is performed on the first target image to extract at least one first target detection box from the first target image; Target detection is performed on the second target image in the original long video stream within the target positioning time range, and at least one second target detection box is extracted from the second target image; The first target image and the second target image are matched based on the first target detection box and the second target detection box; Based on the second target image that is successfully matched with the first target image, the precise location of the abnormal short video in the original long video stream is determined.

[0088] In some preferred embodiments, determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Based on the time indicated by the timestamp, the target positioning time range is formed by extending forward and backward by a preset time period.

[0089] In some preferred embodiments, determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Obtain a confidence score for the timestamp, the confidence score being determined based on the reliability of the device or system that generated the timestamp; The duration of the target location time range is determined based on the confidence score, wherein the higher the confidence score, the shorter the duration; The target positioning time range is determined based on the duration, wherein the timestamp is located at the midpoint of the target positioning time range.

[0090] In some preferred embodiments, if the first target image has only one first target detection box and the second target image has only one second target detection box, the matching of the first target image and the second target image based on the first target detection box and the second target detection box includes: A first similarity between the first target image and the second target image is determined based on the first target detection box and the second target detection box; If the first similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the first similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0091] In some preferred embodiments, determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: Based on the position and size parameters of the first target detection box and the second target detection box, the position similarity component and the size similarity component are calculated respectively. The position similarity component and the size similarity component are weighted according to preset position weights and size weights to obtain the first similarity.

[0092] In some preferred embodiments, determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: The first feature vector of the first target detection box is determined based on the position and size parameters of the first target detection box; The second feature vector of the first target detection box is determined based on the position and size parameters of the second target detection box; The first similarity is determined by similarity calculation based on the first feature vector and the second feature vector.

[0093] In some preferred embodiments, if the first target image includes a plurality of first target detection boxes and the second target image includes a plurality of second target detection boxes, the matching of the first target image and the second target image based on the first target detection boxes and the second target detection boxes includes: If the number of the first target detection boxes is different from the number of the second target detection boxes, it is determined that the first target image and the second target image do not match. If the number of the first target detection boxes is the same as the number of the second target detection boxes, then the second target detection boxes corresponding to the first target detection boxes are determined respectively; Calculate the first similarity between each of the first target detection boxes and the corresponding second target detection boxes; Obtain the first relative position features of multiple first target detection boxes in the first target image and the second relative position features of multiple second target detection boxes in the second target image, and determine the second similarity based on the first relative position features and the second relative position features; Based on the first similarity and the second similarity between each of the first target detection boxes and the corresponding second target detection boxes, the overall similarity between the first target image and the second target image is determined; If the overall similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the overall similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0094] It should be understood that in the embodiments of this application, the processor 502 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0095] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0096] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program. When executed by a processor, the computer program causes the processor to perform the following steps: In response to receiving an abnormal short video, a first target image is extracted from the abnormal short video, a timestamp associated with the first target image is obtained, and a target location time range is determined in the original long video stream corresponding to the abnormal short video based on the timestamp. Target detection is performed on the first target image to extract at least one first target detection box from the first target image; Target detection is performed on the second target image in the original long video stream within the target positioning time range, and at least one second target detection box is extracted from the second target image; The first target image and the second target image are matched based on the first target detection box and the second target detection box; Based on the second target image that is successfully matched with the first target image, the precise location of the abnormal short video in the original long video stream is determined.

[0097] In some preferred embodiments, determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Based on the time indicated by the timestamp, the target positioning time range is formed by extending forward and backward by a preset time period.

[0098] In some preferred embodiments, determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Obtain a confidence score for the timestamp, the confidence score being determined based on the reliability of the device or system that generated the timestamp; The duration of the target location time range is determined based on the confidence score, wherein the higher the confidence score, the shorter the duration; The target positioning time range is determined based on the duration, wherein the timestamp is located at the midpoint of the target positioning time range.

[0099] In some preferred embodiments, if the first target image has only one first target detection box and the second target image has only one second target detection box, the matching of the first target image and the second target image based on the first target detection box and the second target detection box includes: A first similarity between the first target image and the second target image is determined based on the first target detection box and the second target detection box; If the first similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the first similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0100] In some preferred embodiments, determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: Based on the position and size parameters of the first target detection box and the second target detection box, the position similarity component and the size similarity component are calculated respectively. The position similarity component and the size similarity component are weighted according to preset position weights and size weights to obtain the first similarity.

[0101] In some preferred embodiments, determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: The first feature vector of the first target detection box is determined based on the position and size parameters of the first target detection box; The second feature vector of the first target detection box is determined based on the position and size parameters of the second target detection box; The first similarity is determined by similarity calculation based on the first feature vector and the second feature vector.

[0102] In some preferred embodiments, if the first target image includes a plurality of first target detection boxes and the second target image includes a plurality of second target detection boxes, the matching of the first target image and the second target image based on the first target detection boxes and the second target detection boxes includes: If the number of the first target detection boxes is different from the number of the second target detection boxes, it is determined that the first target image and the second target image do not match. If the number of the first target detection boxes is the same as the number of the second target detection boxes, then the second target detection boxes corresponding to the first target detection boxes are determined respectively; Calculate the first similarity between each of the first target detection boxes and the corresponding second target detection boxes; Obtain the first relative position features of multiple first target detection boxes in the first target image and the second relative position features of multiple second target detection boxes in the second target image, and determine the second similarity based on the first relative position features and the second relative position features; Based on the first similarity and the second similarity between each of the first target detection boxes and the corresponding second target detection boxes, the overall similarity between the first target image and the second target image is determined; If the overall similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the overall similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

[0103] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, external hard drive, read-only memory (ROM), magnetic disk, or optical disk, or any other physical storage medium capable of storing program code. The computer-readable storage medium can be non-volatile or volatile.

[0104] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0105] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0106] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0107] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or 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, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0108] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0109] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Since these modifications and variations fall within the scope of the claims and their equivalents, this invention also intends to include these modifications and variations.

[0110] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A long video positioning method, characterized in that, include: In response to receiving an abnormal short video, a first target image is extracted from the abnormal short video, a timestamp associated with the first target image is obtained, and a target location time range is determined in the original long video stream corresponding to the abnormal short video based on the timestamp. Target detection is performed on the first target image to extract at least one first target detection box from the first target image; Target detection is performed on the second target image in the original long video stream within the target positioning time range, and at least one second target detection box is extracted from the second target image; The first target image and the second target image are matched based on the first target detection box and the second target detection box; Based on the second target image that is successfully matched with the first target image, the precise location of the abnormal short video in the original long video stream is determined.

2. The long video positioning method according to claim 1, characterized in that, Determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Based on the time indicated by the timestamp, the target positioning time range is formed by extending forward and backward by a preset time period.

3. The long video positioning method according to claim 1, characterized in that, Determining the target location time range in the original long video stream corresponding to the abnormal short video based on the timestamp includes: Obtain a confidence score for the timestamp, the confidence score being determined based on the reliability of the device or system that generated the timestamp; The duration of the target location time range is determined based on the confidence score, wherein the higher the confidence score, the shorter the duration; The target positioning time range is determined based on the duration, wherein the timestamp is located at the midpoint of the target positioning time range.

4. The long video positioning method according to claim 1, characterized in that, If the first target image has only one first target detection box and the second target image has only one second target detection box, the matching of the first target image and the second target image based on the first target detection box and the second target detection box includes: A first similarity between the first target image and the second target image is determined based on the first target detection box and the second target detection box; If the first similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the first similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

5. The long video positioning method according to claim 4, characterized in that, Determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: Based on the position and size parameters of the first target detection box and the second target detection box, the position similarity component and the size similarity component are calculated respectively. The position similarity component and the size similarity component are weighted according to preset position weights and size weights to obtain the first similarity.

6. The long video positioning method according to claim 4, characterized in that, Determining the first similarity between the first target image and the second target image based on the first target detection box and the second target detection box includes: The first feature vector of the first target detection box is determined based on the position and size parameters of the first target detection box; The second feature vector of the first target detection box is determined based on the position and size parameters of the second target detection box; The first similarity is determined by similarity calculation based on the first feature vector and the second feature vector.

7. The long video positioning method according to claim 1, characterized in that, If the first target image includes multiple first target detection boxes, and the second target image includes multiple second target detection boxes, the matching of the first target image and the second target image based on the first target detection boxes and the second target detection boxes includes: If the number of the first target detection boxes is different from the number of the second target detection boxes, it is determined that the first target image and the second target image do not match. If the number of the first target detection boxes is the same as the number of the second target detection boxes, then the second target detection boxes corresponding to the first target detection boxes are determined respectively; Calculate the first similarity between each of the first target detection boxes and the corresponding second target detection boxes; Obtain the first relative position features of multiple first target detection boxes in the first target image and the second relative position features of multiple second target detection boxes in the second target image, and determine the second similarity based on the first relative position features and the second relative position features; Based on the first similarity and the second similarity between each of the first target detection boxes and the corresponding second target detection boxes, the overall similarity between the first target image and the second target image is determined; If the overall similarity is greater than a preset similarity threshold, the first target image is determined to match the second target image; If the overall similarity is not greater than a preset similarity threshold, it is determined that the first target image and the second target image do not match.

8. A long video positioning device, characterized in that, Includes a unit for performing the method as described in any one of claims 1-7.

9. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, can implement the method as described in any one of claims 1-7.