Data processing method, computer equipment and storage medium
By employing two algorithms with different performance characteristics to process image data, the method reduces memory usage and enhances accuracy in data processing.
Patent Information
- Application Number
- CN202510162941.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-07-15
AI Technical Summary
In different application scenarios, existing processing algorithms need to occupy a large amount of memory for data processing, resulting in low accuracy of processing results.
By processing the image data using the first processing algorithm, the first processing result is obtained, and then the shared data is processed using the second processing algorithm. The shared data includes image data and/or the first processing result. Combined with the performance differences between the two processing algorithms, the memory usage is reduced and the processing accuracy is improved.
The memory usage during the processing process is reduced, data processing efficiency and accuracy are improved, and the processing performance of the second processing algorithm is optimized, especially by sharing image data and/or the first processing result.
Smart Images

Figure CN120318484A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a data processing method, a computer device, and a storage medium. Background Art
[0002] Currently, different processing algorithms can be selected in different application scenarios to process data and obtain respective processing results. However, in some application scenarios, since different processing algorithms all need to process data, a large amount of memory is required during the data processing. In some application scenarios, due to the limited performance of the processing algorithm, the accuracy of the processing result is also low. Summary of the Invention
[0003] The main technical problem to be solved by this application is to provide a data processing method, a computer device, and a storage medium, which can at least reduce the memory occupied by the processing algorithm for image processing and / or improve the accuracy of the processing result.
[0004] In the first aspect of this application, a data processing method is provided. The method includes: acquiring image data; processing the image data using a first processing algorithm to obtain a first processing result; processing shared data using a second processing algorithm to obtain a second processing result; where the shared data includes the image data and / or the first processing result, and the first processing algorithm and the second processing algorithm have different processing performances for images.
[0005] In the second aspect of this application, a computer device is provided. The computer device includes a memory and a processor coupled to each other. Program data is stored in the memory, and the processor is configured to execute the program data to implement any step of the above data processing method.
[0006] In the third aspect of this application, a computer-readable storage medium is provided. The computer-readable storage medium stores program data that can be run by a processor, and the program data is used to implement any step of the above data processing method.
[0007] In the above solution, the present application processes image data using a first processing algorithm to obtain a first processing result. Then, the shared data is processed using a second processing algorithm to obtain a second processing result. Since the shared data includes image data and / or the first processing result, it is possible to reduce the memory occupation during the data processing of different processing algorithms and improve the data processing efficiency. Among them, sharing at least the image data can reduce the memory occupation of the image data, and sharing at least the first processing algorithm can reduce the processing process of the second processing algorithm and improve the processing efficiency of the second processing algorithm. In addition, the first processing algorithm and the second processing algorithm have different processing performances for images. The second processing algorithm directly reprocesses the first processing result of the first processing algorithm, and can perform data processing by integrating the processing performances of different processing algorithms, thereby improving the accuracy of the second processing algorithm to obtain the second processing result.
[0008] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the present application, the following will briefly introduce the drawings required in the description of the embodiments. Obviously, the following described drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. Among them:
[0010] Figure 1 is a flowchart of the first embodiment of the data processing method of the present application;
[0011] Figure 2 is the present application Figure 1 is a flowchart of an embodiment of step S13 in the present application;
[0012] Figure 3 is a flowchart of the second embodiment of the data processing method of the present application;
[0013] Figure 4 is a flowchart of the third embodiment of the data processing method of the present application;
[0014] Figure 5 is a schematic structural diagram of an embodiment of the data processing system of the present application;
[0015] Figure 6 is a schematic structural diagram of an embodiment of the computer device of the present application;
[0016] Figure 7 is a schematic structural diagram of an embodiment of the computer-readable storage medium of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0017] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts belong to the scope of protection of the present application.
[0018] The terms "first" and "second" in the present application are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In the description of the present application, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0019] Referring to "embodiments" in the present application means that the specific features, structures or characteristics described in connection with the embodiments may be included in at least one embodiment of the present application. The phrase appearing in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0020] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after. In addition, "a plurality" in this article means two or more than two. In addition, the term "at least one" in this article means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set composed of A, B, and C.
[0021] The present application provides the following embodiments, and the following will specifically describe each embodiment.
[0022] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of the first embodiment of the data processing method of the present application. The method may include the following steps:
[0023] S11: Obtain image data.
[0024] The image data can be the image data corresponding to an image frame or a video. For example, a video or an image frame can be collected by a camera device in a preset area. There may be several target objects of the same or different types in the video or image frame. The target object can include entities or living bodies, etc., and the present application does not limit this.
[0025] In some embodiments, the image data of the image frame or the video is stored. The image data can be the image data in a preset image format. For example, the preset image format is the YUV format. Among them, the YUV format includes three components. The Y (Luminance or Luma) component: represents the brightness, that is, the grayscale value. The U (Chrominance or Chroma, also known as Cb) component: represents the chrominance component, describes the image color and saturation, and mainly reflects the information after removing the brightness from the blue part. The V (Chrominance or Chroma, also known as Cr) component: represents the chrominance component, describes the image color and saturation, and mainly reflects the information after removing the brightness from the red part.
[0026] It can be understood that the present application is not limited to image data, and can also be applied to other data to be processed, such as text data, audio data, etc., and the present application does not limit this. The following takes image data as an example for illustration.
[0027] S12: Process the image data using a first processing algorithm to obtain a first processing result.
[0028] The present application may include at least two processing algorithms. The processing performances of different processing algorithms are different. Any one of the processing algorithms can be used as the first processing algorithm or the second processing algorithm to execute the steps of the present application. The present application takes the first processing algorithm and the second processing algorithm as examples for illustration, and the present application is not limited thereto.
[0029] In some embodiments, the different processing performances include at least one of the following: different detection ranges for target objects, different detection accuracies for target objects. Among them, the detection range for target objects can represent the range of the detection area, the range of detection types, etc., and the detection accuracy for target objects can represent the quality and accuracy of detecting target objects, etc., and the present application does not limit this.
[0030] In some embodiments, the detection range of the first processing algorithm for target objects is greater than that of the first processing algorithm, and the detection accuracy of the second processing algorithm for target objects is greater than that of the first processing algorithm.
[0031] Optionally, the first processing algorithm includes a perimeter processing algorithm, and the second processing algorithm includes a video structuring algorithm. Among them, the perimeter processing algorithm can be a series of algorithms for detecting and identifying abnormal events inside and outside the perimeter area. The image data can be analyzed according to preset rules to achieve the detection and identification of target objects, so as to timely discover and handle abnormal events. The video structuring algorithm can be used for the process of parsing the image data of a video or image frame, extracting meaningful information, and converting it into structured data. For example, the video structuring algorithm can be used to detect target objects in a region and extract information such as their features and / or attributes. This application places no restrictions on the video structuring algorithm. For the above two processing algorithms, the types and ranges of target objects detected by the perimeter processing algorithm are more, but the detection quality and accuracy are lower than those of the video structuring algorithm. The types and ranges of target objects detected by the video structuring algorithm are fewer, but the detection quality and accuracy are higher. The above two processing algorithms each have their own advantages and disadvantages and different processing performances. It can be understood that this application can determine the first processing algorithm and the second processing algorithm according to the application scenario, and this application places no restrictions on the first processing algorithm and the second processing algorithm.
[0032] In this step, the image data is processed using the first processing algorithm to obtain a first processing result. Among them, the first processing result can include a plurality of first processing results, and the plurality of first processing results are processing results of different processing types. For example, the plurality of first processing results can include processing results of different processing processes / different processing stages / different processing methods, etc.
[0033] In some embodiments, the image data is passed to the first processing algorithm to create a handle for the first algorithm. After the first processing algorithm receives the image data, the image data is processed using the first processing algorithm to obtain a first processing result.
[0034] Exemplarily, taking the perimeter processing algorithm as an example, the first processing result may include the object detection result and / or the object tracking result. After receiving the image data in YUV format, the perimeter processing algorithm performs object detection (OD) on the image data and can obtain the object detection result. Optionally, intelligent motion detection (MOV) can also be performed on the target objects (such as at least some of the target objects in the object detection result), and the abnormal events of the target objects are reported to a preset platform. Optionally, the perimeter processing algorithm can also perform object tracking (OT) on the target objects to obtain the object tracking result and ensure that the targets can be detected in real time. After the object tracking is completed, on the one hand, the perimeter processing algorithm can output the object detection result and / or the object tracking result OT, and on the other hand, it can perform rule event detection to output a preset rule event. For example, a rule event prompt (TBA, To Be Announced), etc. Exemplarily, taking the wire crossing rule prompt as an example, a line is set in the image frame. If it is detected that the target object triggers this line, the rule event can be prompted and then reported to the preset platform.
[0035] S13: Process the shared data using a second processing algorithm to obtain a second processing result; wherein, the shared data includes image data and / or the first processing result, and the first processing algorithm and the second processing algorithm have different processing performances for images.
[0036] Create a second processing algorithm and initialize the second processing algorithm. After the first processing algorithm completes the processing, it can be passed to the second processing algorithm for processing. Among them, the first processing algorithm and the second processing algorithm have different processing performances for images, and there are differences in processing performance. First, the shared data of the first processing algorithm and the second processing algorithm can be determined. The shared data includes image data and / or the first processing result. Then, use the second processing algorithm to process the shared data to obtain the second processing result.
[0037] Optionally, the shared data includes image data, enabling the first processing algorithm and the second processing algorithm to share the image data for processing and obtain the processing results of each processing algorithm respectively. The first processing algorithm and the second processing algorithm process the image data in sequence, which can reduce the memory occupation of the processing algorithm during the image processing process.
[0038] Optionally, the shared data includes the first processing result, such that the second processing algorithm can directly process the first processing result of the first processing algorithm, which is equivalent to the first processing algorithm and the second processing algorithm sharing a part of the model, reducing the process of the second processing algorithm for processing the image data to obtain the first processing result, reducing the memory occupation during the processing, and since the processing performances of the second processing algorithm and the first processing algorithm are different, it is also possible to combine the processing performances of multiple processing algorithms for image processing, improving the accuracy of image processing.
[0039] Optionally, the shared data includes the image data and the first processing result, and the second processing algorithm can process the image data and the first processing result respectively to comprehensively obtain the second processing result, reducing the memory occupation for image processing and improving the accuracy of the second processing algorithm for image processing.
[0040] In the above solution, in the present application, the image data is processed by using the first processing algorithm to obtain the first processing result, and then the shared data is processed by using the second processing algorithm to obtain the second processing result. Since the shared data includes the image data and / or the first processing result, it is possible to reduce the memory occupation during the data processing of different processing algorithms, improving the data processing efficiency. Among them, sharing at least the image data can reduce the memory occupation for the image data, and sharing at least the first processing algorithm can reduce the processing process of the second processing algorithm, that is, a part of the model of the algorithm can be shared, improving the processing efficiency of the second processing algorithm. In addition, the processing performances of the first processing algorithm and the second processing algorithm for the image are different, and the second processing algorithm directly reprocesses the first processing result of the first processing algorithm, so that the data processing can be performed by combining the processing performances of different processing algorithms, improving the accuracy of the second processing algorithm for obtaining the second processing result.
[0041] In some embodiments, please refer to Figure 2 , step S13 of the above embodiment can be further extended. This embodiment may include the following steps:
[0042] S131: Determine whether the second processing algorithm and the first processing algorithm share the processing result.
[0043] In some implementation manners, the second processing algorithm can have multiple configuration processing manners, such as sharing the processing result, not sharing the processing result, etc. It can be determined whether the second processing algorithm and the first processing algorithm share the processing result. Specifically, it can be detected whether the current algorithm library corresponding to the second processing algorithm is an algorithm library that shares the first processing result. For example, whether the algorithm library of object detection OD / object tracking OT is shared. If the algorithm library of object detection OD / object tracking OT is shared, it is determined that the processing result is shared, and there is no need to perform object detection OD / object tracking OT again.
[0044] In some embodiments, the first processing algorithm and the second processing algorithm may have at least partially the same processing type, that is, they can share some algorithms for image processing. Thus, the first processing algorithm and the second processing algorithm can share some processing results.
[0045] Optionally, in response to not sharing the processing results, determine that the shared data is image data, and perform the following step S132 and subsequent steps.
[0046] Optionally, in response to sharing the processing results, determine that the shared data is the first processing result, and perform the following step S134 and subsequent steps.
[0047] S132: Determine that the shared data is image data.
[0048] S133: Use the second processing algorithm to perform a first processing on the image data to obtain an intermediate processing result, and then perform a second processing on the intermediate processing result to obtain a second processing result.
[0049] Among them, the intermediate processing result and the first processing result satisfy the same processing type condition. For example, the same processing type condition may include that the processing processes corresponding to the intermediate processing result and the first processing result belong to the same processing type, and / or the intermediate processing result and the first processing result are processing results of the same processing type. The process of obtaining the intermediate processing result in the first processing of the second processing algorithm and the process of obtaining the first processing result in the first processing algorithm may be of the same processing type. For example, both the intermediate processing result / first processing result correspond to object detection OD / object tracking OT, and both represent the obtained object detection result / object tracking result.
[0050] In response to the shared data including image data, use the second processing algorithm to perform a first processing on the image data to obtain an intermediate processing result. For example, the intermediate processing result may represent an object detection result / object tracking result. Then, perform a second processing on the intermediate processing result to obtain a second processing result.
[0051] S134: Determine that the shared data is the first processing result.
[0052] S135: Use the second processing algorithm to perform a second processing on the first processing result to obtain a second processing result.
[0053] Among them, the above-mentioned intermediate processing result and the first processing result satisfy the same processing type condition. In response to the shared data including the first processing result, use the second processing algorithm to perform a second processing on the first processing result to obtain a second processing result.
[0054] In some embodiments, the processing process of the first processing algorithm for obtaining the first processing structure is the same as or similar to the first processing process of the second processing algorithm. This application does not limit this.
[0055] Exemplarily, taking the first processing algorithm including a perimeter processing algorithm and the second processing algorithm including a video structuring algorithm as an example, the shared processing result can be a shared object detection result / a shared object tracking result. If the processing results are not shared, the second processing algorithm needs to perform a first processing on the image data to perform object detection OD and object tracking OT to obtain an object detection result / an object tracking result, and then perform subsequent processing. If the processing results are shared, object detection OD and object tracking OT do not need to be performed, and the second processing can be directly performed, that is, the object detection result and the object tracking result of the perimeter processing algorithm can be directly used for subsequent processing. Among them, the second processing can include determining a preferred target. Exemplarily, in the second processing process, the video structuring algorithm performs a quality assessment on the image data based on the object detection result / the object tracking result, and then, based on the quality score, optimizes the target object to select the most suitable preferred target.
[0056] In some embodiments, in response to the shared data including image data and a first processing result, the second processing algorithm can be used to process the image data and the first processing result respectively to obtain second processing results respectively. Then, based on the second processing results corresponding to the image data and the first processing result, the final second processing result is obtained.
[0057] In some embodiments, for the above steps, in the case where the first processing result includes a plurality of first processing results, it can be determined whether the first processing algorithm and the second processing algorithm share at least one of the plurality of first processing results. In response to the shared processing result being to share at least one of the plurality of first processing results, the shared data can be determined as the first processing result shared among the plurality of first processing results. For example, the first processing result includes an object detection result and an object tracking result. It is determined whether the object detection result is shared, whether the object tracking result is shared, and whether the object detection result and the object tracking result are shared. If the object detection result is shared, object tracking is performed based on the object detection result and / or the image data to obtain an object tracking result, that is, an intermediate processing result, or the object detection result is used as the intermediate processing result to execute subsequent steps (that is, the second processing). Similarly, if the object tracking result is shared, the object tracking result is used as the intermediate processing result to execute subsequent steps. If the object detection result and the object tracking result are shared, the object detection result and / or the object tracking result are used as the intermediate processing result to execute subsequent steps.
[0058] In some embodiments, for image data including multiple frames of images or videos, the first processing algorithm can be used to process the image data of each frame in sequence, and then the common data (such as the first processing result) of each frame is sequentially passed to the second processing algorithm. Among them, the first processing algorithm can transfer the common data of one frame after processing one frame, or transfer the common data of a preset number of frames after the first processing algorithm has processed a preset number of frames, etc. Then, the second processing algorithm is used to process the first processing result to obtain a second processing result. For example, preferred targets, target images, etc. can be determined for multiple frames. The present application does not limit this.
[0059] In some embodiments, several other processing algorithms may also be included. For example, a third processing algorithm may also be included, and the present application does not limit the third processing algorithm. After the above steps, the common data can be passed to the third processing algorithm so that the third processing algorithm processes the common data to obtain a third processing result. Among them, this common data includes at least one of image data, the first processing result, and the second processing result. This process can refer to the process of the above embodiments, and the present application will not elaborate on this.
[0060] Taking the perimeter processing algorithm and the structuring algorithm as an example, the perimeter processing algorithm processes the image data, and then the common data of the perimeter processing algorithm is input into the video structuring algorithm through cascaded communication. The video structuring algorithm performs processes such as target detection, eigenvalue extraction, attribute extraction, and optimization on this common data. Among them, the video structuring algorithm and the perimeter processing algorithm share the same common data, so that their target detection results and target tracking results are the same. Using a shared target detection and target tracking model to implement the feature extraction of image data can not only make up for the problem of the small detection range of the video structuring algorithm, but also make up for the problem of the detection quality of the perimeter processing algorithm, improving the accuracy of data processing. In addition, the shared model can save half of the memory of the algorithm, further reducing the memory occupancy of data processing and improving the data processing efficiency.
[0061] In some embodiments, after the above steps, subsequent processing can also be performed, such as performing processing on the second processing result, back-end processing on the first processing result and / or the second processing result, etc. Specifically, reference can be made to the specific implementation process of the following embodiments.
[0062] Please refer to Figure 3 , Figure 3 which is a schematic flowchart of the second embodiment of the data processing method of the present application. The method may include the following steps:
[0063] S21: Obtain a target processing result based on the second processing result and / or the second processing result.
[0064] Optionally, a target processing result may be obtained based on the first processing result and / or the second processing result. For example, the target processing result may be obtained by synthesizing the first processing result and the second processing result. For example, the first processing result or the second processing result may be used as the target processing result respectively.
[0065] Taking the case of obtaining the target processing result based on the second processing result in this application, the second processing result may be used as the target processing result for subsequent processing.
[0066] S22: Extract the features of the target processing result to obtain feature information.
[0067] Feature extraction may be performed on the target processing result to obtain feature information, where the feature information may include information such as the features and attributes of the target object. Optionally, this step may be executed by a second processing algorithm or the backend, etc., and this application places no restrictions thereon.
[0068] After the video structuring algorithm performs feature extraction, the output preferred target and feature information may be parsed. The video structuring algorithm reports the feature information and / or the preferred target to a preset application, and the preset application packages the feature information and / or the preferred target, and then reports the packaged data to a preset platform (such as a backend platform).
[0069] S23: Use the feature information to perform a search in a preset video to obtain a target search result.
[0070] Precise search may be performed using the feature information. For example, the feature information (such as features and attributes) is used to perform a search in a preset video to obtain a target search result. Among them, the preset video may be video images stored in the backend platform, and preset search conditions may be set, and then the feature information is searched, and finally the target detection result is obtained. The target detection result may include a target video segment and / or a target image, etc., and thus the image frame in which the target object appears may be retrieved, and the target object may be quickly retrieved.
[0071] In some embodiments, this application may also set a reference count for shared data to manage the release of shared data. Data transmission is performed between different processing algorithms. For details, reference may be made to the implementation process of the following embodiments.
[0072] Please refer to Figure 4 , Figure 4 which is a schematic flowchart of the third embodiment of the data processing method of this application. The method may include the following steps:
[0073] S31: Set the reference count of the shared data; where the shared data includes at least image data, and the reference count includes the reference situation of the corresponding first processing algorithm and / or the second processing algorithm to the shared data.
[0074] The reference count of the shared data can be set. The shared data includes image data and / or the first processing result. In this application, taking the shared data including at least image data as an example for illustration, the reference situations of each processing algorithm to the shared data can be counted respectively. Among them, the reference count includes the reference situations of the corresponding first processing algorithm and / or the second processing algorithm to the shared data. Exemplarily, taking image data as an example for illustration, optionally, when the first processing algorithm / second processing algorithm receives the image data, that is, references the image data, the reference count corresponding to the first processing algorithm / second processing algorithm of the image data is incremented by one. If the first processing algorithm / second processing algorithm finishes processing, the reference count corresponding to the first processing algorithm / second processing algorithm of the image data is decremented by one. Optionally, after the first processing algorithm finishes processing, when the second processing algorithm references the image data, the reference counts corresponding to the first processing algorithm and the second processing algorithm of the image data are incremented by one respectively. If the second processing algorithm finishes processing, the reference counts corresponding to the first processing algorithm and the second processing algorithm of the image data are decremented by one respectively. This application can count the image data in the form of double reference counts to respectively count the reference counts corresponding to the first processing algorithm and the second processing algorithm. This application does not limit the form of the reference count.
[0075] S32: Based on the reference count of the shared data, perform a release process on the shared data corresponding to the first processing algorithm and / or the second processing algorithm.
[0076] Based on the reference count of the shared data, the shared data corresponding to the first processing algorithm and / or the second processing algorithm can be released. For example, the initial value of the reference count of the shared data is 0. If the reference counts of the shared data corresponding to the first processing algorithm and the second processing algorithm are both 0, the shared data can be released, that is, the memory of the shared data can be released.
[0077] In some embodiments, taking image data as an example, the image data is passed to the first processing algorithm, and the reference count corresponding to the first processing algorithm of the image data is incremented by one. Then, the first processing algorithm is used to process the image data to obtain the first processing result.
[0078] In some embodiments, after processing the image data using the first processing algorithm to obtain the first processing result, the shared data is passed to the second processing algorithm, where the shared data includes the image data and / or the first processing data, and the shared data is transmitted in a preset image format (such as the YUV format). Optionally, the shared data includes at least the image data. After the first processing algorithm finishes passing, the reference count of the image data corresponding to the first processing algorithm can be incremented by one (optional), and the reference count of the image data corresponding to the second processing algorithm can be incremented by one. Exemplarily, after the first processing algorithm finishes transmitting, the reference count of the image data corresponding to the first processing algorithm can be incremented by one. When the second processing algorithm receives the image data, the reference count of the image data corresponding to the second processing algorithm is incremented by one. At this time, the reference count of the image data corresponding to the first processing algorithm is 2, and the image data will not be released.
[0079] In some embodiments, after the first processing algorithm passes the shared data to the second processing algorithm, the first processing algorithm can continue to perform subsequent processing. After the subsequent processing is completed, the reference count of the shared data (such as the image data) corresponding to the first processing algorithm is decremented by one. For example, if the subsequent processing includes image cropping, the image can be cropped based on the first processing result to obtain a preset rule event and reported to a preset platform. Exemplarily, the video module (VSF) can be notified to perform non-real-time cropping. Non-real-time cropping is to obtain the coordinate frame of the target object of the preset rule event from all the image data within a preset duration (such as 1 ms), then map it on a picture to obtain the image of the preset rule event, and then report it. This can be applied to the perimeter processing algorithm to detect the preset rule event. After the first processing algorithm finishes performing the image cropping, the reference count of the image data corresponding to the first processing algorithm is decremented by one. At this time, the reference count of the image data corresponding to the first processing algorithm is 1, and the image data has not been released yet.
[0080] In some embodiments, after the second processing algorithm finishes processing, in response to the completion of processing using the second processing algorithm, the reference count of the image data corresponding to the second processing algorithm can be decremented by one; and the reference count of the image data corresponding to the first processing algorithm can be decremented by one.
[0081] In some embodiments, for the first processing algorithm and the second processing algorithm, a cascaded communication method is used for data transfer between the first processing algorithm and the second processing algorithm. Specifically, after the first processing algorithm finishes processing, the first processing algorithm extracts the first processing result and sends an online message to the second processing algorithm. If the second processing algorithm receives the online message, it will send a confirmation message of the online message to the first processing algorithm. Then, the first processing algorithm can pass the shared data to the second processing algorithm, where the shared data includes the image data and / or the first processing result.
[0082] Exemplarily, image data can be passed to the first processing algorithm, a handle of the first algorithm can be created, and the reference count of the image data corresponding to the first processing algorithm can be incremented by one, so that the image data corresponding to the first processing algorithm is not released. A perimeter processing algorithm handle can be created, and the reference count of the image data corresponding to the perimeter processing algorithm can be incremented by one, so that the image data is not released by the video module. A video structuring algorithm can be created and the video structuring algorithm can be initialized intelligently. After step S12, the image data / first processing result is sent to the video structuring algorithm, and the reference counts of the image data corresponding to the perimeter processing algorithm and the video structuring algorithm are incremented by one respectively. At this time, the perimeter reference count is 2, and the perimeter processing algorithm can continue with subsequent image cropping and other processing. After the processing is completed, the reference count of the image data corresponding to the perimeter processing algorithm is decremented by one. After the video structuring algorithm finishes processing, the reference counts of the image data corresponding to the perimeter processing algorithm and the video structuring algorithm are decremented by one respectively, and then the image data can be released.
[0083] It can be understood that in the above method of the specific implementation manner, the writing order of each step does not mean a strict execution order that constitutes any limitation to the implementation process, and the specific execution order of each step should be determined by its function and possible internal logic.
[0084] In some embodiments, the present application further provides a data processing system for implementing the data processing method of any of the above embodiments.
[0085] Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of an embodiment of the data processing system of the present application. The data processing system 40 may include a video module 41, a first processing module 42, a second processing module 43, a cascaded communication module 44, a shared management module 45, etc.
[0086] Among them, the video module 41 is used to acquire image data and perform processing such as caching the image data. The first processing module 42 is used to implement the corresponding execution steps of the first processing algorithm to process the image data using the first processing algorithm to obtain a first processing result. The second processing module 43 is used to implement the corresponding execution steps of the second processing algorithm to process the shared data using the second processing algorithm to obtain a second processing result.
[0087] The cascaded communication module 44 is used to implement data transmission between the first processing module 42 and the second processing module 43 (i.e., the first processing algorithm and the second processing algorithm) in a cascaded communication manner. Specifically, the cascaded communication module 44 can be divided into multiple sub-modules: an online module, a shared data sending module, a shared data management module, a shared data release module, etc. Among them, the shared data includes, for example, the first processing result and / or image data. The online module is used to control the online operation of the first processing module 42 and / or the second processing module 43. The shared data sending module is used to send the shared data to transfer the shared data between the first processing module 42 and the second processing module 43. The shared data management module is used to manage the shared data and determine the sending method of the shared data, such as shared memory or separate memory, etc. The shared data release module is used to implement the information transfer of releasing the shared data. Optionally, the cascaded communication module 44 may further include the following sub-modules: a shared data parsing module, a communication module, an information sending module, a parsing and release module, etc. Among them, the shared data parsing module is used to parse the shared data for the transfer of the shared data. The communication module is used to perform cascaded communication between the processing algorithms. The information sending module is used to send other data or information, such as information related to preset rule events, etc. The parsing and release module is used to parse the parsing-related information corresponding to each processing algorithm. For example, the reference count corresponding to the second processing algorithm is decremented by one. At this time, if it is 0, the shared data is released, and the relevant information is sent to the parsing and release module. The parsing and release module parses the reference count and decrements the reference count of the first processing algorithm by one. If it is 0 at this time, the first processing algorithm is notified to release the shared data. This application places no restrictions on the cascaded communication module. Using the cascaded communication module 44 to communicate between different processing algorithms makes it more convenient for data interaction.
[0088] The shared management module 45 is used to manage shared data. The shared management module 45 may include multiple sub-modules: a memory management module, a double reference counting management module, a reference counting release module, a cache module, a registration callback module, etc. Among them, the memory management module is created for a memory pool and is used to manage each storage block of the memory pool. The memory pool may include multiple storage blocks, and each storage block may be used to store a frame of image data, etc. The double reference counting management module is used to manage the reference counting of the shared data corresponding to the first processing algorithm and the second processing algorithm respectively. The reference counting release module is used to perform a callback on the processing algorithm according to the registration callback module, such as decrementing or incrementing the reference count, etc., so as to release the image data cached in the storage block when the reference count is 0. The cache module includes multiple storage blocks of several storage pools, and each storage block can be used to store a frame of image data, etc. The registration callback module is used to perform an algorithm callback between the various processing algorithms. This application places no restrictions on the shared management module. Using the shared management module 45 can better manage the release of shared data at an appropriate time point, preventing the system from affecting feature extraction due to the premature release of shared data, thereby affecting the results of accurate retrieval.
[0089] It should be noted that the data processing system provided in the above embodiment and the data processing method provided in the above embodiment belong to the same concept. The specific manners in which each module and unit perform operations have been described in detail in the method embodiment, and will not be elaborated here. In practical applications, the data processing system provided in the above embodiment may, according to needs, allocate the above functions to different functional modules, that is, divide the internal structure of the system into different functional modules to complete all or part of the functions described above. This application places no restrictions on this.
[0090] It can be understood that the data processing method in this application can be executed by a computer device, and the computer device can be any device with processing capabilities, such as a mobile device, a computer, a server, etc. This application places no restrictions on this. In some possible implementation manners, the data processing method can be implemented by the processor calling the program data stored in the memory.
[0091] For the above embodiment, this application provides a computer device. Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of an embodiment of the computer device of this application. The computer device 50 includes a memory 51 and a processor 52. Among them, the memory 51 and the processor 52 are mutually coupled, the memory 51 stores program data, and the processor 52 is used to execute the program data to implement the steps of any embodiment of the above data processing method.
[0092] In this embodiment, the processor 52 may also be referred to as a CPU (Central Processing Unit). The processor 52 may be an integrated circuit chip with signal processing capabilities. The processor 52 may also be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processing), an application-specific integrated circuit (ASIC, Application Specific Integrated Circuit), a field-programmable gate array (FPGA, Field Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor 52 may also be any conventional processor, etc.
[0093] For the method of the above embodiment, it can be implemented in the form of a computer program. Therefore, the present application proposes a computer-readable storage medium. Please refer to Figure 7 , Figure 7 is a schematic structural diagram of an embodiment of the computer-readable storage medium of the present application. The computer-readable storage medium 60 stores program data 61 that can be run by a processor. The program data 61 can be executed by the processor to implement the steps of any embodiment of the above data processing method.
[0094] The computer-readable storage medium 60 of this embodiment may be a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc, etc., which can store the program data 61, or it may also be a server storing the program data 61. The server can send the stored program data 61 to other devices for running, or it can also run the stored program data 61 by itself.
[0095] In some embodiments, the functions or modules included in the device provided in the above embodiments of the present application can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, the present application will not repeat it here.
[0096] The above descriptions of the various embodiments tend to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to each other. For the sake of brevity, the present application will not repeat it here.
[0097] In several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.
[0098] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0099] In addition, in each embodiment of this application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0100] If the integrated unit 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, which is a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in each embodiment of this application.
[0101] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of this application can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented with program codes executable by the computing device. Thus, they can be stored in a computer-readable storage medium and executed by the computing device, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, this application is not limited to any specific combination of hardware and software.
[0102] The above are only embodiments of the present application, and do not thereby limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall equally be included within the patent protection scope of the present application.
Claims
1. A data processing method, characterized in that, Including: Obtain image data; Process the image data using a first processing algorithm to obtain a first processing result; Process shared data using a second processing algorithm to obtain a second processing result; wherein, the shared data includes image data and / or the first processing result, and the first processing algorithm and the second processing algorithm have different processing performances for images.
2. The method according to claim 1, wherein Before the step of processing the shared data using the second processing algorithm to obtain a second processing result, it includes: Determine whether the second processing algorithm shares a processing result with the first processing algorithm; In response to sharing the processing result, determine that the shared data is the first processing result; or, in response to not sharing the processing result, determine that the shared data is the image data.
3. The method according to claim 2, wherein The first processing result includes a plurality of first processing results; The step of, in response to sharing the processing result, determining that the shared data is the first processing result, includes: In response to sharing at least one of the plurality of first processing results, determine that the shared data is the first processing result shared among the plurality of first processing results.
4. The method according to claim 1, wherein The step of processing the shared data using the second processing algorithm to obtain a second processing result includes: In response to the shared data including image data, perform a first processing on the image data using the second processing algorithm to obtain an intermediate processing result; and, Perform a second processing on the intermediate processing result to obtain a second processing result.
5. The method according to claim 1 or 4, wherein The intermediate processing result and the first processing result satisfy the same processing type condition; And / or, the step of processing the shared data using the second processing algorithm to obtain a second processing result includes: In response to the shared data including the first processing result, perform a second processing on the first processing result using the second processing algorithm to obtain a second processing result; Or, in response to the shared data including the image data and the first processing result, synthesize the second processing results corresponding to the image data and the first processing result to obtain a final second processing result.
6. The method according to claim 1, wherein It further includes: Set a reference count for the shared data; wherein, the shared data at least includes image data, and the reference count includes the reference situation of the corresponding first processing algorithm and / or the second processing algorithm to the shared data; and / or, Based on the reference count of the shared data, perform a release process on the shared data corresponding to the first processing algorithm and / or the second processing algorithm.
7. The method according to claim 6, wherein A cascaded communication method is adopted for data transfer between the first processing algorithm and the second processing algorithm; And / or, before the step of processing the image data using the first processing algorithm to obtain a first processing result, it includes: transfer the image data to the first processing algorithm; The step of setting the reference count for the shared data includes: incrementing the reference count of the first processing algorithm corresponding to the image data by one; And / or, after processing the image data using the first processing algorithm to obtain a first processing result, it includes: passing the shared data to a second processing algorithm; wherein, the shared data at least includes image data; Setting the reference count of the shared data includes: incrementing the reference count of the image data corresponding to the first processing algorithm by one, and incrementing the reference count of the image data corresponding to the second processing algorithm by one; And / or, setting the reference count of the shared data includes: in response to the completion of processing using the second processing algorithm, decrementing the reference count of the image data corresponding to the second processing algorithm by one; and decrementing the reference count of the image data corresponding to the first processing algorithm by one.
8. The method according to claim 1, wherein It further includes: Obtaining a target processing result based on the first processing result and / or the second processing result; Extracting the features of the target processing result to obtain feature information; Using the feature information to perform a search in a preset video to obtain a target search result.
9. A computer device, characterized in that, It includes a memory and a processor that are mutually coupled, and program data is stored in the memory, and the processor is configured to execute the program data to implement the steps of the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, There is program data that can be run by a processor, and the program data is used to implement the steps of the method according to any one of claims 1 to 8.