Object processing method, apparatus, and electronic device

By acquiring load information during the process of the electronic device processing the first object, the problem of inefficiency in the electronic device when processing multiple objects is solved, and faster processing time and higher efficiency are achieved.

CN114860447BActive Publication Date: 2025-07-18GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210524566.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2025-07-18
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

In the prior art, when electronic devices process multiple objects, the processing efficiency is low, and usually the sequential processing results in a longer overall time.

Method used

In the process of processing the first object, the load information of the electronic device is obtained, and when processing resources are available, the second object sorted in parallel is processed.

Benefits of technology

Through parallel processing, the total processing time of multiple objects is shortened and the processing efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860447B_ABST
    Figure CN114860447B_ABST
Patent Text Reader

Abstract

An embodiment of the present application discloses an object processing method, apparatus, and electronic device. The method includes: during the process of processing a first object, obtaining the load information of the electronic device; if the load information indicates that the electronic device has available processing resources, processing a second object in parallel, where the second object is an object to be processed after the first object. Thus, through the above method, during the process of processing an object to be processed first (for example, the first object), the object to be processed originally later (for example, the second object) can be processed in parallel when the electronic device still has processing resources, thereby effectively shortening the processing time of the process of processing multiple objects and improving the object processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more particularly, to an object processing method, apparatus, and electronic device. Background Art

[0002] With the progress and development of technology, electronic devices have increasingly powerful computing and storage capabilities, capable of supporting complex calculations for objects to be processed. For example, an electronic device can perform computational processing on objects to be processed such as images or texts obtained by the electronic device to obtain desired improvements, such as improving the imaging quality of objects to be processed such as images or texts, and performing recognition and extraction on objects to be processed such as images or texts. When an electronic device performs computational processing on an object to be processed, there is still room for improvement in processing efficiency. Summary of the Invention

[0003] In view of the above problems, this application proposes an object processing method, apparatus, and electronic device to address the above issues.

[0004] In a first aspect, this application provides an object processing method applied to an electronic device. The method includes: during the process of processing a first object, obtaining the load information of the electronic device; if the load information indicates that the electronic device has available processing resources, processing a second object in parallel, where the second object is an object to be processed after the first object.

[0005] In a second aspect, this application provides an object processing apparatus running on an electronic device. The apparatus includes: a load information obtaining unit for obtaining the load information of the electronic device during the process of processing a first object; an object processing unit for processing a second object in parallel if the load information indicates that the electronic device has available processing resources, where the second object is an object to be processed after the first object.

[0006] In a third aspect, this application provides an electronic device including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above method.

[0007] In a fourth aspect, this application provides a computer-readable storage medium storing program code, where the above method is executed when the program code runs.

[0008] An object processing method, apparatus, and electronic device provided by this application can obtain the load information of the electronic device during the process of processing a first object, and when the load information indicates that there are available processing resources on the electronic device, process a second object that is to be processed after the first object in parallel. In this way, during the process of processing an object to be processed earlier (for example, the first object), it is possible to process an object that was originally to be processed later (for example, the second object) in parallel when the electronic device still has processing resources, thereby effectively shortening the processing time for processing multiple objects and improving the object processing efficiency. Description of the Drawings

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for description in the embodiments. Obviously, the drawings in the following description are only some embodiments of this application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0010] Figure 1 Fig. shows a schematic diagram of an application scenario of the object processing method proposed by this application;

[0011] Figure 2 Fig. shows another schematic diagram of an application scenario of the object processing method proposed by this application;

[0012] Figure 3 Fig. shows a flowchart of an object processing method proposed by an embodiment of this application;

[0013] Figure 4 Fig. shows a schematic diagram of multiple objects to be processed in an embodiment of this application;

[0014] Figure 5 Fig. shows a flowchart of an object processing method proposed by another embodiment of this application;

[0015] Figure 6 Fig. shows a schematic diagram of the time taken to process multiple objects in parallel in an embodiment of this application;

[0016] Figure 7 Fig. shows a schematic diagram of multiple second objects processed in parallel in an embodiment of this application;

[0017] Figure 8 Fig. shows a flowchart of an object processing method proposed by yet another embodiment of this application;

[0018] Figure 9 Fig. shows a schematic diagram of multiple threads cooperating to execute an object processing method in an embodiment of this application;

[0019] Figure 10 The flowchart of an object processing method proposed by another embodiment of the present application is shown;

[0020] Figure 11 The structural block diagram of an object processing device proposed by an embodiment of the present application is shown;

[0021] Figure 12 The structural block diagram of an electronic device proposed by the present application is shown;

[0022] Figure 13 It is a storage unit for storing or carrying program codes for implementing the object processing method according to the embodiments of the present application. Detailed implementation manners

[0023] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present application.

[0024] During the operation of the electronic device, various objects can be obtained. For example, an object of text type can be obtained, or an object of image type can be obtained. In some cases, the electronic device will process the obtained object through an algorithm and then perform subsequent operations on the processed object. For example, during the process of taking a photo, for the image directly collected by the camera, it can be processed through multiple algorithms and then the image after being processed through multiple algorithms is displayed to the user and stored.

[0025] However, the inventors found in the research that there is still a problem that the efficiency needs to be improved in the process of processing multiple objects in the related art. For example, in the related processing process, usually multiple objects are processed in sequence based on the processing order of the multiple objects. In this case, the processing of the subsequent object will start only after the processing of the previous object is completed, which will result in a relatively long overall processing time.

[0026] Therefore, the inventors propose an object processing method, apparatus, and electronic device in the present application. During the process of processing a first object, the load information of the electronic device can be obtained, and when the load information indicates that the electronic device has available processing resources, the second object to be processed after the first object can be processed in parallel. Thus, through the above method, during the process of processing the object to be processed first (for example, the first object), when the electronic device still has processing resources, the object to be processed originally later (for example, the second object) can be processed in parallel, thereby effectively shortening the processing time of the process of processing multiple objects and improving the object processing efficiency.

[0027] First, the application scenarios involved in the embodiments of the present application will be introduced below.

[0028] In the embodiments of the present application, the provided object processing method can be executed by an electronic device. In this manner of being executed by an electronic device, all steps in the object processing method provided in the embodiments of the present application can be executed by the electronic device. For example, as Figure 1 shown, when all steps in the object processing method provided in the embodiments of the present application can be executed by the electronic device, all steps can be executed by the processor of the electronic device 100. Furthermore, the object processing method provided in the embodiments of the present application can also be executed by a server.

[0029] In addition, the object processing method provided in the embodiments of the present application can also be executed collaboratively by an electronic device and a server. In this manner of being executed collaboratively by an electronic device and a server, some steps in the object processing method provided in the embodiments of the present application are executed by the electronic device, while other steps are executed by the server. Exemplarily, as Figure 2 shown, the electronic device 100 can execute the following steps included in the object processing method: obtain the object to be processed, and send the object to be processed (for example, including the first object and the second object) to the server, and then the server 200 executes obtaining the load information of the server during the process of processing the first object. If the load information indicates that the server has available processing resources, process the second object in parallel, and then return the processed object to the electronic device 100.

[0030] It should be noted that in this manner of being executed collaboratively by an electronic device and a server, the steps respectively executed by the electronic device and the server are not limited to the manner introduced in the above example. In actual applications, the steps respectively executed by the electronic device and the server can be dynamically adjusted according to the actual situation.

[0031] It should be noted that the electronic device 100 in addition to being Figure 1 and Figure 2In addition to the smart phone shown, it can also be devices such as tablet computers, smart watches, smart voice assistants, and drones. The server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. In the case where the object processing method provided in the embodiments of the present application is executed by a server cluster or distributed system composed of multiple physical servers, different steps in the object processing method can be executed by different physical servers respectively, or can be executed in a distributed manner by a server built based on the distributed system.

[0032] Please refer to Figure 3 , an object processing method provided by the present application is applied to an electronic device. The method includes:

[0033] S110: During the process of processing the first object, obtain the load information of the electronic device.

[0034] In the embodiments of the present application, multiple objects can be processed during the running of the object processing method. For example, in a video capture scenario, the video captured by the electronic device can be understood as continuously capturing multiple frames of images. Then, these multiple frames of images can be understood as multiple objects to be processed by the object processing method, where each frame of image can be used as an object. Another example is in a photo-taking scenario. The user may continuously trigger the photo-taking operation multiple times, causing the camera to continuously capture multiple frames of pictures within a period of time (for example, 1 second). Then, these multiple frames of pictures can be understood as multiple objects to be processed by the object processing method, where each picture can be used as an object. Furthermore, it should be noted that in a photo-taking scenario, when the user triggers the photo-taking operation each time, the camera can continuously capture multiple frames of pictures. In this case, the multiple frames of pictures captured during each photo-taking process can be used as an object. In this case, each of the multiple objects to be processed includes multiple frames of pictures. For example, the first object in the embodiments of the present application can include the multiple frames of pictures captured when the user first triggers the photo-taking operation, and the subsequent second object can include the multiple frames of pictures captured when the user second triggers the photo-taking operation.

[0035] Moreover, each of the multiple objects corresponds to a processing order. For example, in a video capture scenario, the processing order corresponding to each frame of image can be determined according to the capture order of the image frames, that is, the earlier the capture time of the image frame, the earlier the corresponding processing order. In the embodiments of the present application, the first object is the processing object with a previous processing order, and the second object is the processing object with a processing order after the first object. Exemplarily, such as Figure 4As shown, the multiple objects to be processed include Picture 11, Picture 12, Picture 13, Picture 14, and Picture 15. Among them, Picture 11 is the picture collected first, and Picture 15 is the picture collected last. In this case, the first object can be Picture 11, and correspondingly, the second object can be Picture 12. Furthermore, the first object can be Picture 11, and the second object can be Picture 13. Furthermore, the first object can be Picture 12, and the second object can be Picture 13.

[0036] In the embodiments of the present application, the load information of the electronic device is used to characterize the current load situation of the electronic device, and this load situation specifically characterizes the currently available processing resources of the electronic device. Optionally, the currently available processing resources of the electronic device may include the occupancy degree of the processor device used for object processing in the electronic device. Among them, the higher the occupancy degree, the fewer the currently available processing resources of the electronic device. For example, if the load information characterizes that the current occupancy degree of the processor device is 100%, it means that the processor device currently has no available processing resources, and further means that the electronic device currently has no available processing resources. If the load information characterizes that the current occupancy degree of the processor device is less than 100%, it means that the processor device still has available processing resources, and further means that the electronic device has available processing resources.

[0037] It should be noted that in the embodiments of the present application, the objects to be processed can be not only images (pictures or videos), but also texts or audios. The specific type of the object can be determined according to the scenario to which the object processing method is applied.

[0038] Among them, as a way, the electronic device can periodically detect the load information of the electronic device and record the detected load information. In this case, during the process of processing the first object, the obtained load information can be directly reading the latest recorded load information, thereby improving the efficiency of obtaining the load information. Optionally, the electronic device can directly store the detected load information into a specified file when detecting the load information, then during the process of processing the object (the first object), the load information of the electronic device can be directly obtained by reading this specified file.

[0039] S120: If the load information characterizes that the electronic device has available processing resources, process the second object in parallel.

[0040] Among them, the fact that the electronic device has available processing resources can be understood as that in addition to the processing resources already used for running the current processing tasks (such as tasks for processing objects or running application programs, etc.), there are other idle processing resources. Then, when the electronic device has available processing resources, it means that the current processor of the electronic device can also synchronously process other content. Furthermore, in order to further improve the utilization rate of the processing resources of the electronic device, the second object that was originally scheduled to be processed after the first object can be processed in parallel, so that the electronic device can synchronously process the first object and the second object.

[0041] It should be noted that in the embodiments of the present application, the number of multiple objects to be processed can be two, three, or even more. In this case, if the electronic device still has available processing resources, more objects can be processed synchronously. Optionally, after the electronic device determines to start processing an object, the load information of the electronic device can be obtained again. If the load information indicates that the electronic device still has available processing resources, the processing object that is sorted after the processing object being processed is obtained for processing. For example, as a way, if the load information indicates that the electronic device has available processing resources, after processing the second object in parallel, it further includes: if the load information of the electronic device indicates that the electronic device has available processing resources, the third object is processed in parallel, and the third object is the object to be processed after the second object.

[0042] Exemplarily, please refer to again Figure 4 , if the first object is Picture 11, then during the process of processing Picture 11, when it is determined that the electronic device has available processing resources, Picture 12 that is sorted after Picture 11 can be processed in parallel. After it is determined to start processing Picture 12, when it is determined that the electronic device still has available processing resources, Picture 13 can be processed in parallel. After it is determined to start processing Picture 13, if it is determined that the electronic device has no available processing resources, starting to process Picture 14 will not be triggered again, but wait until there are available processing resources and then start to process Picture 14.

[0043] In an embodiment of the present application, when multiple objects can be processed in parallel, an upper limit on the number of objects processed in parallel can also be configured. In this case, when it is determined that the load information indicates available processing resources, the number of objects currently being processed in parallel can be further determined. If the number of objects currently being processed in parallel does not reach the upper limit, parallel processing of subsequent objects can be triggered. For example, after parallel processing of the second object, if it is determined that the load information indicates that the electronic device has available processing resources, it can first be determined whether the number of objects currently being processed in parallel reaches the upper limit. If it does not reach the upper limit, then the third object can be processed in parallel.

[0044] In an embodiment of the present application, as a method, corresponding threads can be separately configured for different processing objects to enable parallel processing of multiple processing objects. As a method, during the process of processing the first object, obtaining the load information of the electronic device may include: during the process of processing the first object through the first thread, obtaining the load information of the electronic device obtained through the second thread. Correspondingly, if the load information indicates that the electronic device has available processing resources, parallel processing of the second object may include: if the load information indicates that the electronic device has available processing resources, processing the second object in parallel through the third thread.

[0045] An object processing method provided in this embodiment can obtain the load information of the electronic device again during the process of processing the first object, and when the load information indicates that the electronic device has available processing resources, process the second object to be processed after the first object in parallel. Thus, through the above method, during the process of processing the object to be processed first (for example, the first object), the object to be processed originally later (for example, the second object) can be processed in parallel when the electronic device still has processing resources, thereby effectively shortening the processing time of the process of processing multiple objects and improving the object processing efficiency.

[0046] Please refer to Figure 5 , an object processing method provided in the present application, which is applied to an electronic device, and the method includes:

[0047] S210: During the process of processing the first object, obtain the load information of the electronic device.

[0048] S220: If the load information indicates that the electronic device has available processing resources, obtain the preset processing algorithm with the earliest processing timing from the multiple preset processing algorithms corresponding to the second object.

[0049] Among them, in the embodiments of the present application, the multiple preset processing algorithms corresponding to an object (for example, the first object, the second object, or the third object) can be understood as multiple preset processing algorithms for sequentially processing the object. Among them, the multiple preset processing algorithms corresponding to the object can be understood as algorithms that all need to be used to process the object. It should be noted that when the multiple preset processing algorithms are used to process the object, it can be understood as being used to directly process the object and to process the intermediate processing result data obtained after the object is processed by a certain preset processing algorithm. Exemplarily, the multiple preset processing algorithms corresponding to the second object include preset processing algorithm A, preset processing algorithm B1, preset processing algorithm B2, and preset processing algorithm C. Among them, preset processing algorithm a1 is used to directly process the second object, preset processing algorithm B1 is used to process the intermediate result data obtained by preset processing algorithm A processing the object, and preset processing algorithm B2 is also used to process the intermediate result data obtained by preset processing algorithm A processing the object. The intermediate result data output after the execution of preset processing algorithm B1 is object X1, and the intermediate result data output after the execution of preset processing algorithm B2 is data X2. Preset processing algorithm C can then process object X1 based on data X2 to obtain the final object. From this example, it can be seen that among the multiple preset processing algorithms corresponding to the object, some preset processing algorithms directly process the object, while some algorithms process the intermediate data during the processing.

[0050] In the embodiments of the present application, the multiple preset processing algorithms corresponding to the object can be obtained by splitting the multiple initial algorithms corresponding to the object. Among them, the execution order of the multiple initial algorithms corresponding to the object is serial execution. Then, during the execution of the multiple initial algorithms, there will be no situation where multiple initial algorithms are executed in parallel. For example, the multiple initial algorithms corresponding to the object include initial algorithm A, initial algorithm B, and initial algorithm C. Among them, initial algorithm A can be executed first, and after the execution of initial algorithm A is completed, initial algorithm B starts to be executed. After the execution of initial algorithm B is completed, initial algorithm C starts to be executed. Based on this example, it can be seen that in the case of serial execution of the multiple initial algorithms, the overall processing time of the object is equal to the sum of the processing times of each processing algorithm.

[0051] Among them, the initial algorithm as a whole may be composed of multiple sub-algorithms. The inventor found in the research that among the multiple initial algorithms corresponding to an object, some sub-algorithms in some of the later-executed initial algorithms can actually be executed much earlier, rather than being limited to starting execution according to the execution timing sequence of the belonging initial algorithm. It should be noted that, as a way, it is possible to determine whether an algorithm starts to run based on the data on which the algorithm depends. Among them, the data on which the algorithm depends can be understood as the data processed during the running of the algorithm, or can be regarded as the data that needs to be input into the algorithm.

[0052] Exemplarily, among the initial algorithm A, initial algorithm B, and initial algorithm C corresponding to an object, initial algorithm B includes sub-algorithm B1 and sub-algorithm B2. Among them, sub-algorithm B1 is used to directly process the data output by initial algorithm A, and sub-algorithm B2 is used to extract information from the data output by initial algorithm A. However, the information that sub-algorithm B2 needs to extract during operation can actually be directly extracted from the object. That is to say, the data on which sub-algorithm B2 depends during operation can actually be the object, and thus sub-algorithm B2 can actually run in parallel with initial algorithm A. Then based on this principle, for each initial algorithm corresponding to an object, it is possible to detect whether it can be split respectively based on the data on which the algorithm depends. For the initial algorithms that can be split, they can be split based on the data on which the algorithm depends, thereby completing the splitting of multiple initial algorithms to obtain multiple algorithms during the actual processing of the object. For example, if the multiple initial algorithms corresponding to an object are initial algorithm A, initial algorithm B, and initial algorithm C, after detecting initial algorithm A, initial algorithm B, and initial algorithm C respectively based on the data on which the algorithm depends, it is determined that initial algorithm B can be split into sub-algorithm B1 and sub-algorithm B2. Then after splitting the multiple initial algorithms corresponding to the object, the multiple preset processing algorithms corresponding to the object obtained include initial algorithm A, sub-algorithm B1, sub-algorithm B2, and initial algorithm C.

[0053] As shown in the foregoing content, the multiple preset processing algorithms corresponding to the second object are used to directly process the second object or the intermediate result data, and each of the multiple preset processing algorithms corresponds to a processing timing sequence. The processing timing sequences corresponding to the multiple preset processing algorithms represent the respective sequence of precedence of the multiple presets. For example, the multiple preset processing algorithms corresponding to the second object include algorithm A, algorithm B, algorithm C, and algorithm D. Among them, the processing timing sequence corresponding to algorithm A is the first, the processing timing sequence corresponding to algorithm B is the second, the processing timing sequence corresponding to algorithm C is the third, and the processing timing sequence corresponding to algorithm B is the fourth. In this case, the preset processing algorithm with the earliest obtained processing timing sequence is algorithm A.

[0054] Furthermore, it should be noted that in one case, during the process of processing the first object, when the load information of the electronic device is obtained to represent available processing resources, the second object may have already been processed by one or more corresponding preset processing algorithms (for example, processed by other devices outside the electronic device based on the one or more preset processing algorithms). In this case, the preset processing algorithm with the earliest processing sequence and not yet run will be obtained from the multiple preset processing algorithms corresponding to the second object. Exemplarily, the multiple preset processing algorithms corresponding to the second object include Algorithm A, Algorithm B, Algorithm C, and Algorithm D, and the processing sequence of Algorithm A is the earliest, and the processing sequence of Algorithm D is the latest. If, during the process of processing the first object, when the load information of the electronic device is obtained to represent available processing resources, and if none of the multiple preset processing algorithms of the second object have been run, the obtained preset processing algorithm with the earliest processing sequence is Algorithm A. If Algorithm A and Algorithm B among the multiple preset processing algorithms of the second object have already been used to process the second object, the obtained preset processing algorithm with the earliest processing sequence is Algorithm C.

[0055] S230: Trigger parallel processing of the second object based on the preset processing algorithm with the earliest processing sequence.

[0056] Among them, triggering parallel processing of the second object based on the preset processing algorithm with the earliest processing sequence includes: starting to process the second object based on the preset processing algorithm with the earliest processing sequence;

[0057] In response to the completion of the operation of the preset processing algorithm with the earliest processing sequence, obtain the processing algorithm after the preset processing algorithm with the earliest processing sequence for operation until all the multiple preset processing algorithms are completed. As a way, each object processed by the object processing method provided by the embodiments of the present application will be processed by multiple preset processing algorithms respectively. In this way, during the process of processing the first object, obtaining the load information of the electronic device includes: during the process of processing the first object based on the multiple preset processing algorithms corresponding to the first object, obtaining the load information of the electronic device; among them, the multiple preset processing algorithms corresponding to the first object are the same as the multiple preset processing algorithms corresponding to the second object.

[0058] Exemplarily, the multiple objects to be processed by the object processing method include object P1, object P2, and object P3. Moreover, for each object, the corresponding multiple preset processing algorithms all include algorithm A, algorithm B, and algorithm C. In this way, during the process of processing object P1 (the first object) based on algorithm A, the load information of the electronic device can be obtained. If the load information indicates that there is still available processing resource on the electronic device, then object P2 (the second object) can be processed based on algorithm A (the preset processing algorithm with the earliest processing timing). Furthermore, the load information of the electronic device can be obtained again. If the load information still indicates that there is available processing resource on the electronic device, then object P3 (the third object) can be processed based on algorithm A (the preset processing algorithm with the earliest processing timing).

[0059] Among them, as Figure 6 shown, after completing the processing of object P1 based on algorithm A, the intermediate result data output by algorithm A will continue to be processed based on algorithm B corresponding to object P1. After completing the processing of object P1 based on algorithm B, the intermediate result data output by algorithm B will continue to be processed based on algorithm C corresponding to object P1, so as to obtain the final processing result corresponding to P1. The processing methods for object P2 and object P3 are the same. Please refer to Figure 6 again. If object P1, object P2, and object P3 are processed serially, then during the process of processing object P1, object P2 will start to be processed only after algorithm C finishes running, and thus the overall processing time is T3 - T1. In the case of processing based on the method provided in the embodiment of the present application, during the process of processing object P1, when there is sufficient processing resource on the electronic device, object P2 and P3 will start to be processed, so that the overall processing time will be shortened to T2 - T1.

[0060] It should be noted that, as introduced in the foregoing embodiments, the load information of the electronic device can be detected periodically. In the embodiment of the present application, the period for detecting the load information can be determined in various ways.

[0061] As one way, it can be pre-configured by developers. In this way, each period for detecting the load information is the same.

[0062] As another approach, the electronic device can dynamically configure the period for the next load information detection based on the most recently detected load information. In this approach, if the more available processing resources are represented by the most recently detected load information, the corresponding period for the next load information detection is relatively longer; if the less available processing resources are represented by the most recently detected load information, the corresponding period for the next load information detection is relatively shorter. Optionally, after each detection of load information, the available processing resources represented by the detected load information can be compared with a specified processing resource threshold. When the available processing resources are greater than the specified processing resource threshold, the period for the next load information detection is configured as the first period; if the available processing resources are not greater than the specified processing resource threshold, the period for the next load information detection is configured as the second period, where the first period is greater than the second period.

[0063] Regarding this method of configuring the detection period, it should be noted that when the detected available processing resources are greater than the specified resource threshold, it indicates that the available processing resources of the electronic device are relatively sufficient, and even if the electronic device synchronously runs more processing tasks, it will not affect the normal operation of the electronic device. However, when the detected available processing resources are not greater than the specified threshold, it indicates that the available processing resources of the electronic device are relatively scarce, and then it is necessary to obtain the most current available processing resources of the electronic device more timely.

[0064] In addition, it should be noted that the second object in the embodiments of the present application can be understood as an object that was originally scheduled to be processed after the first object. Then, in the process of determining the second object, the determined second object can be one or more. For example, as one approach, if the load information indicates that the electronic device has available processing resources, the preset processing algorithm with the earliest corresponding processing timing can be obtained from the multiple preset processing algorithms corresponding to the multiple second objects, and the preset processing algorithms with the earliest corresponding processing timing for the multiple second objects can be synchronously run. Exemplarily, as Figure 7 shown, in the process of processing object P1, it can be determined that both object P2 and object P3 are second objects, and at time T5, the algorithm A corresponding to object P2 and the algorithm A corresponding to object P3 are synchronously triggered to start running.

[0065] An object processing method provided in this embodiment enables, through the above-mentioned manner, that during the process of processing an object being processed previously (for example, the first object), when the electronic device still has processing resources, the object that was originally to be processed later (for example, the second object) can be processed in parallel, thereby effectively shortening the processing time for processing multiple objects and improving the object processing efficiency. Moreover, in this embodiment, when there are multiple preset processing algorithms corresponding to the second object, the preset processing algorithm with the earliest processing sequence can be directly obtained to start parallel processing of the second object, so that when each object needs to be processed through multiple preset processing algorithms and the electronic device has available processing resources, multiple objects can be processed in parallel according to the multiple preset processing algorithms corresponding to each of the multiple objects, improving the efficiency of processing multiple objects when each object needs to be processed through multiple preset processing algorithms.

[0066] Please refer to Figure 8 , an object processing method provided in this application, which is applied to an electronic device. The method includes:

[0067] S310: During the process of processing the first object, obtain the load information of each of the multiple processing devices supported by the preset processing algorithm corresponding to the second object, where the second object is the object to be processed after the first object.

[0068] S320: If the load information indicates that the corresponding processing device has available processing resources, determine the target processing device from the multiple processing devices based on the load information.

[0069] It should be noted that when there are multiple processing devices included in the electronic device, the functions of each of the multiple processing devices may be different, and thus the real-time loads of different processing devices will be different. If the instantaneous load of a certain processing device exceeds the critical load of the processing device, it may cause the processing device to have a working error, and thus the tasks executed by the processing device cannot run properly.

[0070] To address the above issues, as a means, if the load information indicates that the corresponding processing device has available processing resources, determining a target processing device from multiple processing devices based on the load information includes: if the load information indicates that the corresponding processing device has available processing resources, taking the processing device with the most available processing resources represented by the corresponding load information among the multiple processing devices as the target processing device. Thus, by taking the processing device with the lowest current load (i.e., the processing device with the most available processing resources) among the multiple processing devices supported by the preset processing algorithm corresponding to the second object as the processing device for running the preset processing algorithm corresponding to the second object, it is possible to utilize the processing device with the lowest current load to run the preset processing algorithm, thereby enabling the preset processing algorithm corresponding to the current processing process to be processed more efficiently and also improving the utilization rate of the processing devices of the electronic device.

[0071] Exemplarily, if the multiple processing devices supported by the preset processing algorithm corresponding to the second object include a CPU (central processing unit) and a DSP (Digital Signal Processor), where the load information of the CPU indicates that the CPU has available processing resources and the load information of the DSP indicates that the DSP also has available processing resources, then the amount of available processing resources represented by the load information of the CPU and the load information of the DSP can be compared. If the available processing resources represented by the load information of the CPU are more than those represented by the load information of the DSP, the CPU can be taken as the target processing device. If the available processing resources represented by the load information of the DSP are more than those represented by the load information of the CPU, the DSP can be taken as the target processing device.

[0072] As another means, if the load information indicates that the corresponding processing device has available processing resources, determining a target processing device from multiple processing devices based on the load information includes: if the load information indicates that the corresponding processing device has available processing resources, reading the estimated loads of the multiple processing devices within a specified future time period stored in advance, where the estimated load is determined based on the current load of the processing device and the applications running on the electronic device; taking the processing device with the lowest corresponding estimated load as the target processing device.

[0073] It should be noted that in the embodiments of the present application, the electronic device can store the respective real-time loads of the included processing devices through a pre-configured file. In this case, if it is necessary to obtain the real-time load of a certain processing device, the real-time load of the processing device can be directly read from this file instead of detecting the processing device in real time to obtain the corresponding load, thereby improving the speed of obtaining the real-time load.

[0074] S330: Trigger the parallel processing of the second object by the target processor device.

[0075] An object processing method provided in this embodiment enables, through the above method, the parallel processing of an object that was originally to be processed later (e.g., the second object) while the electronic device still has processing resources during the processing of an object being processed earlier (e.g., the first object). This can effectively shorten the processing time for processing multiple objects and improve the object processing efficiency. Moreover, in this embodiment, when preparing to process the object to be processed later (the second object), the load information of each of the multiple processor devices supported by the preset processing algorithm corresponding to the second object can be obtained. Then, a processor device with more available processing resources currently can be selected to run the preset processing algorithm corresponding to the second object, thus avoiding data processing errors or the electronic device becoming stuck due to excessive load on a certain processor device in the electronic device.

[0076] Next, Figure 9 introduce an object processing method involved in an embodiment of this application.

[0077] As Figure 9 shown, the hardware resources of the electronic device represent the processor devices the electronic device has. Among them, the processor devices can include a CPU, ISP (Image Signal Processing), DSP, GPU (graphics processing unit), and NPU (Neural-network Processing Unit). Furthermore, a first thread and a second thread are configured in the electronic device. The first thread is used to detect the load situation of the processor devices of the electronic device and then obtain the load information of each processor device. The first thread can transmit the load information to the second thread after obtaining it. The second thread is used to process the object to be processed. For example, in the Figure 9 shown scenario, each processing represents processing one object. For the preset processing algorithm corresponding to each object, it includes n frames of algorithm A, m frames of algorithm B, algorithm C, algorithm D, algorithm E, and algorithm F that are run in sequence. For example, during the first processing (i.e., during the processing of the object ranked first), the first thread can select n frames of the algorithm to process the corresponding object. After the n frames of the algorithm are completed, the first thread can further select the subsequent m frames of the algorithm to process the output of the n frames of the algorithm.

[0078] Furthermore, in Figure 9In the scenario shown, each algorithm corresponds to the supported processor device. As can be seen from the foregoing introduction, the supported processor device of an algorithm can be understood as the algorithm can run in the supported processor device. For example, the supported processor device of the n-frame algorithm A is the ISP. The supported processor device of the m-frame algorithm B is the CPU. The supported processor devices of the algorithm C are the NPU and the DSP. The supported processor devices of the algorithm D are the CPU and the DSP. The supported processor devices of the algorithm E are the GPU and the CPU. The supported processor devices of the algorithm F are the DSP and the CPU. In this case, after the first thread selects the algorithm to be run, it will further detect the supported processor device of the algorithm to be run, and select the processor device with more available processing resources from the supported processor devices as the target processor device, and then distribute the algorithm to be run to the corresponding target processor device for running.

[0079] Please refer to Figure 10 , an object processing method provided by the present application, which is applied to a server. The method includes:

[0080] S410: During the process of processing the first object, obtain the load information of the server.

[0081] S420: If the load information indicates that the server has available processing resources, process the second object in parallel, where the second object is the object to be processed after the first object.

[0082] It should be noted that when the object processing method provided by the embodiments of the present application runs on a server, the specific steps are similar to the specific steps running on an electronic device described above, and will not be elaborated here.

[0083] Please refer to Figure 11 , an object processing device 500 provided by the present application, which runs on an electronic device. The device 500 includes:

[0084] A load information acquisition unit 510, configured to obtain the load information of the electronic device during the process of processing the first object.

[0085] A load information acquisition unit 520, configured to process the second object in parallel if the load information indicates that the electronic device has available processing resources, where the second object is the object to be processed after the first object.

[0086] As a method, the object processing unit 520 is specifically configured to, if the load information indicates that the electronic device has available processing resources, obtain the preset processing algorithm with the earliest processing timing from the multiple preset processing algorithms corresponding to the second object, and trigger parallel processing of the second object based on the preset processing algorithm with the earliest processing timing. Optionally, the object processing unit 520 is specifically configured to start processing the second object based on the preset processing algorithm with the earliest processing timing; in response to the completion of the operation of the preset processing algorithm with the earliest processing timing, obtain the processing algorithm after the preset processing algorithm with the earliest processing timing and run it until all the multiple preset processing algorithms are completed.

[0087] As a method, the load information acquisition unit 510 is specifically configured to obtain the load information of the electronic device during the process of processing the first object based on the multiple preset processing algorithms corresponding to the first object; wherein, the multiple preset processing algorithms corresponding to the first object are the same as the multiple preset processing algorithms corresponding to the second object.

[0088] As a method, the load information acquisition unit 510 is specifically configured to obtain the load information of each of the multiple processor devices supported by the preset processing algorithm corresponding to the second object during the process of processing the first object. In this method, the object processing unit 520 is specifically configured to, if the load information indicates that the corresponding processor device has available processing resources, determine the target processor device from the multiple processor devices based on the load information; trigger parallel processing of the second object through the target processor device.

[0089] Optionally, the load information acquisition unit 510 is specifically configured to, if the load information indicates that the corresponding processor device has available processing resources, use the processor device with the most available processing resources indicated by the corresponding load information among the multiple processor devices as the target processor device. Optionally, the load information acquisition unit 510 is specifically configured to, if the load information indicates that the corresponding processor device has available processing resources, read the estimated loads of the multiple processor devices within a specified future time period, where the estimated loads are determined based on the current loads of the processor devices and the applications running on the electronic device; use the processor device with the smallest corresponding estimated load as the target processor device.

[0090] As a method, the object processing unit 520 is further configured to, if the load information of the electronic device indicates that the electronic device has available processing resources, perform parallel processing on the third object, where the third object is the object to be processed after the second object.

[0091] As a way, the load information acquisition unit 510 is specifically configured to acquire the load information of the electronic device obtained by the second thread during the process of processing the first object through the first thread. The object processing unit 520 is specifically configured to, if the load information indicates that the electronic device has available processing resources, process the second object in parallel through the third thread.

[0092] An object processing device provided by the present application enables, during the process of processing an object being processed previously (for example, the first object), to process in parallel an object that was originally to be processed later (for example, the second object) when the electronic device still has processing resources, thereby effectively shortening the processing time of the process of processing multiple objects and improving the object processing efficiency.

[0093] The following will be combined with Figure 12 to describe an electronic device provided by the present application.

[0094] Please refer to Figure 12 , based on the above object processing method and device, the embodiment of the present application further provides another electronic device 100 that can execute the foregoing terminal control method. The electronic device 100 includes one or more (only one is shown in the figure) processors 102, a memory 104, a network module 106, and an image acquisition device 108 that are coupled to each other. Among them, the memory 104 stores a program that can execute the content in the foregoing embodiment, and the processor 102 can execute the program stored in the memory 104.

[0095] Among them, the processor 102 may include one or more processing cores. The processor 102 connects various parts within the entire electronic device 100 through various interfaces and circuits. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 104, and by invoking the data stored in the memory 104, it performs various functions of the electronic device 100 and processes data. Optionally, the processor 102 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 102 may integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the displayed content; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 102 and may be implemented separately through a communication chip.

[0096] The memory 104 may include random access memory (RAM) and may also include read-only memory. The memory 104 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 104 may include a program storage area and a data storage area. Among them, the program storage area can store instructions for implementing the operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area can also store the data created during the use of the terminal 100 (such as phone book, audio and video data, chat record data, etc.).

[0097] The network module 106 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, such as communicating with an audio playback device. The wireless module 106 may include various existing circuit elements for performing these functions. For example, antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, subscriber identity module (SIM) cards, memories, etc. The wireless module 106 can communicate with various networks such as the Internet, enterprise intranets, wireless networks, or communicate with other devices through a wireless network. The above-mentioned wireless network may include a cellular phone network, a wireless local area network, or a metropolitan area network.

[0098] Furthermore, the image acquisition device 108 can be used for image acquisition. Optionally, the image acquisition device 108 can include a color image acquisition device and a depth image acquisition device.

[0099] Please refer to Figure 13 , which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Program code is stored in the computer-readable medium 800, and the program code can be called by a processor to execute the method described in the above method embodiments.

[0100] The computer-readable storage medium 800 can be an electronic memory such as a flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 800 has a storage space for the program code 810 that executes any method step in the above method. These program codes can be read out from or written into one or more computer program products. The program code 810 can be compressed in an appropriate form, for example.

[0101] In summary, for an object processing method, device, and electronic device provided by the present application, during the process of processing a first object, the load information of the electronic device can be obtained again, and when the load information indicates that the electronic device has available processing resources, the second object to be processed after the first object can be processed in parallel. Thus, through the above method, during the process of processing the object to be processed first (for example, the first object), when the electronic device still has processing resources, the object to be processed originally later (for example, the second object) can be processed in parallel, thereby effectively shortening the processing time of the process of processing multiple objects and improving the object processing efficiency.

[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. However, such modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. An object processing method, characterized in that, Applied to an electronic device, the method includes: During the process of processing a first object, obtaining the load information of the electronic device; If the load information indicates that the electronic device has available processing resources, processing a second object in parallel, where the second object is an object to be processed after the first object. Processing the second object in parallel includes: obtaining the preset processing algorithm with the earliest processing timing from multiple preset processing algorithms corresponding to the second object, and starting to process the second object based on the preset processing algorithm with the earliest processing timing; in response to the completion of the operation of the preset processing algorithm with the earliest processing timing, obtaining and running the processing algorithm whose processing timing is after that of the preset processing algorithm with the earliest processing timing until all the multiple preset processing algorithms are completed; Among them, the multiple preset processing algorithms are obtained by splitting multiple initial algorithms based on the data on which the algorithms depend. Splitting the multiple initial algorithms is used to enable some sub-algorithms in some of the initial algorithms to be executed earlier.

2. The method according to claim 1, wherein The obtaining the load information of the electronic device during the process of processing the first object includes: During the process of processing the first object based on multiple preset processing algorithms corresponding to the first object, obtaining the load information of the electronic device; where the multiple preset processing algorithms corresponding to the first object are the same as the multiple preset processing algorithms corresponding to the second object.

3. The method according to claim 1, characterized in that, The load information of the electronic device includes the respective load information of multiple processor devices supported by the preset processing algorithm corresponding to the second object. The obtaining the load information of the electronic device during the process of processing the first object includes: During the process of processing the first object, obtaining the respective load information of multiple processor devices supported by the preset processing algorithm corresponding to the second object; The if the load information indicates that the electronic device has available processing resources, processing the second object in parallel includes: If the load information indicates that the corresponding processor device has available processing resources, determining a target processor device from the multiple processor devices based on the load information; Triggering to process the second object in parallel through the target processor device.

4. The method according to claim 3, wherein The if the load information indicates that the corresponding processor device has available processing resources, determining a target processor device from the multiple processor devices based on the load information includes: If the load information indicates that the corresponding processor device has available processing resources, taking the processor device with the most available processing resources characterized by the corresponding load information among the multiple processor devices as the target processor device.

5. The method according to claim 3, characterized in that, The if the load information indicates that the corresponding processor device has available processing resources, determining a target processor device from the multiple processor devices based on the load information includes: If the load information indicates that the corresponding processor device has available processing resources, reading the estimated loads of the multiple processor devices within a specified future time period stored in advance, where the estimated loads are determined based on the current loads of the processor devices and the applications running on the electronic device; The processor device with the smallest corresponding estimated load is used as the target processor device.

6. The method according to claim 1, wherein If the load information indicates that the electronic device has available processing resources, after processing the second object in parallel, it further includes: If the load information of the electronic device indicates that the electronic device has available processing resources, process the third object in parallel, where the third object is the object to be processed after the second object.

7. The method according to claim 1, characterized in that, During the process of processing the first object, obtaining the load information of the electronic device includes: During the process of processing the first object through the first thread, obtain the load information of the electronic device obtained through the second thread; If the load information indicates that the electronic device has available processing resources, process the second object in parallel, including: If the load information indicates that the electronic device has available processing resources, process the second object in parallel through the third thread.

8. An object processing device, characterized in that, Running on an electronic device, the device includes: A load information acquisition unit, configured to obtain the load information of the electronic device during the process of processing the first object; An object processing unit, configured to, if the load information indicates that the electronic device has available processing resources, process the second object in parallel, where the second object is the object to be processed after the first object, and processing the second object in parallel includes: obtaining the preset processing algorithm with the earliest processing timing from multiple preset processing algorithms corresponding to the second object, starting to process the second object based on the preset processing algorithm with the earliest processing timing; in response to the completion of the operation of the preset processing algorithm with the earliest processing timing, obtaining the processing algorithm after the preset processing algorithm with the earliest processing timing for operation until all the multiple preset processing algorithms are completed; where the multiple preset processing algorithms are obtained by splitting multiple initial algorithms based on the data on which the algorithms depend, and splitting the multiple initial algorithms is for allowing some sub-algorithms in some of the initial algorithms to be executed later to be executed in advance.

9. An electronic device, characterized in that, Comprising one or more processors and a memory; One or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, Program code is stored in the computer-readable storage medium, and when the program code runs, it executes the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method and device for executing task

    CN110673944A

  • Method and device for determining execution sequence, storage medium and electronic device

    CN111737075A

  • Algorithm scheduling method and system

    CN111988429A