Message queue-based YOLO target detection result transmission system and method

By designing a YOLO target detection result transmission system based on message queue, the existing system's problems in real-time, reliability and scalability of data transmission are solved, and data transmission with low latency, high concurrency and high reliability are achieved.

CN120075204AInactive Publication Date: 2025-05-30THREE-BODY SMART NETWORK TECH (SUZHOU) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510512446.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-05-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing target detection systems have problems such as insufficient real-time performance, risk of data loss, high system coupling and lack of standardized YOLO result transmission solutions in data transmission.

Method used

A YOLO target detection result transmission system based on message queue is designed, including video data acquisition, preprocessing, YOLO model loading, object detection, tracking, task scheduling, data packet grouping and message transmission modules, and data transmission modules are used to transmit data using RabbitMQ asynchronous message queue, and a loosely coupled design and exception handling mechanism are adopted.

Benefits of technology

It realizes low latency, high reliability and high concurrency data transmission, avoids data loss, reduces system coupling, and adapts to high concurrency and real-time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075204A_ABST
    Figure CN120075204A_ABST
Patent Text Reader

Abstract

The invention discloses a message queue-based YOLO target detection result transmission system and method, and the method comprises the steps: starting a RabbitMQ server, building a connection, obtaining a detection task from a RabbitMQ task queue through a task scheduling module, carrying out the distribution of the detection task, continuously collecting video frames from a video source through a video data collection module and a video data preprocessing module, and carrying out the transmission of a target detection result. The target detection module calls a YOLO model to detect a video frame and extract target information, the target tracking module continuously tracks a detection result, the data packing module arranges the target information into a standardized message body, and the standardized message body is stored in a thread security queue; and the message transmission module sends the data to a server by adopting a RabbitMQ asynchronous message queue, and the exception handling and system recovery module sets an exception capture mechanism and a recovery measure for each link, so that the strict requirements of application scenes such as real-time video monitoring on data transmission can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer vision and intelligent transmission technology, and particularly to a YOLO object detection result transmission system and method based on a message queue. Background Art

[0002] Object Detection is one of the important tasks in computer vision, mainly used to identify objects in images or videos and determine their positions. Currently, deep learning-based methods have made significant progress in the field of object detection. In particular, the YOLO (You Only Look Once) series of algorithms are widely used in fields such as smart factories, smart cities, and drone detection due to their high efficiency and real-time characteristics.

[0003] Although YOLO has made breakthroughs in the field of object detection, the transmission and management of detection results still face the following problems: Insufficient real-time performance: The traditional HTTP transmission method requires continuous polling, increasing network latency and unable to meet the requirements of high real-time performance. Risk of data loss: Although the WebSocket solution can reduce latency, it does not support persistent storage. WebSocket may cause data loss during network fluctuations or server restarts, affecting the integrity of detection results. High system coupling degree: Directly using a database to store detection results will limit the scalability of the system, making it inapplicable to high-concurrency scenarios and affecting the expansion of subsequent business modules and system performance. Lack of a standardized YOLO result transmission scheme: Currently, there is no general method to efficiently transmit YOLO detection results to RabbitMQ and ensure data reliability.

[0004] Existing message queue applications mainly focus on text or log data transmission, and there are few processing solutions for computer vision data, making it difficult to directly apply to the YOLO object detection system.

[0005] It can be seen that there are still many deficiencies in the data transmission of existing object detection systems, and traditional HTTP / WebSocket solutions are difficult to meet the requirements of high concurrency, low latency, and data reliability. RabbitMQ, as a mature message queue technology, has good scalability and reliability, but currently lacks a general method for efficiently integrating it with YOLO object detection results. Summary of the Invention

[0006] To overcome the above-mentioned deficiencies, the present invention provides a YOLO object detection result transmission system and method based on a message queue. The YOLO object detection result transmission system and method based on a message queue can meet the strict requirements for data transmission in application scenarios such as real-time video monitoring.

[0007] The technical solution adopted by the present invention to solve its technical problems: A YOLO object detection result transmission system based on a message queue, including a video data acquisition module, a video data preprocessing module, a YOLO model loading module, an object detection module, an object tracking module, a task scheduling module, a data packetizing module, a message transmission module, and an exception handling and system recovery module, where: The video data acquisition module can continuously capture image frames from a video source to achieve continuous acquisition of video frames; The video data preprocessing module can attach the acquisition time to each frame of image data captured by the video data acquisition module, and store the video frame and its acquisition timestamp in a thread-safe queue; The task scheduling module can obtain the detection tasks to be executed through an HTTP interface or directly from the RabbitMQ task queue, and dynamically start the corresponding detection processing threads according to the task type to achieve multi-task parallel processing; The YOLO model loading module can load the pre-trained YOLO model for the system; The object detection module can call the YOLO model to detect and process the input video frames, and extract the object information in the images; The object tracking module can correlate the detection results in consecutive frames through an object tracking algorithm to form continuous tracking; The data packetizing module can organize the object information detected by the object detection module to form a standardized JSON format message; The message transmission module can use the RabbitMQ asynchronous message queue to send the data organized by the data packetizing module to the specified server; The exception handling and system recovery module is used to set an exception capture mechanism in the video data acquisition, object detection, task distribution, and message transmission links, and set different recovery measures for different exception situations.

[0008] As a further improvement of the present invention, a loose coupling design is adopted between the modules, and data interaction is carried out through a unified data interface and RabbitMQ.

[0009] As a further improvement of the present invention, the video data acquisition module realizes continuous acquisition of video frames from a camera or an RTSP video stream through the OpenCV tool.

[0010] As a further improvement of the present invention, the target tracking module uses the bytetrack algorithm to continuously track the detection results, and realizes the statistics of the target motion trajectory and cross-line detection.

[0011] As a further improvement of the present invention, the target information detected by the target detection module includes target position, motion trajectory, category, tracking ID, and timestamp information.

[0012] As a further improvement of the present invention, the message transmission module can also send data to a specified server through an HTTP interface.

[0013] As a further improvement of the present invention, the exception handling and system recovery module includes an exception capture sub-module, a recovery policy sub-module, and a safe termination sub-module. The exception capture sub-module can set an exception capture mechanism for video acquisition, target detection, task scheduling, and message transmission links, and record error logs; the recovery policy sub-module can take recovery measures such as reconnection, clearing the cache, and restarting threads for different exception situations; the safe termination sub-module can interrupt the detection thread when the exception capture sub-module captures a serious exception or the task is cancelled.

[0014] A method for transmitting YOLO target detection results based on a message queue includes the following steps: Step 1: Start the RabbitMQ server; Step 2: Establish a RabbitMQ connection; Step 3: The task scheduling module obtains the detection tasks to be executed from the RabbitMQ task queue, and starts the corresponding algorithm threads according to the task algorithm type; Step 4: The video data acquisition module continuously acquires video frames from the video source, and then the video data preprocessing module attaches the acquisition time to each frame of image data collected, and stores the captured video frames and their acquisition timestamps into a thread-safe queue; Step 5: Start the video stream capture thread, obtain video frames from the thread-safe queue, detect and process them through the YOLO model, extract the target information in each frame of image, and the target tracking module correlates the detection results in consecutive frames through the target tracking algorithm to form the motion trajectory of the target; Step 6: The data packet module organizes the target information after target detection and tracking into a standardized JSON format message body, and the message transmission module uses the RabbitMQ asynchronous message queue to send the JSON format message body to the specified server at the front end.

[0015] As a further improvement of the present invention, in step three during task distribution, first judge the task status. If the task is in a stopped state, the system ends the subsequent process and outputs a prompt of "Received task stop message, the task has stopped"; if the task is in an active state, check whether the task already exists. If the task does not exist, the system ends the subsequent process and outputs a prompt of "The task already exists, do not execute repeatedly"; if the task exists, start the corresponding algorithm thread according to the task algorithm type.

[0016] As a further improvement of the present invention, in step six, the standardized JSON format message is periodically counted and then sent.

[0017] The beneficial effects of the present invention are as follows: The present invention uses the RabbitMQ message queue to achieve asynchronous data transmission, significantly reducing the network delay in the traditional HTTP polling and WebSocket methods, and can meet the requirements of real-time video monitoring for low-latency transmission. Through the persistent storage and retry mechanism of the message queue, the present invention effectively avoids data interruption and loss caused by network fluctuations or server exceptions, ensuring the integrity of the detection results. The present invention separates the target detection and data transmission modules, adopting a modular and loose-coupled design, which is conducive to the independent upgrade and expansion of each module and can adapt to large-scale concurrent application scenarios. The present invention adopts an asynchronous transmission mechanism, enabling the system to still maintain a stable data transmission ability under high-concurrency conditions, thereby meeting the requirements of high-frequency detection scenarios. The present invention adopts a perfect exception handling and automatic recovery mechanism, enabling the system to quickly recover when facing video stream interruption, network exception or task failure, ensuring long-term stable operation. By introducing the RabbitMQ message queue technology, the present invention effectively solves the deficiencies of traditional detection systems in terms of real-time performance, data reliability and system scalability, and can be applied to application scenarios with high requirements for real-time performance and stability such as intelligent monitoring and intelligent transportation. Description of the Drawings

[0018] Figure 1 is the system flowchart of the present invention. Detailed Embodiments

[0019] Embodiment: A YOLO target detection result transmission system based on a message queue, characterized in that it includes a video data acquisition module, a video data preprocessing module, a YOLO model loading module, a target detection module, a target tracking module, a task scheduling module, a data packetizing module, a message transmission module and an exception handling and system recovery module, wherein: The video data acquisition module can continuously capture image frames from the video source to achieve continuous acquisition of video frames; The video data preprocessing module can attach the acquisition time to each frame of image data captured by the video data acquisition module, and store the video frame and its acquisition timestamp in a thread-safe queue, providing stable input for subsequent processing; The task scheduling module can obtain the detection tasks to be executed through the HTTP interface or directly from the RabbitMQ task queue, and dynamically start the corresponding detection processing threads according to the task type to achieve multi-task parallel processing; The YOLO model loading module can load the pre-trained YOLO model for the system; The target detection module can call the YOLO model to perform detection processing on the input video frames, and extract the target information in the images, such as outputting the target position, category, and confidence information; The target tracking module can correlate the detection results in consecutive frames through the target tracking algorithm to form continuous tracking, and then realize the statistical functions such as the target motion trajectory and cross-line detection, meeting the requirements of real-time monitoring and statistics; The data packet assembly module can organize the target information detected by the target detection module (such as target coordinates, category, tracking ID, timestamp, etc.) to form a standardized JSON format message; The message transmission module can use the RabbitMQ asynchronous message queue to send the data organized by the data packet assembly module to the specified server. The RabbitMQ asynchronous message queue mechanism supports high concurrency, low latency transmission, and has the data persistence function to ensure that data will not be lost in case of network fluctuations, etc.; The exception handling and system recovery module is used to set up an exception capture mechanism in the video data acquisition, target detection, task distribution, and message transmission links, and set different recovery measures for different exception situations. To ensure that the system has sufficient robustness during actual operation, it is best to integrate the exception handling and automatic recovery mechanism into all modules.

[0020] The above system realizes efficient video data acquisition and preprocessing, can perform target detection and tracking in real time, and uses flexible task scheduling and multi-thread management to achieve multi-task parallel processing. After the detection results are packetized in a standardized manner, they are transmitted to the downstream system in a low-latency and highly reliable manner. At the same time, the perfect exception handling and automatic recovery mechanism ensure the stability of the system in a complex network environment.

[0021] A loose coupling design is adopted between the modules, and data interaction is carried out through a unified data interface and RabbitMQ (message queue). The modules cooperate with each other through loose coupling interfaces to form a real-time, stable, and scalable detection result transmission system, ensuring the flexibility and scalability of the system.

[0022] The video data acquisition module continuously acquires video frames from a camera or an RTSP video stream through the OpenCV tool. In addition to using the OpenCV tool for continuous acquisition of video frames, other tools such as Python can also be used.

[0023] The target tracking module uses the bytetrack algorithm to continuously track the detection results, and realizes the statistics of the target movement trajectory and cross-line detection to meet the requirements of real-time monitoring and statistics.

[0024] The target information detected by the target detection module includes target position, movement trajectory, category, tracking ID, and timestamp information.

[0025] The message transmission module can also send data to a specified server through an HTTP interface, and through a flexible interface design, it can meet the requirements in different scenarios.

[0026] The exception handling and system recovery module includes an exception capture sub-module, a recovery strategy sub-module, and a safe termination sub-module. The exception capture sub-module can set an exception capture mechanism for video acquisition, target detection, task scheduling, and message transmission links, and record error logs; the recovery strategy sub-module can take recovery measures such as reconnection, clearing the cache, and restarting threads for different exception situations. For example, when the exception capture sub-module captures an exception of video stream reading failure in the video acquisition link, the recovery strategy sub-module takes an automatic reconnection recovery measure. When the exception capture sub-module captures a network transmission exception in each link, the recovery strategy sub-module takes a recovery measure of resending messages; the safe termination sub-module can interrupt the detection thread when the exception capture sub-module captures a serious exception or a task cancellation, thereby ensuring that each thread can safely exit and preventing resource leakage or system crash.

[0027] A method for transmitting YOLO target detection results based on a message queue includes the following steps: Step 1: Start the RabbitMQ server, and start the program and loop; Step 2: Establish a RabbitMQ connection; Step 3: The task scheduling module retrieves the detection tasks to be executed from the RabbitMQ task queue, starts the corresponding algorithm threads according to the task algorithm types (such as personnel aggregation, vehicle counting, etc.), realizes task acquisition and initial task scheduling, and distributes the tasks. When distributing tasks, first judge the task status. If the task is in the stopped state, the system ends the subsequent process and outputs a prompt of "Received task stop message, the task has stopped"; if the task is in the active state, check whether the task already exists. If the task does not exist, the system ends the subsequent process and outputs a prompt of "The task already exists, do not execute it repeatedly"; if the task exists, start the corresponding algorithm thread according to the task algorithm type. When distributing tasks, first judge the task status and whether the task exists to prevent errors in task distribution and repeated target detection and tracking work; Step 4: The video data acquisition module continuously acquires video frames from the video source, and then the video data preprocessing module attaches the acquisition time to each frame of image data collected, and stores the captured video frames and their acquisition timestamps into the thread-safe queue; Step 5: Start the video stream capture thread, obtain video frames from the thread-safe queue, detect and process them through the YOLO model, extract the target information in each frame of image, and the target tracking module associates the detection results in consecutive frames through the target tracking algorithm to form the motion trajectory of the target; Step 6: The data packet module organizes the target information (such as target coordinates, categories, tracking IDs, timestamps, etc.) after target detection and tracking into a standardized JSON format message body, constructs the message body directly in JSON format, converts the pictures using base64, performs periodic statistics on the standardized JSON format messages, and then the message transmission module uses the RabbitMQ asynchronous message queue to send the JSON format message body to the specified front-end server.

[0028] The above transmission method realizes the efficient connection of each link of video data acquisition, real-time target detection, task scheduling and message transmission, ensuring low latency, high reliability and good scalability in a high-concurrency environment. By introducing the RabbitMQ message queue and a perfect exception handling mechanism, this method effectively solves the problems of insufficient real-time performance, data loss and high system coupling degree existing in traditional HTTP / WebSocket transmission, and provides a standardized and reliable detection result transmission solution for application scenarios such as intelligent monitoring and intelligent transportation.

Claims

1. A YOLO target detection result transmission system based on a message queue, characterized in that: It includes video data acquisition module, video data preprocessing module, YOLO model loading module, target detection module, target tracking module, task scheduling module, data packaging module, message transmission module and exception handling and system recovery module, among which: The video data acquisition module can capture image frames from the video source in real time to achieve continuous acquisition of video frames; The video data preprocessing module can add the acquisition time to each frame of image data captured by the video data acquisition module, and store the video frame and its acquisition timestamp in a thread-safe queue; The task scheduling module can obtain the detection tasks to be executed through the HTTP interface or directly from the RabbitMQ task queue, and dynamically start the corresponding detection processing thread according to the task type to realize multi-task parallel processing; The YOLO model loading module can load the pre-trained YOLO model into the system; The target detection module can call the YOLO model to detect the input video frames and extract the target information in the image; The target tracking module can associate the detection results in consecutive frames through the target tracking algorithm to form continuous tracking; The data packaging module can organize the target information detected by the target detection module and form a standardized JSON format message; The message transmission module can use RabbitMQ asynchronous message queue to send the data sorted by the data packaging module to the designated server; The exception handling and system recovery module is used to set up an exception capture mechanism in the video data acquisition, target detection, task distribution and message transmission links, and set different recovery measures for different abnormal situations.

2. The YOLO target detection result transmission system based on the message queue according to claim 1, characterized in that: The modules adopt a loosely coupled design and exchange data through a unified data interface and RabbitMQ.

3. The YOLO target detection result transmission system based on message queue according to claim 1, characterized in that: The video data acquisition module realizes continuous acquisition of video frames from the camera or RTSP video stream through the OpenCV tool.

4. The YOLO target detection result transmission system based on message queue according to claim 1, characterized in that: The target tracking module uses the ByteTrack algorithm to continuously track the detection results and realize the statistics of target motion trajectory and cross-line detection.

5. The YOLO target detection result transmission system based on message queue according to claim 1, characterized in that: The target information detected by the target detection module includes target position, motion trajectory, category, tracking ID and timestamp information.

6. The YOLO target detection result transmission system based on message queue according to claim 1, characterized in that: The message transmission module can also send data to a specified server through the HTTP interface.

7. The YOLO target detection result transmission system based on message queue according to claim 1, characterized in that: The exception handling and system recovery module includes an exception capture submodule, a recovery strategy submodule and a safe termination submodule. The exception capture submodule can set an exception capture mechanism for video acquisition, target detection, task scheduling and message transmission links, and record error logs; The recovery strategy submodule can take recovery measures such as reconnecting, clearing cache and restarting threads according to different abnormal situations; the safe termination submodule can interrupt the detection thread when the exception capture submodule captures a serious exception or the task is cancelled.

8. A message queue-based YOLO target detection result transmission method using the message queue-based YOLO target detection result transmission system according to claim 1, characterized in that: The steps include: Step 1: Start the RabbitMQ server; Step 2: Establish a RabbitMQ connection; Step 3: The task scheduling module obtains the detection tasks to be executed from the RabbitMQ task queue and starts the corresponding algorithm thread according to the task algorithm type; Step 4: The video data acquisition module continuously acquires video frames from the video source, and then the video data preprocessing module adds the acquisition time to each frame of image data acquired, and stores the captured video frames and their acquisition timestamps in a thread-safe queue; Step 5: Start the video stream capture thread, obtain the video frame from the thread-safe queue and detect it through the YOLO model, extract the target information in each frame, and the target tracking module associates the detection results in consecutive frames through the target tracking algorithm to form the target's motion trajectory; Step 6: The data packaging module organizes the target information after target detection and tracking into a standardized JSON format message body, and the message transmission module uses the RabbitMQ asynchronous message queue to send the JSON format message body to the front-end designated server.

9. The YOLO target detection result transmission method based on a message queue according to claim 8, characterized in that: In the step 3, when distributing tasks, the task status is first determined. If the task is in a stopped state, the system terminates the subsequent process and outputs a prompt "Task stop message received, task has stopped"; If the task is in the active state, check whether the task already exists. If the task does not exist, the system ends the subsequent process and outputs a prompt "The task already exists, do not repeat it"; If the task exists, the corresponding algorithm thread is started according to the task algorithm type.

10. The method for transmitting YOLO target detection results based on a message queue according to claim 8, characterized in that: In step 6, the standardized JSON format message is periodically counted and then sent.

Citation Information

Patent Citations

  • Multi-region people counting method and device

    CN113516024A

  • Intelligent monitoring system based on deep learning

    CN116778381A

  • Java-based intelligent port hardware linkage control system and method

    CN118172861A

  • Efficient deep learning model deployment scheme based on message queue and micro-service architecture

    CN119690693A