A method, device, medium and equipment for image transmission based on RDMA
By directly transmitting image data in shared memory through RDMA and using protobuf's binary encoding, it solves the problems of slow image transmission speed and high CPU usage in the existing technology, and achieves efficient and low-latency image data transmission.
Patent Information
- Application Number
- CN202410917130.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-07-10
AI Technical Summary
Existing data transmission methods are slow when transmitting image data, and due to the reliability and ordering mechanism of the TCP/IP protocol, the CPU usage is high. Especially in high-concurrency and large-data scenarios, performance drops significantly.
The image transmission method based on RDMA is used to directly transmit data in the shared memory through RDMA, eliminating multiple copy operations during the transmission process. It is combined with the binary encoding of protobuf for efficient data serialization and deserialization.
It achieves image transmission with low latency, high throughput, and low CPU usage, improves the efficiency of data transmission between orchestration operators, and reduces CPU resource usage.
Smart Images

Figure CN118467457B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a method, device, medium and equipment for picture transmission based on RDMA. Background Art
[0002] There is usually a need for data transmission between different platforms or devices. In the existing data transmission methods, for the transmission of image data, it is usually necessary to compress the image data first, then encapsulate it, and then transmit it. It is decoded between another device and converted back into image data. In addition, the existing technology usually uses the Kafka message middleware for image data transmission. Since the underlying layer of Kafka is implemented using the TCP / IP protocol, TCP / IP introduces mechanisms such as three-way handshakes, retransmission mechanisms, and congestion control to ensure reliability and orderliness, which increases some additional performance usage and slows down the transmission speed. In addition, during the transmission process, the TCP / IP protocol needs to copy data in the kernel space and the user space. This memory copy process requires the CPU to participate and will occupy CPU cycles. Especially in high-concurrency and large-data volume scenarios, the overhead of memory copy is more obvious.
[0003] Based on this, there is an urgent need for a high-efficiency image transmission method with fast transmission speed and low memory usage. Summary of the invention
[0004] In view of the above problems, the present invention is proposed to provide an RDMA-based picture transmission method, apparatus, medium and device that overcome the above problems or at least partially solve the above problems.
[0005] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.
[0006] According to a first aspect of an embodiment of the present invention, a method for transmitting an image based on RDMA is provided, the method comprising: obtaining a target frame image based on decoding of a video stream obtained from a streaming media server, identifying the target frame image to obtain a serialized first recognition result, and writing the first recognition result into a first area of a shared memory through RDMA;
[0007] Read the first recognition result from the first area of the shared memory, perform attribute recognition based on the first recognition result to obtain a serialized second recognition result, and then write the second recognition result into the second area of the shared memory through RDMA;
[0008] Read the second identification result from the second area of the shared memory, perform business logic judgment based on the second identification result to obtain serialized alarm identification data, and then write the alarm identification data into the third area of the shared memory through RDMA;
[0009] The alarm identification data is read from the third area of the shared memory, event information is generated according to the alarm identification data, and the event information is output.
[0010] In some embodiments of the present invention, the step of obtaining a target frame image based on decoding of a video stream obtained from a streaming media server, identifying the target frame image to obtain a first identification result, and writing the first identification result into a first area of a shared memory through RDMA comprises:
[0011] Obtain a video stream from a streaming media server, obtain a target frame image based on the video stream decoding, identify the target frame image, confirm an identification frame of the target object, and obtain a target frame image with an identification frame;
[0012] The target frame image with the identification frame is encapsulated into protobuf structure serialized data to obtain a serialized first recognition result, and then the first recognition result is written into the first area of the shared memory through RDMA.
[0013] In some embodiments of the present invention, reading the first recognition result from the first area of the shared memory, performing attribute recognition based on the first recognition result to obtain a serialized second recognition result, and then writing the second recognition result to the second area of the shared memory through RDMA includes:
[0014] Read the first recognition result from the first area of the shared memory, deserialize the first recognition result into a binary stream, and decode it to obtain the target frame image with the recognition frame;
[0015] Performing a window recognition operation on the target frame image with the recognition frame to obtain recognition frame image data;
[0016] Inputting the recognition frame image data into an attribute recognition model to perform attribute recognition to obtain attribute data;
[0017] The target frame image with the identification frame is merged with the attribute data to obtain target frame detection data, the target frame detection data is encapsulated into protobuf structure serialized data to obtain a serialized second recognition result, and the second recognition result is written into the second area of the shared memory through RDMA.
[0018] In some embodiments of the present invention, reading the second identification result from the second area of the shared memory, performing business logic judgment based on the second identification result to obtain serialized alarm identification data, and then writing the alarm identification data into the third area of the shared memory through RDMA includes:
[0019] Read the second recognition result from the second area of the shared memory, deserialize the second recognition result into a binary stream, and decode it to obtain the target frame detection data;
[0020] Based on the target frame detection data, determining whether the identification frame meets a first condition, and determining whether the attribute data meets a second condition, and generating a service judgment result;
[0021] The target frame detection data is combined with the service judgment result to obtain alarm identification data, the alarm identification data is encapsulated into protobuf structure serialized data to obtain serialized alarm identification data, and then the alarm identification data is written into the third area of the shared memory through RDMA.
[0022] In some embodiments of the present invention, the method further comprises:
[0023] Set the first condition and the second condition respectively;
[0024] When the target frame detection data satisfies both the first condition and the second condition, generating a first judgment result;
[0025] When the target frame detection data cannot satisfy both the first condition and the second condition, a second judgment result is generated.
[0026] In some embodiments of the present invention, the reading the alarm identification data from the third area of the shared memory, generating event information according to the alarm identification data, and outputting the event information comprises:
[0027] Reading the alarm identification data from the third area of the shared memory, deserializing the alarm identification data into a binary stream, and decoding the target frame detection data and the service judgment result;
[0028] Determine whether to generate event information according to the business judgment result;
[0029] After the event information is generated, the event information is output.
[0030] In some embodiments of the present invention, the streaming media server is a ZLMedia server.
[0031] According to a second aspect of an embodiment of the present invention, a picture transmission device based on RDMA is provided, and the picture transmission device based on RDMA includes:
[0032] A first recognition module is used to obtain a target frame image based on the video stream decoded from the streaming media server, recognize the target frame image, obtain a serialized first recognition result, and write the first recognition result into a first area of the shared memory through RDMA;
[0033] A second identification module is used to read the first identification result from the first area of the shared memory, perform attribute identification based on the first identification result to obtain a serialized second identification result, and then write the second identification result into the second area of the shared memory through RDMA;
[0034] A first business module is used to read the second identification result from the second area of the shared memory, perform business logic judgment based on the second identification result, obtain serialized alarm identification data, and then write the alarm identification data into the third area of the shared memory through RDMA;
[0035] The second service module is used to read the alarm identification data from the third area of the shared memory, generate event information according to the alarm identification data, and output the event information.
[0036] According to a third aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which computer program instructions are stored. The computer program instructions are loaded and executed by a processor to implement the operations performed by any of the methods described above.
[0037] According to a fourth aspect of an embodiment of the present invention, there is provided an electronic device, comprising a processor and a memory, wherein the memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, it implements instructions of any of the methods described above.
[0038] The technical solution provided in the embodiments of the present invention has at least the following technical effects or advantages:
[0039] The embodiments of the present invention provide an RDMA-based image transmission method, device, medium and equipment. The RDMA-based image transmission method performs data transmission through RDMA, eliminates multiple copy operations during the transmission process, reduces CPU usage, and has the advantages of low latency, high throughput, and low CPU occupancy. Protobuf uses binary encoding to perform image data transmission. Compared with the text formats xml and json, protobuf provides an efficient data serialization and deserialization mechanism, which makes the conversion between structured data and byte stream data very simple and efficient, thereby improving data transmission efficiency. RDMA+protobuf can be used to achieve high-performance image data + structured data transmission between orchestration operators, thereby improving the transmission efficiency of data between orchestration operators and reducing CPU resource occupancy.
[0040] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. 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 creative work.
[0042] Figure 1 A schematic diagram of a flow chart of an RDMA-based image transmission method provided in an embodiment of the present invention;
[0043] Figure 2 This is a reference example diagram of the target detection operator execution process;
[0044] Figure 3 A reference example diagram of the execution process of the attribute identification operator;
[0045] Figure 4 This is a reference example diagram of the execution process of the regional warning line operator;
[0046] Figure 5 A schematic diagram of the principle structure of an RDMA-based image transmission device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0047] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings.
[0048] Various structural schematic diagrams according to embodiments of the present disclosure are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may further design regions / layers with different shapes, sizes, and relative positions according to actual needs.
[0049] In the context of the present disclosure, when a layer / element is referred to as being "on" another layer / element, the layer / element may be directly on the other layer / element, or there may be an intervening layer / element therebetween. Additionally, if a layer / element is "on" another layer / element in one orientation, the layer / element may be "below" the other layer / element when the orientation is reversed. In the context of the present disclosure, similar or identical components may be denoted by the same or similar reference numerals.
[0050] In order to better understand the above-mentioned technical scheme, the above-mentioned technical scheme will be described in detail below in combination with specific implementation methods. It should be understood that the embodiments of the present disclosure and the specific features in the embodiments are detailed descriptions of the technical scheme of the present invention, rather than limitations on the technical scheme of the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0051] Figure 1 FIG. 1 is a flow chart of an RDMA-based image transmission method provided by an embodiment of the present invention. Figure 1 As shown, the RDMA-based image transmission method includes the following steps:
[0052] S1, decoding a video stream obtained from a streaming media server to obtain a target frame image, identifying the target frame image to obtain a serialized first recognition result, and writing the first recognition result into a first area of a shared memory through RDMA;
[0053] In step S1, the streaming media server described in the embodiment of the present invention is a ZLMedia server. The ZLMedia server is implemented based on C++, which can avoid the use of naked pointers. It has the advantages of stable and reliable code and superior performance, and supports multiple streaming media protocols and encoding formats, including RTMP, HLS, MPEG-DASH and HTTP-FLV, etc.; the ZLMedia server supports streaming media recording, transcoding, streaming, pulling and playback, and provides powerful scheduling and management functions.
[0054] The RDMA (Remote Direct Memory Access) is a technology developed to solve the data processing delay on the server side during network transmission. RDMA directly transfers the application data to the storage area of the server, and quickly copies the data from one server to the memory of the remote server through the network, eliminating multiple copy operations during the transmission process and reducing the use of the CPU.
[0055] The embodiment of the present invention obtains a target frame image based on decoding of a video stream obtained from a streaming media server, recognizes the target frame image, obtains a first recognition result, and writes the first recognition result into a first area of a shared memory through RDMA, including:
[0056] Obtain a video stream from a streaming media server, obtain a target frame image based on the video stream decoding, identify the target frame image, confirm an identification frame of the target object, and obtain a target frame image with an identification frame;
[0057] The target frame image with the identification frame is encapsulated into protobuf structure serialized data to obtain a serialized first recognition result, and then the first recognition result is written into the first area of the shared memory through RDMA.
[0058] In the embodiment of the present invention, the target frame image can be obtained by intercepting an image from a video stream obtained from a streaming media server based on actual needs.
[0059] The protobuf is a lightweight and efficient data serialization format language; the protobuf structure serializes data into a binary stream, and the serialization interface provided by protobuf can be directly used during serialization.
[0060] S2, reading the first recognition result from the first area of the shared memory, performing attribute recognition based on the first recognition result to obtain a serialized second recognition result, and then writing the second recognition result into the second area of the shared memory through RDMA;
[0061] Regarding step S2, reading the first recognition result from the first area of the shared memory, performing attribute recognition based on the first recognition result to obtain a serialized second recognition result, and then writing the second recognition result to the second area of the shared memory through RDMA includes:
[0062] Read the first recognition result from the first area of the shared memory, deserialize the first recognition result into a binary stream, and decode it to obtain the target frame image with the recognition frame;
[0063] Performing a window recognition operation on the target frame image with the recognition frame to obtain recognition frame image data;
[0064] Inputting the recognition frame image data into an attribute recognition model to perform attribute recognition to obtain attribute data;
[0065] The target frame image with the identification frame is merged with the attribute data to obtain target frame detection data, the target frame detection data is encapsulated into protobuf structure serialized data to obtain a serialized second recognition result, and the second recognition result is written into the second area of the shared memory through RDMA.
[0066] S3, reading the second recognition result from the second area of the shared memory, performing business logic judgment based on the second recognition result to obtain serialized alarm recognition data, and then writing the alarm recognition data into the third area of the shared memory through RDMA;
[0067] Regarding step S3, in an embodiment of the present invention, reading the second identification result from the second area of the shared memory, performing business logic judgment based on the second identification result to obtain serialized alarm identification data, and then writing the alarm identification data into the third area of the shared memory through RDMA includes:
[0068] Read the second recognition result from the second area of the shared memory, deserialize the second recognition result into a binary stream, and decode it to obtain the target frame detection data;
[0069] Based on the target frame detection data, determining whether the identification frame meets a first condition, and determining whether the attribute data meets a second condition, and generating a service judgment result;
[0070] The target frame detection data is combined with the service judgment result to obtain alarm identification data, the alarm identification data is encapsulated into protobuf structure serialized data to obtain serialized alarm identification data, and then the alarm identification data is written into the third area of the shared memory through RDMA.
[0071] Due to the random results of the target frame detection data, whether the first condition and the second condition are simultaneously satisfied will affect the business judgment result. Based on this, an embodiment of the present invention also includes: setting the first condition and the second condition respectively; when the target frame detection data simultaneously satisfies the first condition and the second condition, generating a first judgment result; when the target frame detection data cannot simultaneously satisfy the first condition and the second condition, generating a second judgment result.
[0072] Among them, the first condition is, for example, whether the identification box is in the warning area, or whether the identification box crosses the warning line; the second condition is, for example, whether there are attributes in the attribute data that meet the alarm requirements, including whether there are smokers, people making phone calls, etc.; the embodiment of the present invention can set the first condition and the second condition accordingly to suit actual application needs.
[0073] S4. Read the alarm identification data from the third area of the shared memory, generate event information according to the alarm identification data, and output the event information.
[0074] Regarding step S4, in the embodiment of the present invention, the alarm identification data is read from the third area of the shared memory, event information is generated according to the alarm identification data, and outputting the event information includes:
[0075] Reading the alarm identification data from the third area of the shared memory, deserializing the alarm identification data into a binary stream, and decoding the target frame detection data and the service judgment result;
[0076] Determine whether to generate event information according to the business judgment result;
[0077] After the event information is generated, the event information is output.
[0078] In an embodiment of the present invention, whether to generate event information is determined according to whether the business judgment result corresponds to the first judgment result or the second judgment result; for example, if the business judgment result corresponds to the first judgment result, it is determined that the target frame detection data satisfies both the first condition and the second condition, and event information is generated and output accordingly to indicate that there is a violation and an alarm needs to be given; for example, if the business judgment result corresponds to the second judgment result, it is determined that the target frame detection data cannot satisfy both the first condition and the second condition, and event information is not generated, the current logic process terminates, or the aforementioned steps are repeated after the data is reset.
[0079] It should be noted that the embodiment of the present invention respectively executes steps S1-S4 based on a four-level algorithm operator, wherein step S1 is implemented based on a target detection operator, step S2 is implemented based on an attribute recognition operator, step S3 is implemented based on an area warning line operator, and step S4 is implemented based on an event output operator.
[0080] The shared memory first area, the shared memory second area and the shared memory third area are different partitions of the same memory, which are used to independently store corresponding data respectively. Data transmission based on the same memory can greatly improve data transmission efficiency.
[0081] Example 1
[0082] In the embodiment of the present invention, the algorithm code reference for the four-level algorithm operator to identify the target frame image and perform attribute recognition is as follows:
[0083] syntax = "proto3";
[0084] message Algorithm {
[0085] int64 pts = 1;
[0086] string rtsp = 2;
[0087] bytes image = 3;
[0088] int32 widthPx = 4;
[0089] int32 lengthPx = 5;
[0090] repeated Box boxes = 6;
[0091] string imageFormat = 7;
[0092] string customData = 8;
[0093] }
[0094] message Box{
[0095] float xmin = 1;
[0096] float ymin = 2;
[0097] float xmax = 3;
[0098] float ymax = 4;
[0099] float score = 5;
[0100] int32 track_id = 6;
[0101] string data_type = 7;
[0102] repeated float points = 8;
[0103] repeatedTag tags = 9;
[0104] }
[0105] message Tag{
[0106] string labelName = 1;
[0107] float score = 2;
[0108] repeated attribute attributes = 3;
[0109] }
[0110] message Attribute{
[0111] string name = 1;
[0112] string value = 2;
[0113] float score = 3;
[0114] }
[0115] Specifically, see Figure 2 As shown, the target detection operator in step S1 is a first-level operator, which obtains a video stream (rtsp video stream) from a streaming media server, decodes the video stream to obtain a target frame image, and identifies bbox data of targets such as people, cars, and airplanes from the target frame image to confirm the identification frame of the target object.
[0116] Then create an Algorithm object (algorithm object) to write the current decoding timestamp into the pts field, write the current decoded video stream address into the rtsp field, write the width and height of the video into the widthPx and lengthPx fields respectively, and encode the target frame image into binary data through jpeg compression and write it into the image field. The image encoding format imageFormat is jpg.
[0117] The data of the recognition box is written into the boxes field, which is an array type and can store multiple recognition results. The tracking id of the current recognition box is written into track_id (tracking id), the confidence of the current recognition box is written into the score (confidence) field, and the coordinates of the upper left corner and lower right corner of the recognition box are written into the xmin, ymin, xmax, ymax fields.
[0118] The data_type field of the target detection algorithm is written as the rectangle box type. The category name of the recognition box is written into labelName in tags.
[0119] Finally, the Algorithm object is serialized into a binary stream through the protobuf python function SerializeToString and written into the first area of the shared memory through RDMA.
[0120] See also Figure 3 As shown, the attribute recognition operator in step S2 is a second-level operator, which reads the first recognition result of the binary stream from the first area of the shared memory through RDMA, and deserializes the binary stream into an Algorithm object through the python function ParseFromString of protobuf.
[0121] Read the image field content from the Algorithm object and decode it into a target frame image with an identification box. Then traverse each box data through the boxes field, and use the python cv2 corp interface to crop the image content corresponding to the box separately through the box's xmin (upper left corner), ymin (upper left corner), xmax (lower right corner), and ymax (lower right corner), i.e., the identification box image data. Then input the corp image content into the attribute recognition model to obtain the attribute data. The attribute model will output the attribute data (attribute name, attribute value, and confidence). After obtaining the output of the attribute model, the attribute data will be appended to the attributes field of tags in the current box, and the target frame image with the identification box will be merged with the attribute data to obtain the target frame detection data.
[0122] After boxes traverses and executes the above process, the python function SerializeToString of protobuf is used again to serialize the updated Algorithm object, that is, the second recognition result, and write it into the second area of the shared memory through RDMA.
[0123] See also Figure 4 As shown, the area warning line operator in step S3 is a third-level operator. The area warning line operator reads the second recognition result of the binary stream from the second area of the shared memory through RDMA, and deserializes the binary stream into an Algorithm object through the python function ParseFromString of protobuf.
[0124] Get the boxes field data in the Algorithm object, and at the same time get the warning area or warning line data corresponding to the current camera to obtain the target frame detection data.
[0125] Based on the target frame detection data, determine whether the identification box meets the first condition, and determine whether the attribute data meets the second condition. For example, determine whether to send a message to the event output operator by judging whether the identification box is in the alarm area or whether the identification box crosses the warning line and whether the attribute meets the alarm condition. If the alarm condition is met after judgment, a business judgment result is generated, and the target frame detection data is merged with the business judgment result to obtain alarm identification data, and the alarm identification data is encapsulated into protobuf structure serialized data to obtain serialized alarm identification data, and then the alarm identification data is written into the third area of the shared memory through RDMA.
[0126] The event output operator in step S4 is the last level, i.e., the fourth level operator. The event output operator reads the alarm identification data of the binary stream from the third area of the shared memory through RDMA, and deserializes the binary stream into an Algorithm object through the python function ParseFromString of protobuf. Event information is generated through the Algorithm object, and the event information includes data such as camera name, camera position, event level, identification result data, event start time, end time, and alarm picture. After the event information is generated, the event information is output.
[0127] Compared with the prior art, the RDMA-based image transmission method described in the embodiment of the present invention has the following advantages:
[0128] 1. Data transmission through RDMA eliminates multiple copy operations during the transmission process, reduces CPU usage, and has the advantages of low latency, high throughput, and low CPU usage;
[0129] 2. Use binary encoding through protobuf to perform image data transmission. Compared with text formats such as XML and JSON, protobuf provides an efficient data serialization and deserialization mechanism, making the conversion between structured data and byte stream data very simple and efficient, improving data transmission efficiency. Using RDMA+protobuf can achieve high-performance image data + structured data transmission between orchestration operators, improve the data transmission efficiency between orchestration operators, and reduce CPU resource usage.
[0130] Based on the above embodiment, as the above Figure 1 The present invention provides an embodiment of a picture transmission device based on RDMA, and the device embodiment is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices, see Figure 5As shown, the RDMA-based image transmission device includes:
[0131] The first recognition module 100 is used to obtain a target frame image based on the video stream decoded from the streaming media server, recognize the target frame image, obtain a serialized first recognition result, and write the first recognition result into the first area of the shared memory through RDMA;
[0132] The second identification module 200 is used to read the first identification result from the first area of the shared memory, perform attribute identification based on the first identification result to obtain a serialized second identification result, and then write the second identification result into the second area of the shared memory through RDMA;
[0133] The first service module 300 is used to read the second identification result from the second area of the shared memory, perform service logic judgment based on the second identification result, obtain serialized alarm identification data, and then write the alarm identification data into the third area of the shared memory through RDMA;
[0134] The second service module 400 is configured to read the alarm identification data from the third area of the shared memory, generate event information according to the alarm identification data, and output the event information.
[0135] The RDMA-based image transmission device described in the embodiment of the present invention can execute the RDMA-based image transmission method provided in the above embodiment. The RDMA-based image transmission device has the corresponding functional steps and beneficial effects of the RDMA-based image transmission method described in the above embodiment. Please refer to the above-mentioned embodiment of the RDMA-based image transmission method for details. The embodiment of the present invention will not be repeated here.
[0136] The embodiment of the present invention also provides an electronic device, which may include a processor and a memory, wherein the processor and the memory may be connected via a bus or other means. The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components and other chips, or a combination of the above-mentioned types of chips. The memory, as a non-transient computer-readable storage medium, may be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the RDMA-based image transmission method in the embodiment of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory, that is, the RDMA-based image transmission method in the above method embodiment is implemented.
[0137] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. The one or more modules are stored in the memory, and when executed by the processor, the RDMA-based image transmission method in the above-mentioned method embodiment is executed. The specific details of the above-mentioned electronic device can be understood by corresponding to the corresponding descriptions and effects in the above-mentioned method embodiment, and will not be repeated here. Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and the program, when executed, may include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.
[0138] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0139] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in less than all of the features of the individual embodiments previously disclosed. Therefore, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim itself serving as a separate embodiment of the present invention.
[0140] It should be noted that the above-mentioned embodiments illustrate rather than limit the invention and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims.
Claims
1. A method for transmitting an image based on RDMA, characterized in that: The RDMA-based picture transmission method includes: The step of obtaining a target frame image based on decoding of a video stream obtained from a streaming media server, recognizing the target frame image to obtain a serialized first recognition result, and writing the first recognition result into a first area of a shared memory through RDMA; the step of obtaining a target frame image based on decoding of a video stream obtained from a streaming media server, recognizing the target frame image to obtain a first recognition result, and writing the first recognition result into a first area of a shared memory through RDMA comprises: Obtain a video stream from a streaming media server, obtain a target frame image based on the video stream decoding, identify the target frame image, confirm an identification frame of the target object, and obtain a target frame image with an identification frame; Encapsulating the target frame image with the identification frame into protobuf structure serialized data to obtain a serialized first recognition result, and then writing the first recognition result into the first area of the shared memory through RDMA; Reading the first recognition result from the first shared memory area, performing attribute recognition based on the first recognition result to obtain a serialized second recognition result, and then writing the second recognition result to the second shared memory area through RDMA; reading the first recognition result from the first shared memory area, performing attribute recognition based on the first recognition result to obtain a serialized second recognition result, and then writing the second recognition result to the second shared memory area through RDMA includes: Read the first recognition result from the first area of the shared memory, deserialize the first recognition result into a binary stream, and decode it to obtain the target frame image with the recognition frame; Performing a window recognition operation on the target frame image with the recognition frame to obtain recognition frame image data; Inputting the recognition frame image data into an attribute recognition model to perform attribute recognition to obtain attribute data; Merging the target frame image with the identification frame with the attribute data to obtain target frame detection data, encapsulating the target frame detection data into protobuf structure serialized data to obtain a serialized second recognition result, and then writing the second recognition result into the second area of the shared memory through RDMA; Reading the second recognition result from the second area of the shared memory, performing business logic judgment based on the second recognition result to obtain serialized alarm recognition data, and then writing the alarm recognition data into the third area of the shared memory through RDMA; reading the second recognition result from the second area of the shared memory, performing business logic judgment based on the second recognition result to obtain serialized alarm recognition data, and then writing the alarm recognition data into the third area of the shared memory through RDMA includes: Read the second recognition result from the second area of the shared memory, deserialize the second recognition result into a binary stream, and decode it to obtain the target frame detection data; Based on the target frame detection data, determining whether the identification frame meets a first condition, and determining whether the attribute data meets a second condition, and generating a service judgment result; The target frame detection data is combined with the service judgment result to obtain alarm identification data, the alarm identification data is encapsulated into protobuf structure serialized data to obtain serialized alarm identification data, and then the alarm identification data is written into the third area of the shared memory through RDMA; The first condition and the second condition are set respectively; wherein the first condition is whether the identification box is within the warning area, or whether the identification box crosses the warning line; the second condition is whether there is an attribute in the attribute data that meets the alarm requirements; When the target frame detection data satisfies both the first condition and the second condition, generating a first judgment result; When the target frame detection data cannot satisfy both the first condition and the second condition, generating a second judgment result; The alarm identification data is read from the third area of the shared memory, event information is generated according to the alarm identification data, and the event information is output.
2. The RDMA-based image transmission method according to claim 1, characterized in that: The reading of the alarm identification data from the third area of the shared memory, generating event information according to the alarm identification data, and outputting the event information comprises: Reading the alarm identification data from the third area of the shared memory, deserializing the alarm identification data into a binary stream, and decoding the target frame detection data and the service judgment result; Determine whether to generate event information according to the business judgment result; After the event information is generated, the event information is output.
3. The RDMA-based image transmission method according to claim 1, characterized in that: The streaming media server is a ZLMedia server.
4. An RDMA-based image transmission device, applied to the RDMA-based image transmission method according to any one of claims 1 to 3, characterized in that: The RDMA-based picture transmission device includes: A first recognition module is used to obtain a target frame image based on the video stream decoded from the streaming media server, recognize the target frame image, obtain a serialized first recognition result, and write the first recognition result into a first area of the shared memory through RDMA; A second identification module is used to read the first identification result from the first area of the shared memory, perform attribute identification based on the first identification result to obtain a serialized second identification result, and then write the second identification result into the second area of the shared memory through RDMA; A first business module is used to read the second identification result from the second area of the shared memory, perform business logic judgment based on the second identification result, obtain serialized alarm identification data, and then write the alarm identification data into the third area of the shared memory through RDMA; The second service module is used to read the alarm identification data from the third area of the shared memory, generate event information according to the alarm identification data, and output the event information.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which are loaded and executed by a processor to implement the operations performed by the method according to any one of claims 1 to 3.
6. An electronic device comprising a processor and a memory, characterized in that: The memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, the processor implements instructions of any method according to claims 1-3.
Citation Information
Patent Citations
Gas station automatic intervention method and system, electronic equipment and storage medium
CN115512499A
Multi-channel video stream key frame marking and stream pushing method
CN117294903A
