Partition-based video slice storage method and device
By adopting partition-based video slicing storage method in video surveillance service, and using the YOLO algorithm to build video slicing and partitioning models, the problems of low video access efficiency and slow retrieval speed are solved, and the fast positioning of video time points and the fast positioning of feature events are achieved.
Patent Information
- Application Number
- CN202411553440.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-02
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-02
AI Technical Summary
In the prior art, the real-time video access efficiency of camera terminals in the video surveillance service is low and the retrieval speed is slow, making it difficult to improve slicing speed and access efficiency.
The partition-based video slicing storage method is adopted to construct video slicing using the YOLO algorithm through the timestamp and fixed video size of real-time video, and a video partition and mapping model is constructed based on the timestamp and threshold of the video slicing. The video slicing data is parsed and the storage location is determined using message middleware.
It realizes fast positioning of video time points, can locate feature events faster, reduce the risk of loss of video clips, and balance storage resource usage through dynamic thresholds.
Smart Images

Figure CN119629384A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data storage technology, and in particular to a partition-based video slice storage method and device. Background Art
[0002] In the prior art, video slicing is used to improve video playback efficiency, facilitate video editing and processing, and facilitate network transmission. By splitting video files into smaller segments, videos can be loaded and played on demand, thereby improving video loading speed and playback efficiency. In addition, slicing can reduce computing load and avoid network congestion caused by large single-transmission files.
[0003] Live video applications with millions of users need to support the storage and access of massive video slice data. Although data processing can be achieved through distributed and data slicing technologies, a single video slice index will still affect the access speed of data. In addition, there is still much room for improvement in slicing speed, access efficiency, storage efficiency, and other aspects.
[0004] Therefore, it is necessary to provide a partition-based video slice storage method and device to solve the above problems. Summary of the invention
[0005] The present invention aims to provide a partition-based video slicing storage method and device to solve the technical problems of low access efficiency and slow retrieval speed of real-time video of camera terminals in video surveillance services in the prior art, how to improve the slicing speed, how to improve the access efficiency, etc. The technical problems to be solved by the present invention are achieved through the following technical solutions.
[0006] The first aspect of the present invention proposes a partition-based video slice storage method, which includes: based on the timestamp of the real-time video and the fixed video size, using the YOLO algorithm to analyze the video to be processed to construct video slices, and determining the weights corresponding to each video slice; based on the timestamp and threshold of the video slice, constructing a timeline-based video partition and video slice mapping model; using the message middleware to obtain the video message to be processed, and parsing the video slice data from the video message; according to the constructed mapping model, the parsed video slice data is compared with the timestamp of the video partition to determine the storage location.
[0007] The second aspect of the present invention proposes a partition-based video slice storage device, which adopts the partition-based video slice storage method described in the first aspect of the present invention. The video slice storage device includes: a first construction module, which uses the YOLO algorithm to analyze the video to be processed based on the timestamp of the real-time video and the fixed video size to construct video slices, and determines the weights corresponding to each video slice; a second construction module, which constructs a mapping model of video partitions and video slices based on the timeline based on the timestamp and threshold of the video slice; a parsing and processing module, which uses the message middleware to obtain the video message to be processed, and parses the video slice data from the video message; a storage module, which compares the parsed video slice data with the timestamp of the video partition according to the constructed mapping model to determine the storage location.
[0008] The third aspect of the present invention provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the partition-based video slice storage method described in the first aspect of the present invention.
[0009] A fourth aspect of the present invention provides a computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the partition-based video slice storage method described in the first aspect of the present invention is implemented.
[0010] The embodiments of the present invention include the following advantages:
[0011] Compared with the prior art, the present invention uses the YOLO algorithm to analyze the video to be processed based on the timestamp of the real-time video and the fixed video size to construct video slices, and constructs a timeline-based video partition and video slice mapping model based on the timestamp and threshold of the video slice. The message middleware is used to obtain the video message to be processed, and the video slice data is parsed from the video message. According to the constructed mapping model, the parsed video slice data and the timestamp of the video partition are compared to determine the storage location, which can realize the rapid positioning of the video time point, can locate the characteristic event more quickly, and reduce the risk of video clip loss. The overall weight of each partition can be effectively balanced through the dynamic threshold to ensure the reasonable scheduling and use of storage resources.
[0012] In addition, the introduction of a video slice partition mapping model speeds up data storage and access. Based on short-term and fixed-size video slices, it is possible to quickly locate video time points, especially feature events, while reducing the risk of video clip loss. Dynamic thresholds can effectively balance the overall weight of each partition to ensure reasonable scheduling and use of storage resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 is a flowchart of an example of a partition-based video slice storage method of the present invention;
[0014] Figure 2 It is a schematic diagram of video slice partitioning in the partition-based video slice storage method of the present invention;
[0015] Figure 3 is a structural block diagram of a partition-based video slice storage device of the present invention;
[0016] Figure 4 is a schematic structural diagram of an electronic device embodiment according to the present invention;
[0017] Figure 5 It is a schematic diagram of the structure of a computer-readable medium embodiment according to the present invention. DETAILED DESCRIPTION
[0018] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0019] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0020] In view of the above problems, the present invention proposes a partition-based video slice storage method, which is based on the timestamp of real-time video and fixed video size, uses the YOLO algorithm to analyze the video to be processed to construct video slices, and constructs a timeline-based video partition and video slice mapping model based on the timestamp and threshold of the video slice. The message middleware is used to obtain the video message to be processed, and the video slice data is parsed from the video message. According to the constructed mapping model, the parsed video slice data and the timestamp of the video partition are compared to determine the storage location, which can realize the rapid positioning of the video time point, reduce the risk of loss of video clips, and locate the feature event more quickly. The overall weight of each partition can be effectively balanced through the dynamic threshold to ensure the reasonable scheduling and use of storage resources.
[0021] Example 1
[0022] Refer to the following Figure 1 , Figure 2 , the contents of the present invention will be described in detail.
[0023] Figure 1 It is a flowchart of an example of the partition-based video slice storage method of the present invention. Figure 2 It is a schematic diagram of video slice partitioning in the partition-based video slice storage method of the present invention.
[0024] like Figure 1As shown, in step S101, based on the timestamp of the real-time video and the fixed video size, the YOLO algorithm is used to analyze the video to be processed to construct video slices, and determine the weights corresponding to each video slice.
[0025] Specifically, the real-time video and the video to be processed are, for example, surveillance videos of indoor areas of a home, a home courtyard, and places inside a factory.
[0026] Analyze the video to be processed, such as Figure 2 As shown, the specific steps include:
[0027] Step S201: extract key frame images from the video to be processed.
[0028] Based on human shape data, animal appearance features, and object appearance features, one or more key frame images in the video to be processed are extracted, and the key frame images contain specified targets, and the specified targets include people (such as specific users, specifically children, the elderly, etc.), animals (such as cats, dogs, rabbits), or specific objects (such as school bags, books, desk lamps, etc.).
[0029] Step S202: Use the YOLO algorithm to establish a target detection model, input one or more key frame images of the video to be processed into the established target detection model, and output the designated targets and the time points corresponding to each designated target, where the designated targets are people, animals, or specific objects.
[0030] Specifically, the YOLO algorithm is used to establish a target detection model.
[0031] A training data set is established using one or more images (or a video with a designated target) labeled with a designated target and the position of each designated target relative to a predetermined point (e.g., the center or any vertex of a detection box) to train the target detection model. For example, whether at least one designated target is included is used to represent a classification label to identify whether the video to be processed contains a designated target.
[0032] The target detection model includes an input layer, a convolution layer, a pooling layer, and a classification layer.
[0033] A convolution operation is performed in the convolution layer of the target detection model. Specifically, the convolution operation uses a ReLU activation function to increase nonlinearity and uses batch normalization to reduce the deviation of the data distribution of the video or image (e.g., one or more key frame images) to be processed containing the specified target.
[0034] The pooling operation is performed in the pooling layer of the target detection model, and the pooling operation is used to reduce the size of the feature map containing the specified target to improve the detection efficiency and accuracy of the model. The present invention uses maximum pooling and average pooling.
[0035] P={f(i,j) / Σ(i,j)}
[0036] Where P is the pooled feature map containing the specified target, f(i,j) is the pixel value in the input feature map, and Σ(i,j) is the sum of all pixel values in the feature map (for example, the maximum pooling will take the local maximum value instead of the average value).
[0037] Optionally, optimize the established object detection model by reducing the classification loss and localization loss:
[0038] Preferably, a deconvolution operation is used to upsample the feature map containing the specified target to restore the original size and resolution of the specified target, and is expressed by the following expression:
[0039] X=W^T*P*S^(-1)+b
[0040] Among them, X represents the feature map containing the specified target output after the deconvolution operation; W is the weight matrix for the deconvolution operation; P is the feature map containing the specified target after pooling, S is the upsampling size, and b is the bias term.
[0041] By reducing classification loss and positioning loss and optimizing the established target detection model, the model prediction error can be effectively reduced.
[0042] When applying the trained target detection model, one or more key frames of the video to be processed (or a segment of the video to be processed at a specified time) are input, and the specified targets corresponding to the video to be processed and the time points corresponding to each specified target are output.
[0043] Next, when the designated targets corresponding to the video to be processed and the time points corresponding to the designated targets are output, newly added video slices are determined.
[0044] By using the target detection model built by the YOLO v8 algorithm, the key videos in the video to be processed are intelligently segmented. For example, when a specified target (such as a person, an animal, etc.) appears in a video frame, video slicing is performed, which can accurately segment the video to be processed.
[0045] Specifically, when the following designated target appears in the video to be processed, it is defined as a characteristic event in the video to be processed, the start time of the following designated target appearing in the video to be processed is defined as the starting point of the characteristic event, and the time when the following designated target disappears in the video to be processed, that is, the end time of the following designated target appearing in the video to be processed is defined as the end point of the characteristic event. The designated target includes a person (such as a specific user, specifically a child, an elderly person, etc.), an animal (such as a cat, a dog, a rabbit), or a specific object (such as a school bag, a book, a desk lamp, etc.).
[0046] In a specific implementation, the video to be processed within a specified time period, that is, multiple images to be processed, are input into the target detection model, and the specified targets corresponding to the video to be processed, and the start time and end time corresponding to each specified target are output.
[0047] Specifically, the starting point and the end point of the characteristic event are respectively used as the starting point and the end point of the newly added video partition.
[0048] It should be noted that the above is only described as an optional example and should not be understood as a limitation to the present invention.
[0049] Next, in step S102, based on the timestamps and thresholds of the video slices, a mapping model of the timeline-based video partitions and video slices is constructed.
[0050] Specifically, a fixed duration is set for slicing to form video slices, and the formed video slices are added to a video slice set.
[0051] According to the start time, the end time, and the dynamic threshold, the video partitions are constructed to form a set of video partitions, each of which includes a partition weight and a configured maximum time span.
[0052] For constructing video slices, the following symbols are defined:
[0053] Tmax: maximum duration of a slice (in seconds); T: duration of a slice (in seconds);
[0054] Rmax: the maximum size of a slice; R(t): the size of a video segment from the beginning of the video to time t seconds; R.weight: the weight of a video slice.
[0055] Find the time T in the video segment so that at time T, the size of the video segment does not exceed Rmax and is as close to Tmax as possible. Define such a video segment as a video slice.
[0056] The video slice is denoted as R(T), where T is denoted as T=max{t|t≤Tmax and R(t)≤Rmax}.
[0057] Based on the timestamps and thresholds of video slices, a mapping model of timeline-based video partitions and video slices is constructed.
[0058] Based on the start time and end time of the video clip, a mapping model of video partitions (sections) and video slices (raw) based on the timeline is constructed. Each video partition contains several video slices.
[0059] It should be noted that the mapping model can be regarded as a function, which maps a video slice set R to a video partition set S, while satisfying that the time span within each video partition does not exceed STmax. STmax represents the maximum time span allowed for the video partition, that is, the static threshold of the video partition, such as the maximum time span of the video partition is 1 hour.
[0060] Specifically, the set SR of video slices under the video partition Si satisfies the following expression:
[0061]
[0062] Among them, Rj represents the jth video slice, j is a positive integer, SR represents the set of video slices under the video partition Si, and i is a positive integer; Rj.start represents the start time of the jth video slice; Si.start represents the start time of the i-th video partition to which the jth video slice belongs; Rj.end represents the end time of the jth video slice; Si.end represents the end time of the i-th video partition to which the jth video slice belongs.
[0063] The video slice time span D(Si) satisfies the following expression:
[0064] D(Si)=max{Rj.end|Rj∈SR}-min{Rk.start|Rk∈SR)≤STmax
[0065] D(Si) represents the time span of the video partition, which is equal to the maximum end time of all video slices in the video partition minus the minimum start time of all video slices) Rj.end represents the end time of the jth video slice, Rj represents the jth video slice; SR represents the set of video slices under the video partition Si, i is a positive integer; Rk.start represents the start time of the kth video slice, Rk represents the kth video slice, STmax represents the maximum time span allowed for the video partition, that is, the static threshold of the video partition, such as the maximum time span of the partition is 1 hour.
[0066] According to the mapping model of video partition (section) and video slice (raw), the location of the newly added video partition, that is, the storage location, is determined.
[0067] When determining to add a new video partition, the weight mean of the current video partition is used as the dynamic threshold for partition division, and the weight mean function of the partition weight is used to determine the weight of the new video partition, where the new video partition S x The weight of is less than or equal to the mean weight of the current video partition:
[0068] S x (weight)≤Avg(weight)
[0069] Among them, S x (weight) indicates the newly added video partition S x The weight of the current video partition; Avg (weight) represents the average weight of the current video partition;
[0070] The average weight of all current video partitions:
[0071]
[0072] Among them, Avg(weight) represents the weight average of all current video partitions; S j (weight) is the weight function of the jth video partition, m represents the number of all video partitions in the current storage system, and j is a positive integer, specifically 1, 2, ..., m.
[0073] Further comprising: each video partition includes multiple video slices, and the weight of the current video partition is calculated using the following expression:
[0074]
[0075] Among them, S 当 Represents the weight of the current video partition; R i .weight represents the weight value of the i-th video slice in the current video partition, R i .factor represents the influence factor of the i-th video slice in the current video partition, n represents the number of video slices in the current video partition, and i is a positive integer, specifically 1, 2, ..., n.
[0076] By using the average weight of all current video partitions as the dynamic threshold for partition division, the overall weight of each partition can be effectively balanced to ensure reasonable scheduling and use of storage resources.
[0077] It should be noted that the above is only described as an optional example and should not be understood as a limitation to the present invention.
[0078] Next, in step S103, the message middleware is used to obtain the video message to be processed, and the video slice data is parsed from the video message.
[0079] Specifically, the message middleware is used to obtain the video message to be processed, and the video message type and the start and end time of the video slice are parsed from the video message.
[0080] For example, if the video to be processed is parsed as a home indoor video type, the video message to be processed corresponding to the video to be processed output by the target detection model is parsed, specifically including the designated target corresponding to the video to be processed, the start time and end time corresponding to each designated target. In addition, it is possible to determine whether the video message to be processed contains a characteristic event.
[0081] When the video message to be processed contains a characteristic event, the start and end time of the video slice is determined according to the characteristic event, or the start event and end time of the video slice containing the characteristic event are directly parsed.
[0082] Furthermore, based on the time points corresponding to the outputted designated targets and in accordance with the constraints of duration and video size, video slicing is performed to complete the newly added video slicing.
[0083] It should be noted that the above is only described as an optional example and should not be understood as a limitation to the present invention.
[0084] Next, in step S104, the parsed video slice data and the timestamp of the video partition are compared according to the constructed mapping model to determine the storage location.
[0085] Specifically, the storage system (for example, a video slice storage device including Example 2) includes a left partition and a right partition, wherein the start time of the video partition in the left partition is smaller than the start time of the newly added video slice, and the start time of the video partition in the right partition is larger than the start time of the newly added video slice.
[0086] According to the mapping model constructed in step S102, and according to the parsed video slice data and the timestamp of the video partition, a mapping judgment is performed to determine the location of the newly added video slice, the location to be stored (also referred to as the "storage location").
[0087] When the start time and end time of the newly added video slice are both greater than the end time of the left partition and there is no right partition, a newly added video partition is directly inserted, and a new video slice is directly inserted into the newly added video partition.
[0088] When the start time of the newly added video slice is between the start time and end time of the left partition, and the end time of the newly added video slice is greater than the end time of the left partition, the end time of the left partition is updated to the end time of the newly added video slice, that is, the newly added video slice is mapped to the left partition.
[0089] When the start time and end time of the newly added video slice are both between the start time and end time of the left partition, the newly added video slice is directly mapped to the left partition.
[0090] In the case where a right partition exists, when the start time and end time of the newly added video slice are both greater than the end time of the left partition, and there is a right partition, further determine whether the start time of the right partition is greater than the end time of the newly added video slice. When the start time of the right partition is greater than the end time of the newly added video slice, add a new video partition between the left partition and the right partition, and insert a new video slice into the newly added video partition.
[0091] When the start time of the right partition is between the start time and the end time of the newly added video slice, the start time of the right partition is updated to the start time of the newly added video slice, which is equivalent to mapping the newly added video slice to the right partition.
[0092] In an optional implementation, video partitions are performed according to feature events to determine newly added video partitions.
[0093] Specifically, the video to be processed within a specified time period, that is, multiple images to be processed, are input into the target detection model, and the specified targets corresponding to the video to be processed, and the start time and end time corresponding to each specified target are output.
[0094] When the following designated target appears in the video to be processed, it is defined as a characteristic event in the video to be processed, and the start time of the following designated target appearing in the video to be processed is defined as the starting point of the characteristic event, and the time when the following designated target disappears in the video to be processed, that is, the end time of the following designated target appearing in the video to be processed is defined as the end point of the characteristic event. The designated target includes a person (such as a specific user, specifically a child, an elderly person, etc.), an animal (such as a cat, a dog, a rabbit) or a specific object (such as a school bag, a book, a desk lamp, etc.), and the starting point and end point of the characteristic event are respectively used as the starting point and end point of the newly added video partition.
[0095] In a specific embodiment, based on whether the output designated target is a person, an animal or a specific object, it is determined whether a feature event is included, the video to be processed containing a feature event is divided into a video slice, and based on the mapping model constructed in step S102, a mapping judgment is performed to determine the location of the newly added video slice, the location to be stored.
[0096] In another specific embodiment, based on whether the output designated target is a person, an animal or a specific object, it is determined whether a feature event is included, the video to be processed containing two or more feature events is divided into a video slice, and based on the mapping model constructed in step S102, a mapping judgment is performed to determine the location of the newly added video slice, the location to be stored.
[0097] Then, storage is performed according to the determined storage location, which can achieve rapid positioning of video time points and faster positioning of feature events, while reducing the risk of video clip loss. The dynamic threshold can effectively balance the overall weight of each partition to ensure reasonable scheduling and use of storage resources.
[0098] It should be noted that the above is only described as an optional example and should not be understood as a limitation to the present invention.
[0099] In addition, the drawings are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the drawings do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0100] Compared with the prior art, the present invention uses the YOLO algorithm to analyze the video to be processed based on the timestamp and fixed video size of the real-time video to construct video slices, and constructs a timeline-based video partition and video slice mapping model based on the timestamp and threshold of the video slice. The message middleware is used to obtain the video message to be processed, and the video slice data is parsed from the video message. According to the constructed mapping model, the parsed video slice data and the timestamp of the video partition are compared to determine the storage location, which can realize the rapid positioning of the video time point and the faster positioning of the feature event, while reducing the risk of losing the video clip. The dynamic threshold can effectively balance the overall weight of each partition to ensure the reasonable scheduling and use of storage resources.
[0101] In addition, by introducing a video slice partition mapping model, data storage and access speed is accelerated. Based on short-time and fixed-size video slices, it is possible to quickly locate video time points, while reducing the risk of video clip loss and locating feature events more quickly. Dynamic thresholds can effectively balance the overall weight of each partition to ensure reasonable scheduling and use of storage resources.
[0102] Example 2
[0103] The following are embodiments of the apparatus of the present invention, which can be used to implement the embodiments of the method of the present invention. For details not disclosed in the embodiments of the apparatus of the present invention, please refer to the embodiments of the method of the present invention.
[0104] Figure 3 4 is a schematic structural diagram of an example of a partition-based video slice storage device according to the present invention.
[0105] Reference Figure 3 The second aspect of the present disclosure provides a partition-based video slice storage device 300, which adopts the partition-based video slice storage method described in the first aspect of the present invention.
[0106] The partition-based video slice storage device 300 includes: a first construction module 310 , a second construction module 320 , a parsing module 330 and a storage module 340 .
[0107] In a specific embodiment, the first construction module 310 uses the YOLO algorithm to analyze the video to be processed based on the timestamp of the real-time video and the fixed video size to construct video slices and determine the weights corresponding to each video slice. The second construction module 320 constructs a mapping model of video partitions and video slices based on the timeline based on the timestamp and threshold of the video slice. The parsing processing module 330 uses the message middleware to obtain the video message to be processed and parses the video slice data from the video message. The storage module 340 compares the parsed video slice data with the timestamp of the video partition according to the constructed mapping model to determine the storage location.
[0108] According to an optional implementation, key frame images in the video to be processed are extracted, a target detection model is established using the YOLO algorithm, one or more key frame images of the video to be processed are input into the established target detection model, and designated targets and time points corresponding to each designated target are output, where the designated targets are people or animals; when the designated targets corresponding to the video to be processed and the time points corresponding to each designated target are output, newly added video slices are determined.
[0109] According to an optional implementation, when determining a new video partition, the weight mean of the current video partition is used as the dynamic threshold for partition division, and the weight of the new video partition is determined using the partition weight mean function, wherein the new video partition S x The weight of is less than or equal to the mean weight of the current video partition:
[0110] S x (weight)≤Avg(weight)
[0111] Among them, S x (weight) indicates the newly added video partition S x The weight of the current video partition. Avg(weight) represents the average weight of the current video partition.
[0112] The average weight of all current video partitions:
[0113]
[0114] Among them, Avg(weight) represents the weight average of all current video partitions; S j (weight) is the weight function of the jth video partition, m represents the number of all video partitions in the current storage system, and j is a positive integer, specifically 1, 2, ..., m.
[0115] According to an optional implementation manner, each video partition includes multiple video slices, and the weight of the current video partition is calculated using the following expression:
[0116]
[0117] Among them, S 当 Represents the weight of the current video partition; R i .weight represents the weight value of the i-th video slice in the current video partition, R i .factor represents the influence factor of the i-th video slice in the current video partition, n represents the number of video slices in the current video partition, and i is a positive integer, specifically 1, 2, ..., n.
[0118] According to the constructed mapping model, the parsed video slice data and the timestamps of the video partitions are compared.
[0119] Specifically, the storage system includes a left partition and a right partition, the start time of the video partition in the left partition is smaller than the start time of the newly added video slice, and the start time of the video partition in the right partition is larger than the start time of the newly added video slice;
[0120] According to the mapping model, a mapping judgment is performed to determine the position of the newly added video slice, wherein when the start time and the end time of the newly added video slice are both greater than the end time of the left partition and there is no right partition, a newly added video partition is directly inserted, and a new video slice is directly inserted into the newly added video partition; when the start time of the newly added video slice is between the start time and the end time of the left partition and the end time of the newly added video slice is greater than the end time of the left partition, the end time of the left partition is updated to the end time of the newly added video slice, that is, the newly added video slice is mapped to the left partition; when the start time and the end time of the newly added video slice are both between the start time and the end time of the left partition, the newly added video slice is directly mapped to the left partition.
[0121] According to an optional implementation, when the start time and end time of the newly added video slice are both greater than the end time of the left partition, and there is a right partition, it is further determined whether the start time of the right partition is greater than the end time of the newly added video slice. When the start time of the right partition is greater than the end time of the newly added video slice, a new video partition is added between the left partition and the right partition, and a new video slice is inserted into the newly added video partition; when the start time of the right partition is between the start time and end time of the newly added video slice, the start time of the right partition is updated to the start time of the newly added video slice, which is equivalent to mapping the newly added video slice to the right partition.
[0122] According to an optional implementation, video partitions are performed according to characteristic events to determine newly added video partitions; wherein, the video to be processed within a specified time period, i.e., multiple images to be processed, are input into the target detection model, and the designated targets corresponding to the video to be processed, and the start time and end time corresponding to each designated target are output; when the following designated targets appear in the video to be processed, it is defined as the occurrence of a characteristic event in the video to be processed, the start time when the following designated targets appear in the video to be processed is defined as the starting point of the characteristic event, and the time when the following designated targets disappear in the video to be processed, i.e., the end time when the following designated targets appear in the video to be processed, is defined as the end point of the characteristic event: people, animals or specific objects.
[0123] According to an optional implementation manner, based on the time points corresponding to the outputted designated targets and according to the constraints of duration and video size, video slicing is performed to complete the addition of new video slices.
[0124] According to an optional implementation, the video slice storage method according to claim 1 is characterized in that the timeline-based video partition and video slice mapping model is constructed based on the timestamp and threshold of the video slice, including: slicing with a fixed duration to form a video slice, and adding the formed video slice to a video slice set; constructing video partitions according to the start time, end time, and dynamic threshold to form a video partition set, each video partition including a partition weight and a configured maximum time span
[0125] Figure 4 A schematic structural diagram of an electronic device according to an embodiment of the present invention.
[0126] like Figure 4 As shown, the electronic device is presented in the form of a general computing device. The processor may be one or more and work in coordination. The present invention does not exclude distributed processing, that is, the processor may be dispersed in different physical devices. The electronic device of the present invention is not limited to a single entity, but may also be the sum of multiple physical devices.
[0127] The memory stores a computer executable program, which is usually a machine-readable code. The computer-readable program can be executed by the processor to enable the electronic device to perform the method of the present invention, or at least part of the steps in the method.
[0128] The memory includes a volatile memory, such as a random access memory unit (RAM) and / or a cache memory unit, and may also be a non-volatile memory, such as a read-only memory unit (ROM).
[0129] Optionally, in this embodiment, the electronic device further includes an I / O interface, which is used for the electronic device to exchange data with an external device. The I / O interface can represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of a variety of bus structures.
[0130] It should be understood that Figure 4 The electronic device shown is only an example of the present invention, and the electronic device of the present invention may also include elements or components not shown in the above examples. For example, some electronic devices also include display units such as display screens, and some electronic devices also include human-computer interaction elements such as buttons, keyboards, etc. As long as the electronic device can execute the computer-readable program in the memory to implement the method of the present invention or at least part of the steps of the method, it can be considered as an electronic device covered by the present invention.
[0131] Through the above description of the implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by combining software with necessary hardware. Figure 5 As shown, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of commands to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the embodiment of the present invention.
[0132] The software product may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0133] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, device, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0134] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0135] The computer-readable medium carries one or more programs (eg, computer-executable programs). When the one or more programs are executed by a device, the computer-readable medium implements the method of the present disclosure.
[0136] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0137] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several commands to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present invention.
[0138] The exemplary embodiments of the present invention are specifically shown and described above. It should be understood that the present invention is not limited to the detailed structure, configuration or implementation method described herein; on the contrary, the present invention is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A partition-based video slice storage method, characterized in that: The video slice storage method comprises: Based on the timestamp and fixed video size of the real-time video, the YOLO algorithm is used to analyze the processed video to construct video slices and determine the weights corresponding to each video slice; Based on the timestamps and thresholds of the video slices, a mapping model of timeline-based video partitions and video slices is constructed; Use the message middleware to obtain the video message to be processed and parse the video slice data from the video message; According to the constructed mapping model, the parsed video slice data and the timestamp of the video partition are compared to determine the storage location.
2. The video slice storage method according to claim 1, characterized in that: The method uses the YOLO algorithm to analyze the video to be processed based on the timestamp of the real-time video and the fixed video size to construct video slices, and determines the weights corresponding to each video slice, including: Extract key frame images from the video to be processed. Use the YOLO algorithm to establish a target detection model, input one or more key frame images of the video to be processed into the established target detection model, and output the designated target and the time point corresponding to each designated target, wherein the designated target is a person or an animal; When the designated targets corresponding to the video to be processed and the time points corresponding to the designated targets are output, newly added video slices are determined.
3. The video slice storage method according to claim 2, characterized in that: Further including: When determining a new video partition, the weight mean of the current video partition is used as the dynamic threshold for partition division, and the weight mean function of the partition weight is used to determine the weight of the new video partition, where the new video partition s x The weight of is less than or equal to the mean weight of the current video partition: S x (weight)≤Avg(weight) Among them, S x (weight) indicates the newly added video partition S x The weight of the current video partition; Avg (weight) represents the average weight of the current video partition; The average weight of all current video partitions: Among them, Avg(weight) represents the weight average of all current video partitions; S j (weight) is the weight function of the jth video partition, m represents the number of all video partitions in the current storage system, and j is a positive integer, specifically 1, 2, ..., m.
4. The video slice storage method according to claim 3, characterized in that: Further including: Each video partition includes multiple video slices. The following expression is used to calculate the weight of the current video partition: Among them, S 当 Indicates the weight of the current video partition; R i .weight represents the weight value of the i-th video slice in the current video partition, R i .factor represents the influence factor of the i-th video slice in the current video partition, n represents the number of video slices in the current video partition, and i is a positive integer, specifically 1, 2, ..., n.
5. The video slice storage method according to claim 1, characterized in that: According to the constructed mapping model, the parsed video slice data is compared with the timestamp of the video partition The storage system includes a left partition and a right partition, wherein the start time of the video partition in the left partition is smaller than the start time of the newly added video slice, and the start time of the video partition in the right partition is larger than the start time of the newly added video slice; According to the mapping model, a mapping judgment is performed to determine the location of the newly added video slice, where: When the start time and end time of the newly added video slice are both greater than the end time of the left partition and there is no right partition, directly insert a new video partition and directly insert a new video slice into the new video partition; When the start time of the newly added video slice is between the start time and the end time of the left partition, and the end time of the newly added video slice is greater than the end time of the left partition, the end time of the left partition is updated to the end time of the newly added video slice, that is, the newly added video slice is mapped to the left partition; When the start time and end time of the newly added video slice are both between the start time and end time of the left partition, the newly added video slice is directly mapped to the left partition.
6. The video slice storage method according to claim 5, characterized in that: Further including: When the start time and end time of the newly added video slice are both greater than the end time of the left partition, and there is a right partition, further determine whether the start time of the right partition is greater than the end time of the newly added video slice. When the start time of the right partition is greater than the end time of the newly added video slice, add a new video partition between the left partition and the right partition, and insert a new video slice into the newly added video partition; When the start time of the right partition is between the start time and the end time of the newly added video slice, the start time of the right partition is updated to the start time of the newly added video slice, which is equivalent to mapping the newly added video slice to the right partition.
7. The video slice storage method according to claim 2, characterized in that: Further including: Perform video partitioning according to feature events to determine newly added video partitions; Input the video to be processed within a specified time period, that is, multiple images to be processed, into the target detection model, and output the specified target corresponding to the video to be processed, and the start time and end time corresponding to each specified target; When the following specified targets appear in the video to be processed, it is defined as a characteristic event occurring in the video to be processed. The start time of the following specified targets appearing in the video to be processed is defined as the starting point of the characteristic event, and the time when the following specified targets disappear in the video to be processed, that is, the end time of the following specified targets appearing in the video to be processed, is defined as the end point of the characteristic event: people, animals or specific objects.
8. The video slice storage method according to claim 2, characterized in that: include: Based on the time points corresponding to the outputted designated targets and in accordance with the constraints of duration and video size, video slicing is performed to complete the newly added video slicing.
9. The video slice storage method according to claim 1, characterized in that: The method of constructing a timeline-based video partition and video slice mapping model based on the timestamp and threshold of the video slice includes: Slicing with a fixed duration to form video slices, and adding the formed video slices to a video slice set; According to the start time, the end time, and the dynamic threshold, the video partitions are constructed to form a set of video partitions, each of which includes a partition weight and a configured maximum time span.
10. A partition-based video slice storage device, characterized in that: The method for storing video slices according to any one of claims 1 to 9 is implemented, and the video slice storage device comprises: The first building module uses the YOLO algorithm to analyze the processed video based on the timestamp of the real-time video and the fixed video size to construct video slices, and determines the weight corresponding to each video slice; The second construction module constructs a mapping model of timeline-based video partitions and video slices based on the timestamps and thresholds of the video slices; The parsing and processing module uses the message middleware to obtain the video message to be processed and parses the video slice data from the video message; The storage module compares the parsed video slice data with the timestamp of the video partition according to the constructed mapping model to determine the storage location.
Citation Information
Patent Citations
Surveillance video slice storage method and surveillance video slice storage system
CN109361904A
Method and device for storing, retrieving and deleting embedded audio and video data, and memory
CN112558873A
Three-dimensional panoramic video asymmetric transport stream adaptive method and system
CN113905221A
Subsumption Architecture for Processing Fragments of a Video Stream
US20180255329A1
Cited By
Video enhancement processing method and system
CN121173985A