Data backtracking method, device, equipment and medium
By embedding metadata in the preset extension area of the video frame and storing the processing results in the database, the problems of data pollution, storage explosion and compliance risks in intelligent driving scenarios are solved, and efficient, secure and compliant data storage and backtracking are achieved, ensuring video quality and compliance.
Patent Information
- Application Number
- CN202511021098.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-09-05
AI Technical Summary
In existing technologies for intelligent driving scenarios, the data processing and storage of video frames suffer from data pollution, storage explosion, compliance risks, and inefficiency, especially when overlaying algorithm processing results or directly embedding video frame data leads to image quality degradation and compliance risks.
Metadata is embedded in the preset extension area of the video frame, and the processing results are stored in the target database. An association is established between the metadata and the processing results to avoid direct modification of the video stream data. Column compression and ring buffer encryption signatures are used to ensure data security and compliance.
It achieves efficient, secure, and compliant data storage and backtracking without compromising video quality, ensuring the accuracy and compliance of computer vision algorithm training, avoiding data pollution and compliance risks, and achieving millisecond-level frame-level data backtracking.
Smart Images

Figure CN120602713A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a data backtracking method, device, equipment and medium. Background Art
[0002] With the deep integration of artificial intelligence and the Internet of Things (IoT) in areas such as intelligent transportation and security surveillance, the demand for processing and analyzing real-time video streams has exploded. For example, in intelligent driving scenarios, vehicle perception systems must perform real-time algorithm calculations on each frame of video when performing object detection, lane recognition, or behavior prediction. This generates structured, high-value process or result data, such as object location, category, confidence level, and trajectory prediction. This data is crucial for accident analysis, system optimization, liability determination, and judicial evidence collection.
[0003] However, current solutions often use the method of superimposing algorithm processing results on video images or directly embedding algorithm processing results into video frame data for labeling. This method has the following defects: (1) Data pollution: Visual label superposition destroys the original video data, resulting in image quality degradation, affecting subsequent algorithm training and forensic analysis; (2) Storage explosion: The label information of each frame of video data requires a large amount of storage space, resulting in a surge in the storage demand for large-scale video data; (3) Compliance risk: Modifying video stream data may violate industry standards and pose certain legal risks; (4) Inefficiency: Since the algorithm processing results and video data need to be processed synchronously, the frame encoding efficiency is affected, which can easily lead to video frame loss.
[0004] In summary, how to achieve efficient, secure, and compliant data storage and backtracking without destroying the quality of the original video is a problem that needs to be solved. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a data backtracking method, apparatus, device, and medium that can achieve efficient, secure, and compliant data storage and backtracking without compromising the quality of the original video. The specific solution is as follows:
[0006] In a first aspect, the present application discloses a data backtracking method, comprising:
[0007] Generating metadata for a currently captured target video frame, and embedding the metadata into a preset extension area corresponding to the target video frame; wherein information in the preset extension area does not participate in encoding and decoding processes of the target video frame;
[0008] Obtaining a processing result obtained by processing the target video frame using a preset intelligent algorithm, and establishing an association between the metadata and the processing result and storing them in a target database;
[0009] When a data backtracking request for any video frame is obtained, the target metadata recorded in the preset extension area corresponding to the any video frame is read to obtain the processing result corresponding to the any video frame from the target database using the target metadata.
[0010] Optionally, the metadata includes a video frame identification number and a database address pointer;
[0011] Accordingly, generating metadata for the currently captured target video frame includes:
[0012] Based on the number of currently processed video frames, a preset monotonically increasing counter is used to generate a corresponding video frame identification number for the currently captured target video frame;
[0013] The partition identifier corresponding to the target video frame is determined based on a preset time slicing rule, and an offset is determined based on the current accumulated video frame record in the storage partition corresponding to the partition identifier in the target database to generate a database address pointer based on the partition identifier and the offset.
[0014] Optionally, the time slicing rule is used to create new partitions according to fixed time periods;
[0015] Accordingly, determining the partition identifier corresponding to the target video frame based on the preset time slicing rule includes:
[0016] Determine a timestamp difference between a capture timestamp of the target video frame and a reference timestamp; the reference timestamp is a timestamp of a first captured video frame;
[0017] The partition identifier is determined based on a ratio of the timestamp difference to a duration corresponding to the fixed time period.
[0018] Optionally, the establishing an association relationship between the metadata and the processing result and storing them in a target database includes:
[0019] Compressing the processing result using a column compression algorithm corresponding to the data type of the processing result to obtain compressed data;
[0020] The video frame identification number in the metadata is associated with the compressed data and stored in a location corresponding to the target database and the database address pointer.
[0021] Optionally, the establishing an association relationship between the metadata and the processing result and storing them in a target database includes:
[0022] The metadata and the processing results are associated with each other and stored in a preset ring buffer; the ring buffer stores the processing results in ascending order of video frame identification numbers;
[0023] When the ring buffer satisfies a preset condition, all data stored in the ring buffer are concatenated into binary numbers, a first hash value corresponding to the binary number is calculated using a preset hash algorithm, the first hash value is signed using a preset private key to obtain a signature value, and the signature value and the corresponding signature batch are stored in a target partition;
[0024] The data in the ring buffer is stored in the target database, and the ring buffer is cleared.
[0025] Optionally, when the ring buffer satisfies a preset condition, all data stored in the ring buffer are concatenated into binary numbers, including:
[0026] Counting the cumulative number of video frames in the ring buffer, and if the cumulative number of video frames has reached a preset number of video frames, splicing all data stored in the ring buffer into a binary number;
[0027] If the accumulated number of video frames does not reach the preset number of video frames, it is determined whether the accumulated cache time of the data in the ring buffer exceeds the preset time threshold. If so, all the data stored in the ring buffer are spliced into binary numbers.
[0028] Optionally, after obtaining the processing result corresponding to any one of the video frames from the target database using the target metadata, the method further includes:
[0029] determining, based on the video frame identification number in the target metadata, a target signature batch to which the any video frame belongs, obtaining all processing results corresponding to the target signature batch from the target database, and calculating a binary number obtained by concatenating all the processing results using the preset hash algorithm to obtain a corresponding second hash value;
[0030] Reading a target signature value corresponding to the target signature batch from the target partition, and decrypting the target signature value using a public key corresponding to the preset private key to obtain the first hash value;
[0031] Determine whether the first hash value is the same as the second hash value, and if not, issue an alarm.
[0032] Optionally, the process of establishing an association between the metadata and the processing result and storing them in a target database further includes:
[0033] If a preset power-off event occurs, the preset capacitor power supply module is enabled to use the capacitor power supply module for power supply, and the metadata and the processing result are associated with each other and stored in the target database.
[0034] In a second aspect, the present application discloses a data backtracking device, comprising:
[0035] a metadata embedding module, configured to generate metadata for a currently captured target video frame and embed the metadata into a preset extension area corresponding to the target video frame; wherein the information in the preset extension area does not participate in the encoding and decoding processes of the target video frame;
[0036] A database storage module is used to obtain a processing result obtained by processing the target video frame using a preset intelligent algorithm, and to associate the metadata with the processing result and store them in a target database;
[0037] The data backtracking module is used to read the target metadata recorded in the preset extension area corresponding to any video frame when a data backtracking request for any video frame is obtained, so as to use the target metadata to obtain the processing result corresponding to the any video frame from the target database.
[0038] In a third aspect, the present application discloses an electronic device, comprising:
[0039] Memory, used to store computer programs;
[0040] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed data backtracking method.
[0041] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed data backtracking method are implemented.
[0042] It can be seen that the present application generates metadata for the currently captured target video frame and embeds the metadata into a preset extension area corresponding to the target video frame; wherein the information in the preset extension area does not participate in the encoding process and decoding process of the target video frame; obtains the processing result obtained after processing the target video frame using a preset intelligent algorithm, and stores the metadata and the processing result in a target database after establishing an association relationship; when a data backtracking request for any video frame is obtained, the target metadata recorded in the preset extension area corresponding to any video frame is read, so as to use the target metadata to obtain the processing result corresponding to any video frame from the target database.
[0043] Beneficial effects: After generating metadata for the currently captured target video frame, the present application embeds the metadata into a preset extension area corresponding to the target video frame. The information in the preset extension area does not participate in the encoding process of the target video frame, nor does it participate in the decoding process of the target video frame, thereby not affecting the encoding efficiency and decoding efficiency of the video frame. In addition, after the present application processes the target video frame using a preset intelligent algorithm to obtain a processing result, the processing result is associated with the generated metadata and stored in the target database. That is, the present application embeds metadata in the preset extension area and writes the complete algorithm processing result into the target database for storage, rather than superimposing it on the video stream data. In this way, data association labeling with zero screen interference is achieved, avoiding the data pollution problem caused by traditional methods. In addition, the impact of superimposing data on the image quality in the video frame is avoided, ensuring the accuracy of computer vision algorithm training. Moreover, since the present application embeds metadata in the preset extension area, there is no need to modify the video stream data, thereby ensuring compliance with industry standards and avoiding compliance risks caused by video stream modification. Subsequently, when a data backtracking request is received for any video frame, the target metadata recorded in the preset extension area corresponding to any video frame can be read first, and then the target metadata can be used to quickly obtain the processing results corresponding to any video frame from the target database, thereby achieving efficient, secure, compliant and accurate frame-level data backtracking. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0045] Figure 1 This is a flow chart of a data backtracking method disclosed in this application;
[0046] Figure 2 A schematic diagram of a hardware platform applicable to a data backtracking method disclosed in this application;
[0047] Figure 3 This is a flow chart of a specific data backtracking method disclosed in this application;
[0048] Figure 4 This is a data storage and retrieval flow chart for an intelligent driving scenario disclosed in this application;
[0049] Figure 5 This is a flow chart of another specific data backtracking method disclosed in this application;
[0050] Figure 6A flow chart of a signature mechanism for a ring buffer disclosed in this application;
[0051] Figure 7 This is a structural diagram of a data backtracking device disclosed in this application;
[0052] Figure 8 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0054] Currently, the method of labeling is often adopted, that is, superimposing the algorithm processing results on the video screen or directly embedding the algorithm processing results into the video frame data. This method has the following defects: (1) Data pollution: the visual label superposition destroys the original video data, resulting in a decrease in image quality, affecting subsequent algorithm training and forensic analysis; (2) Storage explosion: the label information of each frame of video data requires a large amount of storage space, resulting in a surge in the storage demand for large-scale video data; (3) Compliance risk: modifying video stream data may violate industry standards and pose certain legal risks; (4) Inefficiency: since the algorithm processing results and video data need to be processed synchronously, the frame encoding efficiency is affected, which can easily lead to video frame loss. To this end, the embodiment of the present application discloses a data backtracking method, device, equipment and medium, which can achieve efficient, secure and compliant data storage and backtracking without destroying the quality of the original video.
[0055] See also Figure 1 As shown, the embodiment of the present application discloses a data backtracking method, which includes:
[0056] Step S11: generating metadata for the currently captured target video frame, and embedding the metadata into a preset extension area corresponding to the target video frame; wherein the information in the preset extension area does not participate in the encoding and decoding processes of the target video frame.
[0057] First, it should be noted that in some real-time video stream acquisition scenarios, such as autonomous driving or security monitoring, a video acquisition module is used to capture high-definition video streams in real time. The video acquisition module can specifically be a camera that supports 1080P or higher resolution video acquisition.
[0058] In this embodiment, corresponding metadata is generated for each target video frame currently captured and embedded in a preset extension area corresponding to the target video frame. The information in the preset extension area is neither involved in the encoding process nor in the decoding process of the target video frame, thereby not affecting the encoding and decoding efficiency of the video frame. In addition, because the metadata is embedded in the preset extension area, there is no need to modify the video stream data, thus ensuring compliance with industry standards and avoiding compliance risks caused by video stream modifications.
[0059] Specifically, the preset extension area can be the SEI (Supplemental Enhancement Information) extension area. It's important to note that the SEI extension area is a reserved data area in video coding standards (such as H.264 and H.265 / HEVC) for storing auxiliary information unrelated to the video content. It does not affect video decoding or playback. In the standard decoding process, the decoder ignores the auxiliary data in the SEI extension area and only decodes the core image data (i.e., the VCL unit, Video Coding Layer) in the NAL (Network Abstraction Layer Unit) to restore the video frame. Therefore, the information in the SEI extension area does not participate in the reconstruction of the video image during decoding and exists only as additional data. The NAL unit is a crucial component of video coding standards, primarily responsible for segmenting, encapsulating, and identifying compressed video data to ensure data transmission across diverse network environments. It consists of a header and a payload. The VCL unit is mainly responsible for the content encoding processing of the video data. It compresses the video image through various encoding technologies, removes redundant information in the video, thereby achieving efficient compression and generating encoded video data. These data will eventually be encapsulated into the NAL unit for transmission.
[0060] In a specific implementation, for the H.265 / HEVC and H.264 coding standards, both support the user_data_unregistered type, so this embodiment specifically adopts the SEI extension area of the user_data_unregistered type and identifies it through a UUID (Universally Unique Identifier) to avoid conflicts with other SEI data. Among them, the UUID can be customized to 16 bytes. In a specific example, the UUID can be 123e4567-e89b-12d3-a456-426655440000. In addition, the present application inserts the SEI extension area after the video encoder outputs the NAL unit and before encapsulation to avoid affecting the encoding process and ensure encoding efficiency. That is, when the SEI extension area is inserted, the core encoding process of the video frame has been completely completed, and the operation of the SEI extension area does not intervene in the encoder's core encoding logic such as rate control and bit rate allocation, and therefore does not affect the execution of the encoding process.
[0061] The steps for inserting the SEI extension area include:
[0062] Generate an 8-byte metadata capsule.
[0063] 2. Construct a SEI NAL unit of type user_data_unregistered:
[0064] [SEI header] + [16-byte UUID] + [8-byte metadata capsule] + [terminator];
[0065] 3. Insert the SEI NAL unit into the video frame NAL sequence, immediately before the VCL unit.
[0066] Step S12: Obtain a processing result obtained by processing the target video frame using a preset intelligent algorithm, and associate the metadata with the processing result and store them in a target database.
[0067] In this embodiment, the real-time video stream data collected by the video acquisition module will be transmitted to the processing unit for processing. In a specific embodiment, the processing unit includes a graphics processing unit (GPU), a central processing unit (CPU) and a digital signal processor (DSP), which are used to process the video stream and embedded metadata. Among them, the processing unit will specifically use a preset intelligent algorithm to process the target video frame to obtain a processing result, and establish an association relationship between the metadata and the processing result and store them in the target database, which is specifically a time series database (TSDB). Taking the autonomous driving scenario as an example, the preset intelligent algorithm can be a target detection algorithm, a lane recognition algorithm, a trajectory prediction algorithm, etc.
[0068] That is, this application embeds metadata in a preset extension area and writes the complete algorithm processing results into the target database for storage, rather than superimposing them on the video stream data. This approach achieves data association tagging with zero screen interference, avoiding the data contamination problems caused by traditional methods. It also avoids the impact of superimposing data on video frames on image quality, ensuring the accuracy of computer vision algorithm training.
[0069] Figure 2 This is a schematic diagram of the hardware platform applicable to the data backtracking method disclosed in this application. In addition to the aforementioned video acquisition module, processing unit, and time series database, it also includes a power management module. The power management module is primarily used to provide a stable power supply for the processing unit and time series database. In particular, it supports a capacitor power supply module to ensure data persistence during power outages.
[0070] Therefore, it should also be pointed out that the process of establishing an association between the metadata and the processing results and storing them in the target database also includes: if a preset power outage event occurs, the preset capacitor power supply module is enabled to use the capacitor power supply module for power supply, so that the metadata and the processing results are associated and stored in the target database. That is, in order to cope with possible power outages, the power management module in the embodiment of the present application also provides a capacitor power supply module to provide power outage protection for the database. When the power is disconnected, the module will use a large-capacity capacitor to ensure that the data can complete the storage operation within a certain time (for example, within 50ms), thereby avoiding the risk of data loss. The working process of this module is as follows: at the moment of power interruption, the capacitor will provide short-term power support to ensure that the system completes the data writing operation; the capacitor power supply module ensures that the data can be successfully solidified into the storage medium before the power is restored, and the data will not be lost even during a short power outage.
[0071] Step S13: when a data backtracking request for any video frame is obtained, the target metadata recorded in the preset extension area corresponding to the any video frame is read, so as to obtain the processing result corresponding to the any video frame from the target database using the target metadata.
[0072] In this embodiment, when a data backtracking request for any video frame is subsequently obtained, the target metadata recorded in the SEI extension area corresponding to any video frame can be read first, and then the target metadata can be used to quickly obtain the processing result corresponding to any video frame from the time series database, thereby achieving efficient, safe, compliant and accurate frame-level data backtracking.
[0073] It can be seen that after generating metadata for the currently captured target video frame, the present application embeds the metadata into a preset extension area corresponding to the target video frame. The information in the preset extension area does not participate in the encoding process of the target video frame, nor does it participate in the decoding process of the target video frame, thereby not affecting the encoding efficiency and decoding efficiency of the video frame. In addition, after the present application processes the target video frame using a preset intelligent algorithm to obtain a processing result, the processing result is associated with the generated metadata and stored in the target database. That is, the present application embeds metadata in the preset extension area and writes the complete algorithm processing result into the target database for storage, rather than superimposing it on the video stream data. In this way, data association labeling with zero screen interference is achieved, avoiding the data pollution problem caused by traditional methods. In addition, the impact of superimposing data on the image quality in the video frame is avoided, ensuring the accuracy of computer vision algorithm training. Moreover, since the present application embeds metadata in the preset extension area, there is no need to modify the video stream data, thereby ensuring compliance with industry standards and avoiding compliance risks caused by video stream modification. Subsequently, when a data backtracking request is received for any video frame, the target metadata recorded in the preset extension area corresponding to any video frame can be read first, and then the target metadata can be used to quickly obtain the processing results corresponding to any video frame from the target database, thereby achieving efficient, secure, compliant and accurate frame-level data backtracking.
[0074] See also Figure 3 and Figure 4 As shown, the embodiment of this application discloses a specific data backtracking method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically, it includes:
[0075] Step S21: generating metadata for the currently captured target video frame, and embedding the metadata into a preset extension area corresponding to the target video frame; wherein the information in the preset extension area does not participate in the encoding and decoding processes of the target video frame.
[0076] In this embodiment, it should be further noted that the metadata includes a video frame identification number and a database address pointer. Accordingly, generating metadata for the currently captured target video frame includes: generating a corresponding video frame identification number for the currently captured target video frame using a preset monotonically increasing counter based on the number of currently processed video frames; determining a partition identification corresponding to the target video frame based on a preset time slicing rule; and determining an offset within the storage partition corresponding to the partition identification in the target database based on the currently accumulated video frame records, thereby generating a database address pointer based on the partition identification and the offset. In other words, the metadata primarily consists of two parts: a video frame identification number (FrameID) and a database address pointer (i.e., a TSDB pointer). In other words, each frame of data will embed 8 bytes of metadata into the video stream via the SEI extension area. Each metadata segment contains a frame ID and a database address pointer. This structural design avoids modification of the video image itself and meets compliance requirements.
[0077] Specifically, when generating a FrameID, a preset monotonically increasing counter is used to generate a corresponding FrameID for the currently captured target video frame based on the number of video frames processed. This monotonically increasing counter is initialized to 0 when the system first starts and automatically increments by 1 with each frame processed. The counter uses a 32-bit unsigned integer (range: 0 to 4,294,967,295). Based on a 30 FPS frame rate, the calculation is: 4,294,967,295 frames ÷ (30 frames / second × 86,400 seconds / day) ≈ 1657 days, which meets the requirement for intelligent driving devices to operate continuously without resetting.
[0078] However, considering that some commercial vehicles, such as taxis working in shifts, may operate continuously for 24 hours, a wraparound mechanism is implemented for monotonically increasing counters if the limit is exceeded. Specifically, when the counter reaches its maximum value, it is reset to 0 and the epoch identifier (i.e., Epoch) in the time series database is updated. This epoch identifier is independently stored in the metadata area of the time series database, forming a unique combination of (Epoch, FrameID). Specifically, when the 32-bit counter overflows, the Epoch value in the time series database is updated (persistently stored), the FrameID is reset to 0, and subsequent records are identified as (current Epoch + 1, FrameID). During retrieval, the record is uniquely identified by (Epoch, FrameID). For example, the initial record is (0, FrameID). After the first overflow, the record becomes (1, FrameID). After the second overflow, the record becomes (2, FrameID), and so on. Furthermore, the monotonically increasing counter uses atomic operations such as CAS (Compare and Swap) to achieve concurrency safety in multi-threaded / multi-core environments, ensuring that FrameIDs are globally unique and strictly continuous.
[0079] Specifically, when generating a database address pointer, the shard ID corresponding to the target video frame is first determined based on a preset time slicing rule. The offset (Offset) is then determined within the storage partition corresponding to the shard ID in the target database based on the current accumulated video frame records. Thus, the database address pointer is generated based on the shard ID and the offset. It is understood that the pointer structure of the database address pointer primarily consists of a shard ID and an offset, and its data bit count is 32 bits. A certain number of bits are used to store the shard ID and the offset, respectively. For example, if the upper 14 bits of the shard ID are used, a maximum of 16,384 shards can be supported, and if the lower 18 bits are used to store the offset, each shard supports a maximum of 262,144 video frame records.
[0080] In a specific embodiment, the time slicing rule is used to create a new partition according to a fixed time period; accordingly, the partition identifier corresponding to the target video frame is determined based on the preset time slicing rule, including: determining the timestamp difference between the acquisition timestamp of the target video frame and the reference timestamp; the reference timestamp is the timestamp of the first video frame acquired; and determining the partition identifier based on the ratio of the timestamp difference to the duration corresponding to the fixed time period. That is, the embodiment of the present application can create a new partition according to a fixed time period, for example, a new partition is created according to a fixed 1 hour, then 16384 partitions are calculated as one partition per hour, which can support approximately 16384÷24≈682 days. In this way, the calculation step of the partition identifier is specifically to first determine the timestamp difference between the acquisition timestamp of the target video frame and the reference timestamp, and then determine the partition identifier based on the ratio of the timestamp difference to the duration corresponding to the fixed time period, wherein the ratio takes the integer part, and the reference timestamp is the timestamp of the first video frame acquired. Its calculation expression is as follows:
[0081] Partition ID = (collection timestamp - base timestamp) ÷ 3600.
[0082] In addition, the video frame records in each partition are written in sequence, and the offset increases from 0. Each time a video frame record is written, the offset increases by 1.
[0083] Step S22: Obtain a processing result obtained by processing the target video frame using a preset intelligent algorithm, and compress the processing result using a column compression algorithm corresponding to the data type of the processing result to obtain compressed data.
[0084] In this embodiment, after obtaining the processing results of the preset intelligent algorithm, column-based compression algorithms are used to compress the data. Specifically, these include Delta-RLE timestamp compression, FBOR floating-point number compression, and incremental coordinate compression. This reduces and optimizes data storage space, thereby improving data storage efficiency. It is understood that for data generated by intelligent driving algorithms to be stored in a time series database, such as timestamps, floating-point coordinates, and incremental data, column-based compression algorithms can be used for optimization based on different data types.
[0085] Delta-RLE timestamp compression reduces the storage space occupied by timestamps by recording the delta difference between consecutive timestamps and then using run-length encoding (RLE) to compress repeated delta differences. For example, if the original timestamp sequence is [1000, 1033, 1066, 1099, 1132], Delta compression yields [1000, 33, 33, 33], which is then further compressed using RLE to [1000, 33 × 4].
[0086] FBOR floating-point compression uses the FBOR (Fixed-Point Binary Offset Representation) compression method for floating coordinate data such as target positions. By converting floating-point numbers into fixed-point numbers and recording the offset, it reduces the precision redundancy of floating-point storage and achieves efficient compression.
[0087] Incremental coordinate compression stores only the incremental changes between frames (rather than the full coordinate values) for continuously changing coordinate data, such as target trajectories. This information is then used to restore the full coordinates, significantly reducing the amount of duplicate data stored. For example, if the original coordinate sequence is [(120.5, 80.2), (120.6, 80.3), (120.7, 80.4)], incremental compression yields [(120.5, 80.2), (+0.1, +0.1), (+0.1, +0.1)].
[0088] Step S23: establishing an association between the video frame identification number in the metadata and the compressed data and storing them in a location corresponding to the database address pointer in the target database.
[0089] In this embodiment, after obtaining the compressed data, the video frame identification number in the metadata is associated with the compressed data and then stored in the target database at the location corresponding to the database address pointer. In other words, the target database is primarily used to store the metadata of the video frame and the processing results related to the preset intelligent algorithm.
[0090] Step S24: when a data backtracking request for any video frame is obtained, the target metadata recorded in the preset extension area corresponding to the any video frame is read, so as to obtain the processing result corresponding to the any video frame from the target database using the target metadata.
[0091] In this embodiment, when laboratory data analysis requires data backtracking for any video frame, the recorded target metadata, i.e., the frame ID and database address pointer, are first read from the SEI extension area corresponding to any video frame. Then, the database address pointer is used to quickly retrieve relevant data from the time series database. Combined with the video stream, millisecond-level data retrieval and accurate data backtracking can be achieved through precise frame ID matching.
[0092] During the addressing process, the shard identifier and offset are parsed from the database address pointer. The shard identifier is used to locate the storage file of the corresponding partition (such as / tsdb / shard_1023.data). The offset address within the file is then directly calculated based on the offset. Assuming that each video frame record occupies a fixed length, the offset address within the file = file starting address + offset × fixed length.
[0093] It can be seen that in this application, each frame of video data will embed 8 bytes of metadata into the video stream through the SEI extension area. Each metadata contains a frame ID and a database address pointer. This structural design avoids modification of the video image itself and meets compliance requirements. In addition, when storing data in the database, this application adopts column compression and incremental storage methods, which greatly reduces storage requirements and significantly improves data storage efficiency. When data backtracking is required, by adopting the SEI area database address pointer method, data in the time series database can be retrieved at the millisecond level, achieving accurate frame-level data backtracking and efficient laboratory analysis.
[0094] See also Figure 5 As shown, the embodiment of this application discloses a specific data backtracking method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically, it includes:
[0095] Step S31: generating metadata for the currently captured target video frame, and embedding the metadata into a preset extension area corresponding to the target video frame; wherein the information in the preset extension area does not participate in the encoding and decoding processes of the target video frame.
[0096] Step S32: Obtain the processing result obtained after processing the target video frame using a preset intelligent algorithm, and store the metadata and the processing result in a preset ring buffer after establishing an association relationship; the ring buffer stores the processing results in ascending order of the video frame identification number.
[0097] In this embodiment, a ring buffer can be opened in the memory to serve as a temporary cache before writing to the time series database, such as Figure 6 As shown in the figure. That is, after the target video frame is processed using a preset intelligent algorithm to obtain a processing result, the metadata and the processing result are first associated and then stored in the ring buffer. The ring buffer stores the processing results in ascending order of the video frame identification number (frame ID).
[0098] Step S33: When the ring buffer satisfies the preset conditions, all data stored in the ring buffer are spliced into binary numbers, and a first hash value corresponding to the binary number is calculated using a preset hash algorithm, and the first hash value is signed using a preset private key to obtain a signature value, and then the signature value and the corresponding signature batch are stored in the target partition.
[0099] In this embodiment, Figure 6As shown, when the ring buffer meets the preset conditions, all data frame IDs stored in the ring buffer are arranged in ascending order and concatenated into a binary number. A first hash value corresponding to the binary number is then calculated using a preset hash algorithm, which can be the SHA-256 (Secure Hash Algorithm) algorithm. Furthermore, the first hash value is signed using a preset private key to obtain a signature value, which is then stored along with the corresponding signature batch in the target partition. Specifically, the first hash value is signed using an ECC-P384 elliptic curve private key, which is stored in a hardware security module (HSM). The HSM is physically tamper-resistant and resistant to side-channel attacks. The private key never leaves the HSM, and the signature calculation is performed within the HSM. Since hashing and signing operations are performed whenever the ring buffer meets the preset conditions, the signature batch refers to the batch number currently being signed.
[0100] In a specific embodiment, when the ring buffer satisfies a preset condition, all data stored in the ring buffer is concatenated into a binary number, including: counting the cumulative number of video frames in the ring buffer; if the cumulative number of video frames has reached a preset number of video frames, concatenating all data stored in the ring buffer into a binary number; if the cumulative number of video frames has not reached the preset number of video frames, determining whether the cumulative cache time of the data in the ring buffer exceeds a preset time threshold; if so, concatenating all data stored in the ring buffer into a binary number. It is understood that the capacity of the ring buffer can be set to a fixed frame size, such as 1000 frames. Therefore, in a specific embodiment, if the cumulative number of video frames in the ring buffer has reached a preset number of video frames of 1000, all data stored in the ring buffer is concatenated into a binary number for hashing and signature operations. In another specific embodiment, the embodiment of the present application also sets a timeout forced trigger mechanism to avoid data delay. That is, even if the cumulative number of video frames has not reached the preset number of video frames, the cumulative cache time of the data in the current ring buffer has exceeded the preset time threshold, for example, 1 second. At this time, a forced signature operation is performed to avoid delay.
[0101] The data structure of the signature value is as follows:
[0102] {
[0103] "batch_id": "BATCH_0x3FA2", / / Unique identifier of the signature batch
[0104] "start_frame": 1001, / / starting frame ID
[0105] "end_frame": 2000, / / End frame ID
[0106] "signature": "3046022100...", / / 72-byte ECC signature
[0107] "timestamp": 1650000000 / / signature generation time
[0108] }.
[0109] Taking the ring buffer capacity as 1000 frames as an example, the unique identifier of the signature batch is calculated as follows:
[0110] batch_id = frame_id / 1000 (this is an integer division operation).
[0111] For example, batch_1 is the signature batch corresponding to the 1000 frames between 1000 and 1999.
[0112] It's also worth noting that the signature value is stored independently in the target partition of the time series database, designated as the TSDB_signatures partition. This means that, to ensure data security and integrity, this embodiment uses an ECC-P384 signature mechanism with 1,000-frame batch aggregation to encrypt and sign data, ensuring security and immutability when writing data to the database. This signature method effectively reduces efficiency issues caused by signatures, ensuring efficient and low-latency data encryption and significantly reducing encryption overhead.
[0113] Step S34: storing the data in the ring buffer to the target database, and clearing the ring buffer.
[0114] In this embodiment, after the signature is completed, the data in the ring buffer is written into the target database in batches, and the ring buffer is cleared to receive new data.
[0115] Step S35: When a data backtracking request for any video frame is obtained, the target metadata recorded in the preset extension area corresponding to the any video frame is read to obtain the processing result corresponding to the any video frame from the target database using the target metadata.
[0116] In this embodiment, after obtaining the processing result, the authenticity and integrity of the processing result may be further verified.
[0117] Therefore, after using the target metadata to obtain the processing result corresponding to the any video frame from the target database, it also includes: determining the target signature batch to which the any video frame belongs based on the video frame identification number in the target metadata, so as to obtain all processing results corresponding to the target signature batch from the target database, and using the preset hash algorithm to calculate the binary number obtained by splicing all the processing results to obtain the corresponding second hash value; reading the target signature value corresponding to the target signature batch from the target partition, and using the public key corresponding to the preset private key to decrypt the target signature value to obtain the first hash value; judging whether the first hash value is the same as the second hash value, and if not, issuing an alarm.
[0118] Specifically, this embodiment locates the target signature batch based on the frame ID in the target metadata. For example, frame ID 16290001 belongs to batch BATCH_0x3FA2 (frames between 16290000 and 16290999). All processing results corresponding to the target signature batch are read from the target database, i.e., all raw data for the batch is obtained. These data are then concatenated sequentially in ascending order by frame ID to produce a binary number. The concatenated binary number is then calculated using the same hash algorithm to obtain a corresponding second hash value, i.e., a SHA-256 hash value. Furthermore, the target signature value corresponding to the target signature batch is read from the target partition and decrypted using the public key corresponding to the preset private key (i.e., the ECC-P384 public key) to obtain the original first hash value. The first and second hash values are then determined to be identical. If they are, the data is complete and authentic. If they are not, a security alert is triggered.
[0119] For more specific processing procedures of the above steps S31 and S35, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be elaborated here.
[0120] As can be seen, to ensure the security and integrity of data, this application uses the ECC-P384 signature mechanism with 1,000-frame batch aggregation to encrypt and sign the data, ensuring the security and non-tamperability of the data when it is written to the database. This signature method can effectively reduce the efficiency issues caused by signatures, ensure efficient and low-latency data encryption, and greatly reduce encryption overhead. In this way, after obtaining the processing results, the authenticity and integrity of the processing results can be further verified.
[0121] See also Figure 7 As shown, an embodiment of the present application discloses a data backtracking device, which includes:
[0122] A metadata embedding module 11 is configured to generate metadata for a currently captured target video frame and embed the metadata into a preset extension area corresponding to the target video frame; wherein the information in the preset extension area does not participate in the encoding and decoding processes of the target video frame;
[0123] The database storage module 12 is used to obtain the processing result obtained by processing the target video frame using a preset intelligent algorithm, and to associate the metadata with the processing result and store them in a target database;
[0124] The data backtracking module 13 is used to read the target metadata recorded in the preset extension area corresponding to any video frame when a data backtracking request for any video frame is obtained, so as to use the target metadata to obtain the processing result corresponding to the any video frame from the target database.
[0125] It can be seen that after generating metadata for the currently captured target video frame, the present application embeds the metadata into a preset extension area corresponding to the target video frame. The information in the preset extension area does not participate in the encoding process of the target video frame, nor does it participate in the decoding process of the target video frame, thereby not affecting the encoding efficiency and decoding efficiency of the video frame. In addition, after the present application processes the target video frame using a preset intelligent algorithm to obtain a processing result, the processing result is associated with the generated metadata and stored in the target database. That is, the present application embeds metadata in the preset extension area and writes the complete algorithm processing result into the target database for storage, rather than superimposing it on the video stream data. In this way, data association labeling with zero screen interference is achieved, avoiding the data pollution problem caused by traditional methods. In addition, the impact of superimposing data on the image quality in the video frame is avoided, ensuring the accuracy of computer vision algorithm training. Moreover, since the present application embeds metadata in the preset extension area, there is no need to modify the video stream data, thereby ensuring compliance with industry standards and avoiding compliance risks caused by video stream modification. Subsequently, when a data backtracking request is received for any video frame, the target metadata recorded in the preset extension area corresponding to any video frame can be read first, and then the target metadata can be used to quickly obtain the processing results corresponding to any video frame from the target database, thereby achieving efficient, secure, compliant and accurate frame-level data backtracking.
[0126] Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, the device may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the data backtracking method performed by the electronic device disclosed in any of the aforementioned embodiments.
[0127] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0128] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0129] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0130] Among them, the operating system 221 is used to manage and control the various hardware devices and computer programs 222 on the electronic device 20 to enable the processor 21 to calculate and process the massive data 223 in the memory 22. It can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the data backtracking method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs that can be used to complete other specific tasks. In addition to including data received by the electronic device and transmitted from an external device, the data 223 can also include data collected by its own input and output interface 25.
[0131] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the data backtracking method disclosed in any of the aforementioned embodiments are implemented.
[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0133] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0134] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.
[0135] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0136] The above is a detailed introduction to the data backtracking method, device, equipment and storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.
Claims
1. A data backtracking method, characterized in that: include: Generating metadata for a currently captured target video frame, and embedding the metadata into a preset extension area corresponding to the target video frame; wherein information in the preset extension area does not participate in encoding and decoding processes of the target video frame; Obtaining a processing result obtained by processing the target video frame using a preset intelligent algorithm, and establishing an association between the metadata and the processing result and storing them in a target database; When a data backtracking request for any video frame is obtained, the target metadata recorded in the preset extension area corresponding to the any video frame is read to obtain the processing result corresponding to the any video frame from the target database using the target metadata.
2. The data backtracking method according to claim 1, characterized in that: The metadata includes a video frame identification number and a database address pointer; Accordingly, generating metadata for the currently captured target video frame includes: Based on the number of currently processed video frames, a preset monotonically increasing counter is used to generate a corresponding video frame identification number for the currently captured target video frame; The partition identifier corresponding to the target video frame is determined based on a preset time slicing rule, and an offset is determined based on the current accumulated video frame record in the storage partition corresponding to the partition identifier in the target database to generate a database address pointer based on the partition identifier and the offset.
3. The data backtracking method according to claim 2, characterized in that: The time slicing rule is used to create new partitions according to fixed time periods; Accordingly, determining the partition identifier corresponding to the target video frame based on the preset time slicing rule includes: Determine a timestamp difference between a capture timestamp of the target video frame and a reference timestamp; the reference timestamp is a timestamp of a first captured video frame; The partition identifier is determined based on a ratio of the timestamp difference to a duration corresponding to the fixed time period.
4. The data backtracking method according to claim 2, characterized in that: The step of establishing an association between the metadata and the processing result and storing the result in a target database includes: Compressing the processing result using a column compression algorithm corresponding to the data type of the processing result to obtain compressed data; The video frame identification number in the metadata is associated with the compressed data and stored in a location corresponding to the target database and the database address pointer.
5. The data backtracking method according to claim 2, characterized in that: The step of establishing an association between the metadata and the processing result and storing the result in a target database includes: The metadata and the processing results are associated with each other and stored in a preset ring buffer; the ring buffer stores the processing results in ascending order of video frame identification numbers; When the ring buffer satisfies a preset condition, all data stored in the ring buffer are concatenated into binary numbers, a first hash value corresponding to the binary number is calculated using a preset hash algorithm, the first hash value is signed using a preset private key to obtain a signature value, and the signature value and the corresponding signature batch are stored in a target partition; The data in the ring buffer is stored in the target database, and the ring buffer is cleared.
6. The data backtracking method according to claim 5, characterized in that: When the ring buffer satisfies a preset condition, all data stored in the ring buffer are concatenated into binary numbers, including: Counting the cumulative number of video frames in the ring buffer, and if the cumulative number of video frames has reached a preset number of video frames, splicing all data stored in the ring buffer into a binary number; If the accumulated number of video frames does not reach the preset number of video frames, it is determined whether the accumulated cache time of the data in the ring buffer exceeds the preset time threshold. If so, all the data stored in the ring buffer are spliced into binary numbers.
7. The data backtracking method according to claim 5, characterized in that: After obtaining the processing result corresponding to any one of the video frames from the target database using the target metadata, the method further includes: determining, based on the video frame identification number in the target metadata, a target signature batch to which the any video frame belongs, obtaining all processing results corresponding to the target signature batch from the target database, and calculating a binary number obtained by concatenating all the processing results using the preset hash algorithm to obtain a corresponding second hash value; Reading a target signature value corresponding to the target signature batch from the target partition, and decrypting the target signature value using a public key corresponding to the preset private key to obtain the first hash value; Determine whether the first hash value is the same as the second hash value, and if not, issue an alarm.
8. The data backtracking method according to any one of claims 1 to 7, characterized in that: The process of establishing an association relationship between the metadata and the processing result and storing them in the target database further includes: If a preset power-off event occurs, the preset capacitor power supply module is enabled to use the capacitor power supply module for power supply, and the metadata and the processing result are associated with each other and stored in the target database.
9. A data backtracking device, characterized in that: include: a metadata embedding module, configured to generate metadata for a currently captured target video frame and embed the metadata into a preset extension area corresponding to the target video frame; wherein the information in the preset extension area does not participate in the encoding and decoding processes of the target video frame; A database storage module is used to obtain a processing result obtained by processing the target video frame using a preset intelligent algorithm, and to associate the metadata with the processing result and store them in a target database; The data backtracking module is used to read the target metadata recorded in the preset extension area corresponding to any video frame when a data backtracking request for any video frame is obtained, so as to use the target metadata to obtain the processing result corresponding to the any video frame from the target database.
10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the data backtracking method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the data backtracking method according to any one of claims 1 to 8 are implemented.