Target detection method, system and device based on video frame synchronous reading
By using a combination of video frame synchronization reading and deep learning models in the industrial monitoring system, the problem that the single-camera monitoring method cannot fully monitor the industrial production line and identify occlusions is solved, and more efficient monitoring anomaly identification and real-time monitoring are achieved.
Patent Information
- Application Number
- PCT/CN2024/086345
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-10-23
- Filing Date
- 2024-04-07
- Publication Date
- 2024-10-03
AI Technical Summary
The traditional single-camera monitoring method is difficult to fully monitor the details of each process of the production line during the industrial production process, and temporary obstructions by equipment or personnel cannot be identified in time, affecting the quality of monitoring.
Using a target detection method based on synchronized reading of video frames, time stamp synchronization between camera devices is achieved through the NTP client and server. The reading thread reads the original data of the video frame, and the FFmpeg encoding thread performs low-latency encoding to form Synchronize time-stamped video sequences and leverage deep learning models for object detection.
It improves the accuracy of monitoring anomaly identification, ensures the time stamp consistency of video frames between camera devices, and enhances the ability to monitor industrial production processes in real time.
Smart Images

Figure CN2024086345_03102024_PF_FP_ABST
Abstract
Description
A method, system and device for target detection based on synchronous reading of video frames Technical Field
[0001] The present invention relates to the technical field of data extraction for target detection, and in particular to a target detection method, system and device based on synchronous reading of video frames. Background Art
[0002] With the continuous advancement of industrial automation, video surveillance technology and intelligent algorithm detection have been widely applied in various aspects of industrial production, such as production line quality inspection and operational process monitoring. Furthermore, industrial environments place high demands on the real-time and accuracy of video surveillance technology and intelligent algorithms. However, complex production environments and conditions increase the difficulty of achieving these goals. Traditional single-camera monitoring methods for industrial production process monitoring lack the ability to fully capture details of every step of the production line due to the limited information captured from a single perspective. This makes it difficult to fully detect key issues. Furthermore, temporary obstructions by equipment or personnel from a single perspective cannot be detected in a timely manner, affecting monitoring quality.
[0003] Summary of the Invention
[0004] The purpose of the present invention is to provide a target detection method, system and device based on synchronous reading of video frames, which can improve the accuracy of monitoring anomaly recognition.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] A target detection method based on synchronous reading of video frames is applied to a monitoring system, wherein the monitoring system comprises: an NTP server and multiple camera devices; the NTP server and the multiple camera devices are all arranged in the same local area network; each of the camera devices is configured with an NTP client, a reading thread, and an FFmpeg encoding thread;
[0007] The NTP client is used to generate a timestamp when the corresponding camera device generates a video frame;
[0008] The NTP server is used to synchronize timestamps generated by multiple NTP clients at the same time;
[0009] The reading thread is used to read the raw video raw code stream data of multiple video frames generated by the corresponding camera device and the timestamp corresponding to each video frame;
[0010] The FFmpeg encoding thread is used to encode the original video raw code stream data of each video frame and its corresponding timestamp in chronological order to obtain multiple frames of video frames with timestamps, forming a low-latency cache queue corresponding to the camera device;
[0011] The target detection method comprises:
[0012] Determine a synchronized time-stamped video sequence according to a plurality of low-latency cache queues; wherein a time stamp difference between any two time-stamped video frames in the synchronized time-stamped video sequence is less than a time stamp difference threshold;
[0013] The synchronized time-stamped video sequence is input into a target detection model to obtain a target detection result corresponding to the center time stamp; the target detection model is obtained by training a deep learning model using multiple annotated synchronized time-stamped video historical sequences.
[0014] Optionally, determining a synchronized timestamp video sequence based on multiple low-latency cache queues includes:
[0015] Extract one frame of time-stamped video from each low-latency cache queue in the order of the corresponding camera device numbers to obtain a pending sequence of synchronized time-stamped videos;
[0016] Determine whether there are two frames of video frames with timestamps in the pending sequence of synchronized videos with timestamps, and the timestamp difference between the frames is greater than the timestamp difference threshold, to obtain a first determination result;
[0017] If the first judgment result is yes, then update multiple low-latency cache queues and return to the step of "extracting a frame of time-stamped video from each low-latency cache queue in the order of the corresponding camera devices to obtain a synchronized time-stamped video pending sequence";
[0018] If the first judgment result is no, it is determined that the pending sequence of synchronized video with time stamps is a synchronized video sequence with time stamps.
[0019] Optionally, updating multiple low-latency cache queues includes:
[0020] Determine the mean of the timestamps corresponding to the pending sequence of synchronized videos containing timestamps;
[0021] Determine that two video frames containing timestamps whose timestamp difference is greater than a timestamp difference threshold are pending video frames;
[0022] Determine the pending video frame with the largest difference between the corresponding timestamp and the timestamp mean as the reference video frame;
[0023] Determine whether the timestamp corresponding to the reference video frame is earlier than the timestamp mean, and obtain a second determination result;
[0024] If the second judgment result is yes, deleting the reference video frame from the low-latency cache queue corresponding to the reference video frame;
[0025] If the second judgment result is no, determining that the time-stamped video frames other than the reference video frames in the pending sequence of synchronized time-stamped videos are non-reference video frames;
[0026] The corresponding non-reference video frame is deleted from the low-latency cache queue corresponding to each non-reference video frame.
[0027] Optionally, before determining the synchronization of the time-stamped video sequence according to the multiple low-latency cache queues, the method further includes:
[0028] Get multiple low-latency cache history queues
[0029] Determine the synchronized timestamp video history sequence based on multiple low-latency cache history queues;
[0030] Marking the targets in the synchronized time-stamped video history sequence respectively to obtain the marked synchronized time-stamped video history sequence;
[0031] The deep learning model is trained with the annotated synchronized time-stamped video history sequence as input and the target annotation result as output to obtain the target detection model.
[0032] A target detection system based on synchronous reading of video frames, comprising:
[0033] A synchronous time-stamped video sequence acquisition module is used to determine a synchronous time-stamped video sequence based on multiple low-latency cache queues; the time stamp difference between any two time-stamped video frames in the synchronous time-stamped video sequence is less than a time stamp difference threshold;
[0034] The target detection module is used to input the synchronized time-stamped video sequence into the target detection model to obtain the target detection result corresponding to the center timestamp; the target detection model is obtained by training a deep learning model using multiple annotated synchronized time-stamped video historical sequences.
[0035] An electronic device includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform a target detection method based on synchronous reading of video frames.
[0036] Optionally, the memory is a readable storage medium.
[0037] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0038] The present invention provides a target detection method, system, and device based on synchronized video frame reading. These methods, applied to a surveillance system, determine a synchronized timestamped video sequence based on multiple low-latency cache queues; the timestamp difference between any two frames in the synchronized timestamped video sequence is less than a timestamp difference threshold; the synchronized timestamped video sequence is input into a target detection model to obtain a target detection result corresponding to the central timestamp. By configuring each camera device with an NTP client, a reading thread, and an FFmpeg encoding thread to obtain the synchronized timestamped video sequence, and then training the target detection model, the present invention can improve the accuracy of surveillance anomaly recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] FIG1 is a flow chart of a target detection method based on synchronous reading of video frames in Example 1 of the present invention;
[0041] FIG2 is a schematic diagram of a target detection method based on synchronous reading of video frames in Example 1 of the present invention;
[0042] FIG3 is a schematic diagram of the NTP architecture of the target detection method in Example 1 of the present invention;
[0043] FIG4 is a flow chart of video frame acquisition in Example 1 of the present invention;
[0044] FIG5 is a flow chart of video frame encoding in Example 1 of the present invention;
[0045] FIG6 is a flow chart of video frame synchronization in Example 1 of the present invention;
[0046] FIG7 is a flowchart of video frame synchronization inference in Example 1 of the present invention
[0047] FIG8 is a schematic structural diagram of a terminal device in Example 1 of the present invention. DETAILED DESCRIPTION
[0048] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments 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.
[0049] The purpose of the present invention is to provide a target detection method, system and device based on synchronous reading of video frames, which can improve the accuracy of monitoring anomaly recognition.
[0050] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0051] Example 1
[0052] This embodiment provides a target detection method based on synchronous reading of video frames. The target detection method is applied to a monitoring system, which includes: an NTP server and multiple camera devices. The NTP server and the multiple camera devices are all set in the same local area network. Any camera device is configured with an NTP client, a reading thread and an FFmpeg encoding thread. The NTP client is used to generate a timestamp when the corresponding camera device generates a video frame. The NTP server is used to synchronize the timestamps generated by multiple NTP clients at the same time. The reading thread is used to read the original video raw code stream data of multiple video frames generated by the corresponding camera device and the timestamp corresponding to each video frame. The FFmpeg encoding thread is used to encode the original video raw code stream data and its corresponding timestamp of each video frame in chronological order to obtain multiple frames of video frames containing timestamps, forming a low-latency cache queue for the corresponding camera device.
[0053] As shown in Figures 1 and 2, the target detection method includes:
[0054] Step 101: Determine a synchronized time-stamped video sequence based on a plurality of low-latency buffer queues, wherein a time stamp difference between any two time-stamped video frames in the synchronized time-stamped video sequence is less than a time stamp difference threshold.
[0055] Step 102: Input the synchronized time-stamped video sequence into the object detection model to obtain the object detection result corresponding to the center time stamp. The object detection model is obtained by training a deep learning model using multiple annotated synchronized time-stamped video history sequences.
[0056] Step 101 includes:
[0057] Step 101 - 1 : extract one frame of time-stamped video from each low-latency cache queue in sequence according to the numbering order of the corresponding camera devices, and obtain a pending sequence of synchronized time-stamped videos.
[0058] Step 101-2: Determine whether there are two frames of time-stamped video in the pending sequence of synchronized time-stamped video frames whose time stamp difference is greater than a time stamp difference threshold, and obtain a first determination result. If the first determination result is yes, execute step 101-3; if the first determination result is no, execute step 101-4.
[0059] Step 101 - 3 : Update multiple low-latency cache queues and return to step 101 - 1 .
[0060] Step 101 - 4 : Determine that the pending sequence of synchronized video with time stamps is a synchronized video sequence with time stamps.
[0061] Step 101-3 includes:
[0062] Step 101-3-1: Determine the average value of the timestamps corresponding to the pending sequence of synchronized videos containing timestamps.
[0063] Step 101-3-2: Determine that two video frames containing timestamps whose timestamp difference is greater than a timestamp difference threshold are pending video frames.
[0064] Step 101-3-3: Determine the pending video frame with the largest difference between the corresponding timestamp and the timestamp mean as the reference video frame.
[0065] Step 101-3-4: Determine whether the timestamp corresponding to the reference video frame is earlier than the timestamp mean, and obtain a second determination result. If the second determination result is yes, execute step 101-3-5; if the second determination result is no, execute step 101-3-6.
[0066] Step 101-3-5: Delete the reference video frame from the low-latency cache queue corresponding to the reference video frame.
[0067] Step 101-3-6: Determine that the time-stamped video frames other than the reference video frames in the pending sequence of synchronized time-stamped videos are non-reference video frames.
[0068] Step 101-3-7: Delete the corresponding non-reference video frame from the low-latency cache queue corresponding to each non-reference video frame.
[0069] Before step 101, the method further includes:
[0070] Step 103: Acquire multiple low-latency cache history queues.
[0071] Step 104: Determine a synchronized timestamp-containing video history sequence based on multiple low-latency cache history queues.
[0072] Step 105: Mark the objects in the synchronized video history sequence with time stamps respectively to obtain a marked synchronized video history sequence with time stamps.
[0073] Step 106: Using the annotated synchronized time-stamped video history sequence as input and the target annotation result as output, the deep learning model is trained to obtain a target detection model.
[0074] Specifically, the present invention provides a target detection method based on synchronous reading of video frames, comprising the steps of:
[0075] S1: NTP calibration module: Build a local LAN NTP server as the time center of the LAN, configure an NTP client for each camera device in the LAN, and achieve NTP precise time synchronization. This step is implemented by the NTP calibration module.
[0076] S2: Configure an independent reading thread for each camera to directly read the uncompressed low-latency raw video raw stream data and native millisecond timestamps from the camera. This step is implemented by the video data acquisition module.
[0077] S3: Start multiple FFmpeg encoding threads, accelerate them through hardware encoding, perform H.264 high-efficiency low-latency encoding on each raw stream, output video frames with timestamps, and send them to the low-latency cache queue. This step is implemented by the video frame encoding module.
[0078] S4: In the main thread, video frames are periodically retrieved from the buffer queues of each encoding thread, accurately time-aligned based on the timestamp information within the frames, and then output. Synchronized video frames with timestamps within the deviation range are output. This step is implemented by the video frame synchronization module.
[0079] S5: Group the single synchronized video frames into a sample batch, which is sequentially passed into deep learning models such as target detection and recognition models for parallel reasoning to obtain synchronized detection results. This step is implemented by the video frame synchronization inference module.
[0080] Step S1 specifically includes:
[0081] On a local area network (LAN), you first need to select a powerful computer to serve as a Network Time Protocol (NTP) server. This server will act as a time source, providing accurate time information. Installing and configuring the NTP server software enables the server to provide time synchronization services to other devices.
[0082] Next, configure the cameras that require time synchronization. Configure an NTP client in each camera's operating system. This allows the camera to establish a connection with an NTP server and perform regular time synchronization and calibration. This allows the camera to obtain accurate time information from the NTP server and update and calibrate its own system time.
[0083] Through NTP time synchronization, all cameras within the local area network can maintain millisecond-level synchronization with the NTP server's clock. This means that the camera's system time is highly consistent with the NTP server's clock, synchronized with millisecond-level accuracy. This precise time synchronization ensures consistent time stamps when recording and processing video data, providing an accurate time reference for subsequent data analysis and processing.
[0084] NTP (Network Time Protocol) is a protocol specifically designed for time synchronization in computer networks. Its goal is to coordinate the clocks of various device nodes in the network to ensure they have the same time reference and provide high-precision time calibration, with millisecond accuracy or better.
[0085] As shown in Figure 3, a 24-hour non-stop computer device is set up in the local area network as the NTP server. At the same time, relevant cameras are connected to the current local area network and configured with the NTP client. This can ensure that accurate time reference is provided to all camera devices connected to the NTP server.
[0086] Step S2 specifically includes:
[0087] To avoid the additional encoding and decoding delay introduced by the video compression algorithm and obtain uncompressed, high-quality, low-latency raw raw stream data and millisecond-level timestamps, a separate thread is created for each camera that needs to read video frames.
[0088] Each thread is responsible for reading the raw raw stream data from the corresponding camera and using the NTP service to obtain accurate millisecond timestamps. This avoids additional encoding and decoding delays, resulting in high-quality, extremely low-latency video data for subsequent use.
[0089] A raw video stream is raw video data that has been captured or obtained without compression or encoding. It retains the complete information of the video signal, including the exact value and color of each pixel, as well as the timestamp information associated with the video frame.
[0090] A timestamp is a numerical value that precisely records the time at which an event occurred. In video processing, timestamps are used to mark the exact moment a video frame was captured. For each video frame, the timestamp indicates the exact time the frame was captured or acquired. Timestamps are typically expressed in specific time units (such as milliseconds) to indicate the amount of time that has elapsed since a reference point, such as the start of video playback or system startup.
[0091] As shown in Figure 4, each camera that needs to acquire a video frame is read by a separate thread, enabling parallel processing and reading operations without interfering with each other. Furthermore, by leveraging the accurate timestamps provided by the NTP service, the video data is ensured to have high-quality millisecond-level timestamps, which facilitates subsequent video processing and analysis.
[0092] Step S3 specifically includes:
[0093] To perform H.264 encoding on each acquired raw stream, a separate FFmpeg thread is used to encode each video stream. By utilizing applicable hardware encoding acceleration technologies, the efficiency and performance of the encoding process can be improved. Once the video frame is encoded, the encoded video frame and its corresponding timestamp are stored in a buffer queue.
[0094] FFmpeg is a cross-platform, open-source multimedia processing toolkit that covers a wide range of audio and video processing tools and libraries. FFmpeg is capable of processing a variety of audio and video formats and provides a rich set of functions and libraries for performing various multimedia processing tasks, including decoding, encoding, transcoding, editing, merging, and streaming.
[0095] H.264 is a universal and widely used video compression standard and encoding format. It is designed to achieve high-quality video transmission and storage by efficiently compressing video data and reducing bit rate requirements.
[0096] Hardware encoding is the process of compressing and encoding video using a specialized hardware encoder. A hardware encoder is a dedicated hardware device with highly optimized encoding algorithms and circuit design that enables fast and efficient video encoding.
[0097] A hardware encoder is an embedded hardware module, usually integrated into a CPU, GPU, or dedicated encoder chip. It has highly optimized algorithms and parallel processing capabilities, and can complete video encoding in a more efficient manner. It aims to provide fast and efficient video encoding functions.
[0098] As shown in Figure 5, a dedicated FFmpeg thread is set up for each video stream to handle H.264 encoding. By using independent threads, multiple video streams can be processed in parallel, thereby improving overall encoding efficiency.
[0099] During the encoding process, appropriate hardware encoding acceleration technologies can be used to improve performance. These technologies utilize specialized hardware (such as GPUs) to accelerate encoding algorithms, thereby reducing encoding time and resource consumption. By fully utilizing hardware resources, a more efficient encoding process can be achieved.
[0100] Once a video frame is encoded, it and its corresponding timestamp are stored in a buffer queue. This buffer queue is used to store pending video frames for subsequent processing or transmission. The buffer queue allows for efficient management of encoded video data and ensures that the correspondence between timestamps and video frames is not lost or confused.
[0101] Step S4 specifically includes:
[0102] In the main thread, encoded video frames from multiple cameras and their corresponding timestamps are sequentially retrieved from the cache queue. Next, these timestamps are compared and the absolute value of the time difference between them is calculated to obtain a time offset. By setting an appropriate time offset range, it is possible to determine whether the time offset value is within the specified range and, based on this, determine whether the current video frame is synchronized, i.e., has a consistent time stamp.
[0103] The timestamp deviation range is a time value in milliseconds used to determine the synchronization of video frames. Specifically, if the time difference calculated from the timestamps of multiple video frames is less than or equal to the set timestamp deviation range, it can be determined that the video frames are synchronized.
[0104] As shown in Figure 6, the main thread extracts video frames and corresponding timestamps from the cache queue one by one in the order of video frames. The timestamp records the capture or encoding time of the video frame. By comparing these timestamps, the absolute value of the time difference between video frames, that is, the time deviation, can be calculated. The time deviation value reflects the time relationship between video frames.
[0105] To determine whether video frames are synchronized, a millisecond-level time deviation range needs to be set. Within this range, if the time deviation value falls within the set range, it can be considered that the current video frame has a consistent time stamp, that is, it is synchronized with other video frames. This time synchronization judgment can help ensure that video frames from multiple cameras remain consistent during playback or processing, thereby determining whether they are synchronized video frames.
[0106] Step S5 specifically includes:
[0107] After the time-aligned synchronization operation, the video frames in the same batch are combined into a sample batch. This sample batch can contain video frames from multiple cameras that capture the scene at the same time.
[0108] This sample batch can be passed to a deep learning model, such as one for object detection, for parallel inference. The deep learning model simultaneously processes each video frame in the sample batch to identify and detect objects within it. Because these video frames are captured at the same time and time-aligned, the deep learning model can perform parallel inference on them. This allows for simultaneous object recognition results from multiple camera video frames.
[0109] As shown in Figure 7, the time-aligned, synchronized video frames form a sample batch and are fed into deep learning models such as object detection for parallel inference. By processing these video frames simultaneously, the model can obtain object recognition results based on video frames from multiple cameras at the same moment. Because these video frames are captured at the same time, the model can effectively share information and understand context between them, improving model efficiency and performance, reducing inference time, and enabling more accurate object detection through time-aligned models.
[0110] This invention implements time synchronization and calibration services for each camera in a local area network by establishing a local NTP server. A video data acquisition module acquires the raw bitstream and millisecond-level timestamps by setting up an independent thread for each camera. A video frame encoding module efficiently encodes the raw bitstream data using video encoding tools. A video frame synchronization module synchronizes the encoded video frames at the millisecond level. A video frame synchronization inference module batches the synchronized video frames and feeds them into a deep learning model for parallel inference and detection. This enables more efficient and accurate video content understanding and detection, effectively improving the accuracy and reliability of video-based visual reasoning tasks.
[0111] Example 2
[0112] In order to execute the method corresponding to the above embodiment 1 and achieve the corresponding functions and technical effects, the following provides an object detection system based on synchronous reading of video frames, including:
[0113] The synchronous time-stamped video sequence acquisition module is configured to determine a synchronous time-stamped video sequence based on a plurality of low-latency buffer queues, wherein a time stamp difference between any two time-stamped video frames in the synchronous time-stamped video sequence is less than a time stamp difference threshold.
[0114] The object detection module is used to input synchronized time-stamped video sequences into the object detection model to obtain the object detection results corresponding to the center timestamp. The object detection model is obtained by training a deep learning model using multiple annotated synchronized time-stamped video historical sequences.
[0115] Example 3
[0116] This embodiment provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform a target detection method based on synchronous reading of video frames as described in Example 1. The memory is a readable storage medium. As shown in Figure 8, the terminal device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and runnable on the processor, such as a real-time video synchronous reading program and a synchronous reasoning detection program. When the processor executes the computer program, it implements the steps in the above-mentioned embodiments of the real-time video synchronous reading and synchronous reasoning detection methods, such as steps S1 to S5 shown in Figure 1. Or when the processor executes the computer program, it implements the functions of each module in the above-mentioned device embodiments.
[0117] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing functions, which describe the execution process of the computer program in the terminal device. For example, the computer program may be divided into various modules, and the specific functions of each module are not described in detail here.
[0118] The terminal device may be a computing device such as a desktop computer, laptop, PDA, or cloud server. The terminal device may include, but is not limited to, a processor and memory. Those skilled in the art will appreciate that the schematic diagram is merely an example of a terminal device and does not limit the terminal device. The terminal device may include more or fewer components than shown, or a combination of certain components, or different components. For example, the terminal device may also include input / output devices, network access devices, buses, etc.
[0119] The processor may be a central processing unit (CPU), or other general-purpose processors, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting various parts of the entire terminal device using various interfaces and lines.
[0120] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the computer (such as audio and video data, files, etc.). In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a flash memory card, at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0121] Wherein, if the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0122] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0123] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only intended to help understand the method and core concept of the present invention. At the same time, those skilled in the art will find that the specific implementation methods and application scopes may vary based on the concept of the present invention. In summary, the contents of this specification should not be construed as limiting the present invention.
Claims
1. A target detection method based on synchronous reading of video frames, characterized in that: The target detection method is applied to a monitoring system, which includes: an NTP server and multiple camera devices; the NTP server and the multiple camera devices are all arranged in the same local area network; any of the camera devices is configured with an NTP client, a reading thread and an FFmpeg encoding thread; The NTP client is used to generate a timestamp when the corresponding camera device generates a video frame; The NTP server is used to synchronize timestamps generated by multiple NTP clients at the same time; The reading thread is used to read the raw video raw code stream data of multiple video frames generated by the corresponding camera device and the timestamp corresponding to each video frame; The FFmpeg encoding thread is used to encode the original video raw code stream data of each video frame and its corresponding timestamp in chronological order to obtain multiple frames of video frames with timestamps, forming a low-latency cache queue corresponding to the camera device; The target detection method comprises: Determine a synchronized time-stamped video sequence according to a plurality of low-latency cache queues; wherein a time stamp difference between any two time-stamped video frames in the synchronized time-stamped video sequence is less than a time stamp difference threshold; The synchronized video sequence with timestamp is input into the target detection model to obtain the target detection result corresponding to the central timestamp; the target detection model is obtained by training a deep learning model using multiple annotated synchronized video historical sequences with timestamps.
2. The target detection method based on video frame synchronous reading according to claim 1, characterized in that: Determining the synchronization of the time-stamped video sequence according to the multiple low-latency cache queues includes: Extract one frame of time-stamped video from each low-latency cache queue in sequence according to the serial number of the corresponding camera device, and obtain a pending sequence of synchronized time-stamped videos; Determine whether there are two frames of time stamped video frames in the pending sequence of synchronized time stamped video, and the time stamp difference corresponding to the frames is greater than the time stamp difference threshold, and obtain a first determination result; If the first judgment result is yes, then multiple low-latency cache queues are updated, and the process returns to step "selecting the corresponding camera devices from each low-latency cache queue in the order of their numbers". Extract one frame of video with timestamp respectively to obtain a pending sequence of synchronized video with timestamp; If the first judgment result is no, it is determined that the pending sequence of synchronized videos containing time stamps is a synchronized video sequence containing time stamps.
3. The target detection method based on video frame synchronous reading according to claim 2, characterized in that: The updating of multiple low-latency cache queues includes: Determine the mean value of the timestamps corresponding to the pending sequence of synchronized videos containing timestamps; Determine that two video frames containing timestamps whose timestamp difference is greater than a timestamp difference threshold are pending video frames; Determine the pending video frame with the largest difference between the corresponding timestamp and the timestamp mean as the reference video frame; Determine whether the timestamp corresponding to the reference video frame is earlier than the timestamp mean, and obtain a second determination result; If the second judgment result is yes, deleting the reference video frame from the low-latency cache queue corresponding to the reference video frame; If the second judgment result is no, determining that the time-stamped video frames other than the reference video frames in the pending sequence of synchronized time-stamped videos are non-reference video frames; The corresponding non-reference video frame is deleted from the low-latency cache queue corresponding to each non-reference video frame.
4. The target detection method based on video frame synchronous reading according to claim 1, characterized in that: Before determining the synchronization of the time-stamped video sequence according to the multiple low-latency cache queues, the method further includes: Get multiple low-latency cache history queues Determine the synchronized timestamped video history sequence based on multiple low-latency cache history queues; Marking the targets in the synchronized time-stamped video history sequence respectively to obtain a marked synchronized time-stamped video history sequence; The deep learning model is trained with the annotated synchronized time-stamped video history sequence as input and the target annotation result as output to obtain the target detection model.
5. A target detection system based on synchronous reading of video frames, characterized in that: include: A synchronous video sequence acquisition module containing a timestamp is used to determine a synchronous video sequence containing a timestamp according to a plurality of low-latency cache queues; any two frames in the synchronous video sequence containing a timestamp The timestamp differences corresponding to the timestamp video frames are all less than the timestamp difference threshold; A target detection module, used for inputting the synchronized time-stamped video sequence into a target detection model to obtain a target detection result corresponding to a central time stamp; The target detection model is obtained by training a deep learning model using a plurality of annotated synchronized time-stamped video history sequences.
6. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute a target detection method based on synchronous reading of video frames as described in any one of claims 1 to 4.
7. An electronic device according to claim 6, characterized in that: The memory is a readable storage medium.
Citation Information
Patent Citations
Multi-camera frame synchronization method
CN110290287A
Data synchronization method, system and related equipment
CN114844585A
Processing method and electronic equipment
CN116366991A
Image synchronization method and apparatus, and device and computer storage medium
US20230082766A1
Image processing method and device
WO2022141477A1
Cited By
Microsecond-level time sequence data intelligent pushing method, device and equipment
CN119254251A
Image conversion and stream pushing method and device for enhancing real-time performance
CN119893191A
Historical information-based variable gravity particle experiment process real-time detection method
CN119963931A
Multi-camera synchronization method, device and equipment and computer readable storage medium
CN120455610A
Multi-source heterogeneous bus data parallel acquisition and recording method and system
CN120561187A
