CN114968564A - Target object processing method and device and electronic equipment - Google Patents

Target object processing method and device and electronic equipment Download PDF

Info

Publication number
CN114968564A
CN114968564A CN202210533507.8A CN202210533507A CN114968564A CN 114968564 A CN114968564 A CN 114968564A CN 202210533507 A CN202210533507 A CN 202210533507A CN 114968564 A CN114968564 A CN 114968564A
Authority
CN
China
Prior art keywords
algorithm
processing
preset
preset processing
target object
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210533507.8A
Other languages
Chinese (zh)
Inventor
李红
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202210533507.8A priority Critical patent/CN114968564A/en
Publication of CN114968564A publication Critical patent/CN114968564A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application discloses a target object processing method and device and electronic equipment. The method comprises the following steps: selecting a first preset processing algorithm and a second preset processing algorithm from a plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object; running the selected first preset processing algorithm and the second preset processing algorithm in parallel; and responding to the receiving of a triggering condition for ending the first preset processing algorithm aiming at the current processing process of the target object, selecting a third preset processing algorithm from the plurality of preset processing algorithms, and operating the selected third preset processing algorithm, wherein the third preset processing algorithm is used for calculating and processing data generated by the first preset processing algorithm. Therefore, the time consumption of corresponding processing of the target object is reduced and the processing efficiency of the target object is improved through the method.

Description

Target object processing method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a target object processing method and apparatus, and an electronic device.
Background
With the development of the technology, the electronic device has more and more powerful computing and storage capabilities, and can support complex computing for the object to be processed. For example, the electronic device needs to perform calculation processing on an object to be processed, such as an image or a text, acquired by the electronic device, by using a combination of different algorithms to obtain a desired improvement, such as improving the imaging quality of the object to be processed, such as an image or a text, performing recognition extraction on the object to be processed, such as an image or a text, and the like. When the electronic device performs calculation processing on the object to be processed acquired by the electronic device by using a combination of different algorithms, the processing efficiency also has a space for improvement.
Disclosure of Invention
In view of the foregoing problems, the present application provides a target object processing method, an apparatus, and an electronic device, so as to improve the foregoing problems.
In a first aspect, the present application provides a target object processing method applied to an electronic device, where the method includes: selecting a first preset processing algorithm and a second preset processing algorithm from a plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object; running the selected first preset processing algorithm and the second preset processing algorithm in parallel; responding to the condition that the ending trigger of the first preset processing algorithm aiming at the current processing process of the target object is received, selecting a third preset processing algorithm from the plurality of preset processing algorithms, and operating the selected third preset processing algorithm, wherein the third preset processing algorithm is used for calculating and processing data generated by the first preset processing algorithm.
In a second aspect, the present application provides a target object processing method, applied to a server, the method including: selecting a first preset processing algorithm and a second preset processing algorithm from a plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object; the selected first preset processing algorithm and the selected second preset processing algorithm are operated in parallel; responding to the condition that the ending trigger of the first preset processing algorithm aiming at the current processing process of the target object is received, selecting a third preset processing algorithm from the plurality of preset processing algorithms, and operating the selected third preset processing algorithm, wherein the third preset processing algorithm is used for calculating and processing data generated by the first preset processing algorithm.
In a third aspect, the present application provides a target object processing apparatus, which is operable on an electronic device, and includes: the algorithm determining unit is used for responding to the fact that a starting triggering condition aiming at the current processing process of the target object is received, and selecting a first preset processing algorithm and a second preset processing algorithm from the plurality of preset processing algorithms; the algorithm execution unit is used for running the selected first preset processing algorithm and the second preset processing algorithm in parallel; the algorithm determining unit is further configured to select a third preset processing algorithm from the plurality of preset processing algorithms in response to receiving a triggering condition for ending the first preset processing algorithm for the current processing process of the target object, and the algorithm executing unit is further configured to run the selected third preset processing algorithm, where the third preset processing algorithm is to perform calculation processing on data generated by the first preset processing algorithm.
In a fourth aspect, the present application provides an electronic device comprising 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, the one or more programs configured to perform the methods described above.
In a fifth aspect, the present application provides a computer-readable storage medium having a program code stored therein, wherein the program code performs the above method when running.
The application provides a target object processing method, a target object processing device and electronic equipment, after responding to and receiving the start triggering condition to the current processing process of a target object, select a first preset processing algorithm and a second preset processing algorithm from a plurality of preset processing algorithms, parallelly operate and select the first preset processing algorithm and the second preset processing algorithm, respond to and receive the end triggering condition to the first preset processing algorithm to the current processing process of the target object again, select a third preset processing algorithm from a plurality of preset processing algorithms, operate and select the third preset processing algorithm. Therefore, in the processing process of the target object, the first preset processing algorithm and the second preset processing algorithm in the plurality of preset processing algorithms corresponding to the target object can run in parallel, and therefore the time consumption of the whole processing of the target object can be shortened.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating an application scenario of a target object processing method proposed in the present application;
fig. 2 is a schematic diagram illustrating another application scenario of the target object processing method proposed in the present application;
fig. 3 is a flowchart illustrating a target object processing method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating an interdependence relationship between a plurality of algorithms corresponding to a target object according to an embodiment of the present application;
fig. 5 is a schematic diagram illustrating a running time of an object processing method according to an embodiment of the present application;
fig. 6 is a flowchart illustrating a target object processing method according to another embodiment of the present application;
FIG. 7 shows a schematic diagram where the sub-algorithm proposed by the embodiments of the present application may rely on a plurality of previous algorithms;
fig. 8 is a flowchart illustrating a target object processing method according to still another embodiment of the present application;
FIG. 9 is a schematic diagram of a processing device supported by an algorithm in an embodiment of the present application;
fig. 10 is a block diagram illustrating a target object processing apparatus according to an embodiment of the present application;
fig. 11 shows a block diagram of an electronic device proposed in the present application;
fig. 12 is a storage unit according to an embodiment of the present application, configured to store or carry program code for implementing a target object processing method according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the operation process of the electronic equipment, various objects can be acquired. For example, a text type object may be acquired, and an image type object may be acquired. In some cases, the electronic device may process the acquired object through an algorithm, and then perform subsequent operations on the processed object. For example, in the process of taking a picture, the electronic device may process an image directly acquired by the camera through a plurality of algorithms, and then display and store the image processed through the plurality of algorithms to the user.
However, the inventor finds in research that there is a problem that efficiency is to be improved in a related process of processing an object by a plurality of algorithms. For example, in the related processing procedure, when the object to be processed needs to be processed by a plurality of algorithms, the object to be processed is usually processed in a serial manner by the plurality of algorithms. However, the inventor of the present application has found in research that some sub-algorithms (for example, an algorithm may be composed of a plurality of sub-algorithms) included in a part of the algorithms that are run later among a plurality of algorithms corresponding to the object to be processed may actually be run earlier.
Therefore, the inventor proposes a target object processing method, a target object processing device and an electronic device in the present application, so that in a process of processing a target object, a first preset processing algorithm and a second preset processing algorithm of a plurality of preset processing algorithms corresponding to the target object can be run in parallel by the target object processing method, thereby being beneficial to shortening the overall processing time of the target object.
The following first introduces an application scenario related to the embodiment of the present application.
In the embodiment of the application, the provided target object processing method can be executed by an electronic device. In this manner performed by the electronic device, all steps in the target object processing method provided by the embodiment of the present application may be performed by the electronic device. For example, as shown in fig. 1, in a case that all steps in the target object processing method provided by the embodiment of the present application may be executed by the electronic device, all steps may be executed by the processor of the electronic device 100.
Furthermore, the target object processing method provided by the embodiment of the present application may also be executed by a server. Correspondingly, in this manner executed by the server, the server may start to execute the steps in the target object processing method provided by the embodiment of the present application in response to the object processing instruction. The triggering instruction can be sent by an electronic device used by a user or can be triggered locally by a server in response to some automation event.
In addition, the target object processing method provided by the embodiment of the application can be cooperatively executed by the electronic device and the server. In this manner, the target object processing method provided by the embodiment of the present application is executed by the electronic device, and the server executes other steps. For example, as shown in fig. 2, the electronic device 100 may perform a target object processing method including: responding to the completion of the execution of the algorithm corresponding to the prior processing process, determining the algorithm corresponding to the current processing process from the plurality of algorithms corresponding to the target object based on the algorithm corresponding to the prior processing process, then transmitting the algorithm corresponding to the current processing process to the server 200, then executing the thread configured to the algorithm corresponding to the current processing process by the server 200, operating the algorithm corresponding to the current processing process so as to process the processing result data generated by the prior processing process, and if the algorithm corresponding to the current processing process is completed, returning the message of completing the execution to the electronic device 100.
It should be noted that, in this manner executed by the electronic device and the server cooperatively, the steps executed by the electronic device and the server respectively are not limited to the manner described in the above example, and in practical applications, the steps executed by the electronic device and the server respectively may be dynamically adjusted according to actual situations.
It should be noted that, besides the smart phone shown in fig. 1 and fig. 2, the electronic device 100 may also be a tablet computer, a smart watch, a smart voice assistant, or the like. The server 200 may be an independent physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers. In the case that the target object processing method provided in the embodiment of the present application is executed by a server cluster or a distributed system formed by a plurality of physical servers, different steps in the target object processing method may be respectively executed by different physical servers, or may be executed by servers constructed based on the distributed system in a distributed manner.
In order to facilitate better understanding of the embodiments of the present application, some concepts related to the embodiments of the present application will be described below.
Data on which the algorithm depends: the data on which the algorithm depends characterizes the data that the algorithm requires during operation. The required data may be understood as data which is input to the algorithm as input during the operation of the algorithm.
Splitting an algorithm: in the embodiment of the present application, splitting of an algorithm may be understood as splitting one algorithm into a plurality of sub-algorithms. The split algorithm may be composed of a plurality of algorithms, wherein the plurality of algorithms may be understood as sub-algorithms of the split algorithm. Illustratively, algorithm D consists of algorithm D1, algorithm D2, and algorithm D3, and then algorithm D1, algorithm D2, and algorithm D3 may all be sub-algorithms of algorithm D.
The embodiments of the present application will be described below with reference to the drawings.
Referring to fig. 3, a target object processing method provided by the present application is applied to an electronic device, and the method includes:
s110: and selecting a first preset processing algorithm and a second preset processing algorithm from the plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object.
There are many cases where the trigger condition is initiated. Optionally, if the current processing process is the first processing process, the starting triggering condition may be to acquire the target object. Optionally, if the secondary processing procedure is not the first processing procedure (for example, the second processing procedure or a subsequent processing procedure), the starting triggering condition may include that a preset processing algorithm in the previous processing procedure is executed completely, or that data output by the previous processing procedure is obtained. Correspondingly, the first preset processing algorithm and the second preset processing algorithm selected from the plurality of preset processing algorithms may be algorithms for performing operations during the current processing.
In the embodiment of the application, the electronic device processes the target object by using a combination of different algorithms to obtain the desired improvement. The target object may include various types, for example, the target object may be text or an image (picture or video). The specific type of the target object may be determined according to a scene to which the target object processing method is applied.
In one mode, the target object processing method provided in this embodiment of the present application may be applied to an image capturing scenario, in which case, the target object may include an image captured by a camera of an electronic device (which may also be an image stored in the electronic device or an image received from a server side, and is not limited herein), and correspondingly, the electronic device may start to perform multiple processing on the image based on multiple preset processing algorithms corresponding to the image in response to the image captured by the camera. In one manner, the target object processing method provided in this embodiment of the present application may be applied to a text recognition scenario, for example, after an electronic device acquires a voice content through a microphone and converts the voice content into a corresponding text, the text may be subjected to multiple times of algorithm processing in order to determine semantics to be expressed by the text, in this case, a target object in this embodiment of the present application may be understood as a text to be subjected to semantic understanding, and correspondingly, in response to obtaining a text converted from the voice content, the electronic device may start to perform multiple times of processing on the text based on multiple preset processing algorithms corresponding to the text. In other embodiments, the text content extracted based on the recognition in the image may also be used as the target object.
In addition, it should be noted that the target object may be an object that has not undergone any processing, for example, a picture captured by a camera of an electronic device. Furthermore, the target object may be an object that has been processed by a specified algorithm, and the specified algorithm is different from a plurality of preset processing algorithms corresponding to the target object.
In this embodiment of the application, the plurality of preset processing algorithms are algorithms for processing the target object, and it should be noted that the plurality of preset processing algorithms are used for processing the target object, which may be understood as being used for directly processing the target object and for processing intermediate processing result data obtained by processing the target object by a certain preset processing algorithm. Illustratively, the plurality of preset processing algorithms corresponding to the target object X include algorithm a, algorithm B1, algorithm B2, and algorithm C. The algorithm a is used for directly processing the target object X, the algorithm B1 is used for processing intermediate result data obtained by processing the target object by the algorithm a, and the algorithm B2 is also used for processing intermediate result data obtained by processing the target object by the algorithm a, wherein the intermediate result data output after the algorithm B1 is executed is the object X1, the intermediate result data output after the algorithm B2 is executed is the data X2, and the algorithm C can process the object X1 based on the data X2 to obtain a final object.
In this embodiment of the present application, the plurality of preset processing algorithms corresponding to the target object may be obtained by splitting a plurality of initial processing algorithms corresponding to the target object. The execution sequence of the plurality of initial processing algorithms corresponding to the target object is serial execution. Then the multiple initial processing algorithms are not executed in parallel during the execution of the multiple initial processing algorithms. For example, the plurality of initial processing algorithms corresponding to the target object includes an initial processing algorithm a, an initial processing algorithm B, and an initial processing algorithm C. The initial processing algorithm a may be executed first, the initial processing algorithm B may be executed after the initial processing algorithm a is executed, and the initial processing algorithm C may be executed after the initial processing algorithm B is executed. Based on this example, it can be seen that in the case where a plurality of initial processing algorithms are executed in series, the processing time of the whole target object is equal to the sum of the time of each processing algorithm, and there is room for improvement in algorithm processing efficiency.
Wherein the initial processing algorithm as a whole may be composed of a plurality of sub-algorithms. For example, during the operation of the initial processing algorithm B, the initial processing algorithm B processes the input data in two steps, and the two steps may correspond to one sub-algorithm respectively. I.e. one of the sub-algorithms B1 is used to perform the first step and the other sub-algorithm B2 is used to perform the other step. In the research, the inventor finds that, in a plurality of initial processing algorithms corresponding to the target object, partial sub-algorithms in the initial processing algorithm partially executed later can be executed more ahead of time, and the execution timing of the initial processing algorithm is not limited to be restarted. It should be noted that, as one way, whether a certain algorithm starts to operate may be determined based on data on which the algorithm depends, wherein the data on which the algorithm depends may be understood as data processed during the operation of the algorithm, or may be data that needs to be input into the algorithm.
Illustratively, among an initial processing algorithm a, an initial processing algorithm B and an initial processing algorithm C corresponding to the target object, the initial processing algorithm B includes a sub-algorithm B1 and a sub-algorithm B2, where the sub-algorithm B1 is used for directly processing data output by the initial processing algorithm a, and the sub-algorithm B2 is used for extracting information from the data output by the initial processing algorithm a. However, the information to be extracted by the sub-algorithm B2 during the operation process may actually be extracted directly from the target object, that is, the data on which the sub-algorithm B2 depends may actually be the target object, and the sub-algorithm B2 may actually be operated in parallel with the initial processing algorithm a.
Splitting the plurality of initial processing algorithms corresponding to the target object may be understood as splitting each initial processing algorithm, and further, a part of the initial processing algorithms may not be split, in which case, it may be detected whether splitting is possible for each initial processing algorithm corresponding to the target object based on the data that depends on the initial processing algorithm, and splitting may be performed for the initial processing algorithms that can be split based on the data that depends on the algorithm, so as to complete splitting of the plurality of initial processing algorithms, so as to obtain a plurality of preset processing algorithms in the actual processing process of the target object. The splitting of the plurality of initial processing algorithms corresponding to the target object based on the dependent data may be understood as splitting each initial processing algorithm based on data on which a sub-algorithm included in each initial processing algorithm depends, and correspondingly, detecting whether the initial processing algorithm may be split based on the dependent data may be understood as splitting the initial processing algorithm based on data on which the sub-algorithm included in the initial processing algorithm depends, and determining whether the sub-algorithm may be split into an independent algorithm.
For example, if the plurality of initial processing algorithms corresponding to the target object are the initial processing algorithm a, the initial processing algorithm B, and the initial processing algorithm C, and after the initial processing algorithm a, the initial processing algorithm B, and the initial processing algorithm C are respectively detected based on data depended on by the algorithms, it is determined that the initial processing algorithm B can be split into the sub-algorithm B1 and the sub-algorithm B2, then after the plurality of initial processing algorithms corresponding to the target object are split, the obtained plurality of preset processing algorithms corresponding to the target object include the initial processing algorithm a, the sub-algorithm B1, the sub-algorithm B2, and the initial processing algorithm C.
The execution sequence of each of the plurality of preset processing algorithms corresponding to the obtained target object may be determined based on the algorithm depended on by the algorithm. The algorithm on which the post-run algorithm depends may be understood as an algorithm that generates data on which the post-run algorithm depends. Therefore, in the embodiment of the application, when the algorithm finishes executing, the operation of the algorithm depending on the finished execution can be further triggered.
It should be noted that, in this embodiment of the application, other devices except the electronic device may split the multiple initial processing algorithms corresponding to the target object in advance to obtain multiple preset processing algorithms corresponding to the target object. Or after the electronic device obtains the plurality of initial processing algorithms corresponding to the target object before processing the target object, the electronic device locally splits the plurality of initial processing algorithms corresponding to the target object to obtain the plurality of preset processing algorithms corresponding to the target object.
S120: and running the selected first preset processing algorithm and the second preset processing algorithm in parallel.
In the embodiment of the application, the parallel operation of the selected first preset processing algorithm and the second preset processing algorithm can be understood as synchronous triggering to start the operation of the first preset processing algorithm and the second preset processing algorithm, so that the respective operation time consumption of the first preset processing algorithm and the second preset processing algorithm can be overlapped, and the time consumption in the target object processing process can be further shortened.
S130: and responding to the receiving of a triggering condition for ending the first preset processing algorithm aiming at the current processing process of the target object, selecting a third preset processing algorithm from the plurality of preset processing algorithms, and operating the selected third preset processing algorithm, wherein the third preset processing algorithm is used for calculating and processing data generated by the first preset processing algorithm.
The selected data depended on by the third preset processing algorithm is the data generated by the first preset processing algorithm, so that the determined algorithm in the post-processing process is the third preset processing algorithm after the first preset processing algorithm is finished running. The second preset processing algorithm and the third preset processing algorithm may be two algorithms split from the same algorithm. For example, if the data depended by the second predetermined processing algorithm and the data depended by the first predetermined processing algorithm are the same, the second predetermined processing algorithm may be executed in parallel with the first predetermined processing algorithm in advance.
Next, the effect of the target object processing method according to the embodiment of the present application will be described with reference to fig. 4 and 5. As shown in fig. 4, the target object is an image, for example, an a-frame image shown in fig. 4. The a-frame images can be processed in parallel by algorithm a, algorithm D and algorithm C1. Algorithm a is used to process all the a-frame images to obtain b-frame result images, and algorithm C1 and algorithm D are understood to be used to process any one of the a-frame images. After the processing of the algorithm A, a B-frame result image can be obtained, and then the algorithm B can combine the B-frame result image and the c-frame image (an image which is acquired synchronously with the a-frame image but has a different format) to continue processing to obtain an image with the effect of the superposition algorithm B. The B-effect image is processed again by the C2 algorithm, and the C2 algorithm combines the extracted information i2 output by the C1 algorithm in the process of processing the B-effect image, and processes the B-effect image in sequence based on the direction indicated by the arrow in fig. 4, so as to obtain the B-effect image shown in fig. 4 as the final processing result. Based on the situation shown in fig. 4, if the current processing procedure is to process the a-frame image, the preset processing algorithms selected from the plurality of preset processing algorithms may be algorithm D, algorithm a, and algorithm C1.
Further, the specific content of the algorithm shown in fig. 4 is not specifically limited in the embodiment of the present application. For example, algorithm a may be an image noise reduction algorithm, algorithm C1 may be an image foreground acquisition algorithm, algorithm D may be an image background acquisition algorithm, and the like.
It should be noted that, in the algorithm shown in fig. 4, the algorithm C1, the algorithm C2, and the algorithm C3 originally belong to the algorithm C (i.e., the algorithm C1, the algorithm C2, and the algorithm C3 jointly constitute the algorithm C), and the original execution sequence of the algorithm C is after the algorithm B. In the embodiment of the present invention, the algorithm C1 may actually directly process the a-frame image (a target object, which may be a frame or multiple frames) in fig. 4, so that the execution sequence of the algorithm C1 may be advanced and run in parallel with the algorithm a and the algorithm D, thereby reducing the overall processing time consumption
As shown in fig. 5, if the plurality of initial processing algorithms corresponding to the target object include algorithm a, algorithm B, algorithm C, and algorithm D. The algorithm D may include an algorithm D1, an algorithm D2, and an algorithm D3, wherein when it is determined that the algorithm D2 may be split based on data on which the algorithm D1, the algorithm D2, and the algorithm D3 depend, the comparison between the overall processing time and the overall processing time of the target object may be as shown in fig. 5. In the case that all of the plurality of initial processing algorithms are executed in series, the overall time consumption is T3-T1, and the plurality of preset processing algorithms obtained after the splitting of the initial processing algorithms in the manner provided in the embodiment of the present application include algorithm a, algorithm B, algorithm C, algorithm D1, algorithm D2, and algorithm D3, because algorithm D2 (which may be understood as a second preset processing algorithm) split from algorithm D can be executed in parallel with algorithm a (which may be understood as a first preset processing algorithm), that is, the running time consumption of algorithm D2 and algorithm a is overlapped, the overall processing time consumption is T2-T1, and obviously, T2-T1 is smaller than T3-T1.
It should be noted that, if the algorithms (e.g., the first preset processing algorithm and the second preset processing algorithm) corresponding to the current processing procedure are executed, the post-processing procedure corresponding to the algorithm corresponding to the current processing procedure is entered until all the algorithms are executed. After the algorithm corresponding to the current processing procedure is executed, the algorithm running after the algorithm corresponding to the current processing procedure can be run. It should be noted that, if there are multiple algorithms corresponding to the current processing procedure and there is an algorithm that is executed in the current processing procedure, the post-processing procedure corresponding to the executed algorithm may be entered. Illustratively, the plurality of algorithms corresponding to the target object includes algorithm a, algorithm B1, algorithm B2, and algorithm C. If the algorithm determined by the current processing is algorithm B1 (i.e. there are only 1 algorithm in the current processing), algorithm C depends on algorithm B1. After the execution of the algorithm B1 determined by the current processing procedure is completed, the post-processing procedure corresponding to the algorithm B1 may be entered, that is, the algorithm C dependent on the algorithm B1 may be started to run. If the algorithms determined in the current processing procedure are algorithm B1 and algorithm B2 (i.e., there are multiple algorithms in the current processing procedure), after the algorithm B1 is completed, the post-processing procedure corresponding to algorithm B1 may be entered, and correspondingly, after the algorithm B2 is completed, the post-processing procedure corresponding to algorithm B2 may be entered.
In the target object processing method provided by this embodiment, after receiving a start trigger condition for a current processing procedure of a target object, a first preset processing algorithm and a second preset processing algorithm are selected from a plurality of preset processing algorithms, the selected first preset processing algorithm and the selected second preset processing algorithm are run in parallel, and then, in response to receiving an end trigger condition for the first preset processing algorithm for the current processing procedure of the target object, a third preset processing algorithm is selected from the plurality of preset processing algorithms, and the selected third preset processing algorithm is run. Therefore, in the processing process of the target object, the first preset processing algorithm and the second preset processing algorithm in the plurality of preset processing algorithms corresponding to the target object can run in parallel, and therefore the time consumption of the whole processing of the target object can be shortened.
Referring to fig. 6, a target object processing method provided by the present application is applied to an electronic device, and the method includes:
s210: and selecting a first preset processing algorithm and a second preset processing algorithm from the plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object.
S220: and running the selected first preset processing algorithm and the second preset processing algorithm in parallel.
As one mode, the parallel running of the selected first preset processing algorithm and the second preset processing algorithm includes: and respectively configuring corresponding threads for the selected first preset processing algorithm and the second preset processing algorithm, and operating the first preset processing algorithm and the second preset processing algorithm in parallel through the threads corresponding to the first preset processing algorithm and the second preset processing algorithm.
It should be noted that, as can be seen from the foregoing, if the plurality of preset processing algorithms corresponding to the target object determine their respective operation sequences based on the algorithm dependencies, a plurality of algorithms that are operated later may depend on the same algorithm that is operated earlier. Therefore, there may be a plurality of determined algorithms corresponding to the current processing procedure, and therefore, corresponding threads are respectively configured for the algorithms operated by the current processing procedure, so that the algorithms determined by the current processing procedure can be operated in parallel. As a manner, when determining the algorithm corresponding to the current processing process, the number of the algorithms corresponding to the current processing process may be determined synchronously, if there are multiple algorithms corresponding to the current processing process, corresponding threads are configured for multiple preset processing algorithms corresponding to the current processing process, and the corresponding algorithms are run based on the threads corresponding to the multiple preset processing algorithms to process the processing result data generated by the previous processing process, respectively. For example, the selected first preset processing algorithm and the second preset processing algorithm are respectively configured with corresponding threads.
It should be noted that, the larger the number of threads running in parallel, the higher the load generated by the electronic device in real time. In some cases, there may be more applications that the electronic device runs simultaneously, and in this case, if corresponding threads are still configured for a plurality of preset processing algorithms in the current processing procedure, the load of the electronic device may be further increased, which may cause the electronic device to be stuck. As an improvement mode, if the algorithm corresponding to the current processing procedure is multiple, the occupation degree of the processing device in the electronic device can be obtained, and if the occupation degree of the processing device is lower than an occupation threshold, corresponding threads are respectively configured for a plurality of preset processing algorithms corresponding to the current processing procedure, so that the electronic device can determine the load of the electronic device according to the occupation degree of the processing device through the mode, and further determine whether the corresponding threads are respectively configured for the plurality of preset processing algorithms determined by the current processing procedure according to the load condition, thereby improving the flexibility in the object processing procedure and also reducing the possibility of the electronic device being stuck.
In the process of acquiring the occupancy level of the processing device, the processing device acquiring the occupancy level may be a processing device corresponding to the algorithm determined in the current processing process. The processing device corresponding to the algorithm may be understood as a processing device that runs the algorithm. For example, algorithm a is configured to be executed by a GPU (graphics Processing unit) of the electronic device, and then the Processing device corresponding to algorithm a is a GPU. Wherein, the occupation degree of the processing device can be the utilization rate of the processing device.
Correspondingly, if a plurality of algorithms corresponding to the current processing process exist and the occupation degree of the processing device is not lower than the occupation threshold, the number of the algorithm threads configured for operating the current processing process is less than the number of the algorithms corresponding to the current processing process, so as to reduce the number of the algorithms operating in parallel. When the number of algorithm threads used for running the current processing procedure is less than the number of algorithms corresponding to the current processing procedure, a specific execution order may be determined based on the algorithm priorities of the plurality of preset processing algorithms corresponding to the current processing procedure, and after the execution order of the plurality of preset processing algorithms corresponding to the current processing procedure is determined, the execution order and the configured threads may be run. For example, the determined algorithms corresponding to the current processing procedure may be algorithm B1, algorithm B2, and algorithm C, and it is determined that the occupancy level of the processing device is not lower than the occupancy threshold, the number of threads allocated to the current processing procedure may be two, and furthermore, the execution order determined by algorithm B1, algorithm B2, and algorithm C may be that algorithm B1 is executed first, algorithm B2 is executed, and then algorithm C is executed. In this case, algorithm B1 and algorithm B2 may be executed in parallel by two configured threads, and after an algorithm in algorithm B1 and algorithm B2 is completed, algorithm C may be executed by an idle thread. When the occupation degree of the processing device is determined to be not lower than the occupation threshold, the number of threads of the current processing process can be configured according to the algorithm priority, and the threads are preferentially configured for the algorithm with high priority.
As shown in the foregoing, if there are multiple algorithms corresponding to the current processing procedure and the occupancy degree of the processing device is not lower than the occupancy threshold, the number of threads of the algorithm configured for the current processing procedure is less than the number of algorithms corresponding to the current processing procedure, and in this case, the electronic device may also determine the number of threads configured for the current processing procedure according to multiple ways.
In one approach, the electronic device may determine the number of threads configured directly from the number of algorithms of the current process. Optionally, the number of configured threads may be obtained by subtracting a preset value from the number of algorithms in the current processing process. For example, the preset value may be 1.
Alternatively, the electronic device may determine the number of threads configured with reference to at least one parameter of the number of applications run by the electronic device and the current remaining power. In this manner, if the number of configured threads is determined based on the number of running applications, a correspondence relationship between the number of applications and the number of configured threads may be established, and the number of configured threads may be determined based on the correspondence relationship between the number of applications and the configured threads. If the number of the configured threads is determined based on the current remaining power, a corresponding relationship between the current remaining power and the number of the configured threads may be established, and then the number of the configured threads is determined based on the corresponding relationship between the current remaining power and the configured threads. If the number of configured threads is determined based on the number of applications run by the electronic device and the current remaining power, the number of threads corresponding to the number of applications run by the electronic device and the current remaining power may be established.
S230: and responding to the condition of receiving the triggering condition for ending the first preset processing algorithm aiming at the current processing process of the target object, and acquiring the algorithm dependency relationship.
The algorithm dependency relationship represents algorithms on which a plurality of preset processing algorithms corresponding to the target object depend. And, each preset processing algorithm is executed next to the dependent preset processing algorithm.
It should be noted that, for each type of target object, the corresponding multiple preset processing algorithms are different, and then the algorithm dependency relationship corresponding to each type of target object is also different. As a mode, the electronic device may store the algorithm dependency corresponding to each type of object in the electronic device in advance, so that after the target object is determined, the locally pre-stored algorithm dependency may be directly read.
Furthermore, it should be noted that, in the embodiment of the present application, in the process of splitting the initial processing algorithm, the algorithm is split based on the data on which the algorithm depends, and part of the data on which the sub-algorithm depends may be obtained from a plurality of previous stages, so that there may be a plurality of algorithms on which the split algorithm depends, and further, there may be a plurality of algorithm dependencies finally obtained.
For example, as shown in fig. 7, algorithm D may be split into algorithm D1, algorithm D2, and algorithm D3. The algorithm D1 may be executed after the algorithm a or after the algorithm B. In this case, the determined algorithm dependencies may be that algorithm B depends on algorithm a, algorithm D1 depends on algorithm a, algorithm C depends on algorithm B, algorithm D2, and algorithm D3 depends on algorithm C. Furthermore, the determined algorithm dependency relationship may also be that algorithm B depends on algorithm a, algorithm D1 depends on algorithm B, algorithm C depends on algorithm B, algorithm D2, and algorithm D3 depends on algorithm C. For both algorithm dependencies, it can be found that in case algorithm D1 relies on algorithm a, algorithm D1 and algorithm B (which also relies on algorithm a) start running synchronously, and in case algorithm D1 relies on algorithm B, algorithm D1 and algorithm C (which also relies on algorithm B) start running synchronously. It can be understood that the more algorithms that are operated in parallel, the higher the real-time load of the electronic device is, and in the two algorithm dependencies shown above, if the algorithm D1 and the algorithm B are processed in parallel, the higher load will be in the time period in which the algorithm D1 and the algorithm B are operated in parallel, and if the algorithm D1 and the algorithm C are processed in parallel, the higher load will be in the time period in which the algorithm D1 and the algorithm C are operated in parallel, that is, the multiple preset processing algorithm dependencies corresponding to the same object have different load changes. The load change condition corresponding to the algorithm dependency relationship can be understood as that the amplitude of the load increased by the electronic equipment along with the time change is different in the process of running a plurality of preset processing algorithms of the target object by the algorithm dependency relationship.
If there are multiple preset processing algorithm dependencies corresponding to the target object and the respective corresponding load changes are different, the electronic device may select an algorithm dependency that most matches the current load of the electronic device from the multiple preset processing algorithm dependencies corresponding to the target object, so that the load increased by processing the target object may be mutually staggered from the load increased by running other application programs in the electronic device, so as to reduce the instantaneous load of the electronic device, and further reduce the probability of the electronic device being stuck. For example, a photographing scene is taken as an example, in some cases, a user may configure the electronic device to synchronously display an image sharing interface after performing a photographing operation, and in this case, the electronic device may trigger the display of the image sharing interface while controlling the camera to photograph, so that, after the image sharing interface is triggered to be displayed, the load of the electronic device may be relatively greater in a start stage of image acquisition (after the image sharing interface is triggered to be displayed, because the image sharing interface is already drawn and displayed on the screen, the load of the electronic device may be relatively reduced), and the electronic device may select an algorithm dependency relationship with a low load increase in the start stage from a plurality of preset processing algorithm dependencies corresponding to an image (an image acquired by the camera).
S240: and selecting a third preset processing algorithm from the plurality of preset processing algorithms by obtaining the algorithm dependency relationship, and operating the selected third preset processing algorithm, wherein the third preset processing algorithm is used for calculating and processing the data generated by the first preset processing algorithm.
Illustratively, the plurality of preset processing algorithms corresponding to the target object include algorithm a, algorithm B1 and algorithm C. Then the algorithm dependency corresponding to the target object may be: algorithm B1 relies on algorithm a, algorithm B2 relies on algorithm a, and algorithm C relies on algorithm B1. In this case, if the first preset processing algorithm corresponding to the current processing procedure is algorithm a, the determined third preset processing algorithm may include algorithm B1 based on the algorithm dependency relationship.
It should be noted that, in the case that a logical processing thread is established in the electronic device, the operation of the preset processing algorithm and the selection of the preset processing algorithm may be performed by different threads, so as to reduce the operating pressure of a single thread. The operation of the optional preset processing algorithm may be performed by the main thread, and after the main thread completes the operation of the preset processing algorithm of the current processing procedure, the main thread may call the logic processing thread to select the preset processing algorithm corresponding to the post-processing procedure.
As one mode, in response to receiving an end trigger condition of a first preset processing algorithm for a current processing process of a target object, acquiring an algorithm dependency relationship, including: and triggering the logic processing thread to acquire the algorithm dependency relationship in response to receiving a finishing triggering condition of a first preset processing algorithm aiming at the current processing process of the target object. In this manner, selecting a third predetermined processing algorithm from the plurality of predetermined processing algorithms by obtaining the algorithm dependency includes: and acquiring a third preset processing algorithm obtained by the logic processing thread through the algorithm dependency relationship.
According to the target object processing method provided by the embodiment, in the processing process of the target object, the first preset processing algorithm and the second preset processing algorithm in the plurality of preset processing algorithms corresponding to the target object can run in parallel, so that the time consumption for processing the whole target object is reduced. Moreover, in this embodiment, an algorithm dependency may also be stored in the electronic device, and when the algorithm dependency represents a plurality of preset processing algorithm dependencies corresponding to the target object, an algorithm (for example, a third preset processing algorithm) corresponding to each processing procedure may be directly determined through the algorithm dependency, so that convenience in obtaining an algorithm corresponding to the current processing procedure is improved. Furthermore, in the embodiment, a logic processing thread is further configured to determine an algorithm corresponding to the current processing procedure according to the algorithm dependency relationship, so that the operation of the algorithm and the selection of the algorithm can be performed by different threads.
Referring to fig. 8, a target object processing method provided by the present application is applied to an electronic device, and the method includes:
s310: and selecting a first preset processing algorithm and a second preset processing algorithm from the plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object.
S320: and running the selected first preset processing algorithm and the second preset processing algorithm in parallel.
S330: and selecting a third preset processing algorithm from the plurality of preset processing algorithms in response to receiving a triggering condition for ending the first preset processing algorithm aiming at the current processing process of the target object, and determining the target processing device from the plurality of processing devices based on the respective loads of the plurality of processing devices if the third preset processing algorithm supports the operation in the plurality of processing devices.
In addition, when the electronic device includes a plurality of processing devices, the respective functions of the plurality of processing devices may be different, and thus, the real-time loads of the different processing devices may be different. If the instantaneous load of a processing device exceeds the critical load for loading the processing device or is in a higher load state for a while, the processing device may be in a working error, and thus the tasks executed by the processing device cannot be normally operated.
There are various ways of determining the target processing device that are possible in embodiments of the present application.
As one mode, determining a target processing device from a plurality of processing devices based on respective loads of the plurality of processing devices includes: if the third preset processing algorithm supports the operation in the plurality of processing devices, acquiring respective current loads of the plurality of processing devices; and taking the corresponding processing device with the minimum current load as a target processing device.
Therefore, the processing device with the minimum current load in the plurality of processing devices supported by the algorithm corresponding to the current processing process is used as the processing device for finally running the algorithm corresponding to the current processing process, so that the algorithm can be run by using the processing device with the minimum current load, the algorithm corresponding to the current processing process can be processed and finished in a better and efficient manner, and the utilization rate of the processing devices of the electronic equipment can be improved.
Illustratively, as shown in fig. 9, a schematic diagram of processing devices supported by each of a plurality of algorithms corresponding to a target object is shown. As shown in fig. 9, a plurality of algorithms corresponding to a frame image (a target object) and algorithms on which the algorithms depend and processing devices supported by the algorithms are exemplarily given. The a-frame image may be understood as a multi-frame image obtained by a camera hal layer of the electronic device. For example, in the process of taking a picture through the electronic device, a user continuously acquires multi-frame images in response to the user touching the shooting control, the continuously acquired multi-frame images are reported by a camera hal layer of the electronic device for processing by the algorithm a, and the processing device supported by the algorithm a is the CPU. Then algorithm a is run by the CPU of the electronic device to process the a-frame image and output a b-frame result image.
After the B-frame result image is obtained, the B-frame result image and the c-frame image (also a multi-frame image reported by a camera hal layer of the electronic device) are input into an algorithm B and processed by the algorithm B. Where the processing period supported by algorithm B includes a CPU and a DSP, in which case the electronic device may select the one with the smaller load from the CPU and the DSP for running algorithm B. After the algorithm B is completely operated, 1 frame of image is output, wherein the 1 frame of image is an image with the effect of the algorithm B.
Wherein, the algorithm C1 is an algorithm for processing 1 frame image of the a frame images, and the processing devices supported by the algorithm C1 include a CPU and a DSP. In this case, the electronic device may control the less loaded processing devices in the CPU and DSP for running the algorithm C1 to process 1 of the a-frame images. Correspondingly, the algorithm D is also an algorithm for processing 1 frame image of the a frame images, and the processing devices supported by the algorithm D include a CPU and a DSP. In this case, the electronic device may control the less loaded processing devices in the CPU and DSP for running the algorithm D to process 1 of the a-frame images.
After algorithm C1 and algorithm B complete execution, algorithm C2 is triggered to run. Among them, the processing devices supported by the algorithm C2 include a CPU and an NPU. In this case, the electronics may control the less loaded processing devices in the CPU and NPU for running algorithm C2. After algorithm D and algorithm B complete execution, algorithm E1 is triggered to run. The processing devices supported by the algorithm E1 include a CPU and a GPU. In this case, the electronic device may control the less loaded processing device of the CPU and GPU for running algorithm E1.
After algorithm E1 and algorithm C2 complete execution, algorithm C3 is triggered. Among them, the processing device supported by the algorithm C3 includes a CPU. In this case, the electronic device may control the CPU to run the algorithm C3. As can be seen from fig. 4, the output of the algorithm C3 is a fused image, and after the algorithm C3 is completed, the algorithm E2 is triggered to run, and similarly, in the case that the processing devices supported by the algorithm E2 include a CPU and a GPU, the electronic device may control the processing device with a smaller load in the CPU and the GPU to run the algorithm E2, and after the algorithm E2 is completed, the final output image may be obtained.
For example, if the determined algorithm corresponding to the current processing procedure is algorithm C1, wherein the processing devices supported by algorithm C1 include a CPU and a dsp (digital Signal processor). In this case, the electronic device may obtain the respective loads of the CPU and the DSP before executing the algorithm C1, and determine that the algorithm C1 is executed by the CPU if the load of the CPU is smaller than the load of the DSP, and determine that the algorithm C1 is executed by the DSP if the load of the CPU is higher than the load of the DSP.
Alternatively, determining a target processing device from the plurality of processing devices based on respective loads of the plurality of processing devices includes: if the third preset processing algorithm supports operation in the plurality of processing devices, reading pre-stored estimated loads of the plurality of processing devices within a specified time length in the future, wherein the estimated loads are determined based on the current loads of the processing devices and the application program of the electronic equipment in operation; taking the processing device with the minimum estimated load as the target processing device
It should be noted that, in this embodiment of the application, the electronic device may store the respective real-time loads of the included processing devices through a pre-configured file, in this case, if a real-time load of a certain processing device needs to be obtained, the real-time load of the processing device may be directly read from the file, and the processing device does not need to be detected in real time to obtain a corresponding load, so as to improve a speed of obtaining the real-time load.
S340: and controlling the target processing device to run a third preset processing algorithm, wherein the third preset processing algorithm is used for performing calculation processing on the data generated by the first preset processing algorithm.
According to the target object processing method provided by the embodiment, in the processing process of the target object, the first preset processing algorithm and the second preset processing algorithm in the plurality of preset processing algorithms corresponding to the target object can run in parallel, so that the time consumption for processing the whole target object is reduced. In addition, in this embodiment, after the algorithm corresponding to the current processing process is determined, in the case that the algorithm supports operation in multiple processing devices, which processing device is specifically determined to operate in may be flexibly determined according to the load of the supported processing device, which is further beneficial to selecting a more appropriate processing device for the current processing through the corresponding algorithm, so as to improve the overall speed of processing the target object.
Referring to fig. 10, in an electronic device, a target object processing apparatus 400 provided in the present application, the apparatus 400 includes:
the algorithm determining unit 410 is configured to select a first preset processing algorithm and a second preset processing algorithm from a plurality of preset processing algorithms in response to receiving a start trigger condition for a current processing process of the target object. And an algorithm execution unit 420, configured to run the selected first preset processing algorithm and the second preset processing algorithm in parallel.
The algorithm determining unit 410 is further configured to select a third preset processing algorithm from the plurality of preset processing algorithms in response to receiving an end trigger condition of the first preset processing algorithm for the current processing process of the target object. The algorithm executing unit 420 is further configured to run a selected third preset processing algorithm, where the third preset processing algorithm is to perform calculation processing on data generated by the first preset processing algorithm.
An algorithm executing unit 420, configured to determine, if a third preset processing algorithm supports running in the plurality of processing devices, a target processing device from the plurality of processing devices based on respective loads of the plurality of processing devices; and controlling the target processing device to run a third preset processing algorithm. Optionally, the algorithm executing unit 420 is specifically configured to, if the third preset processing algorithm supports operation in multiple processing devices, obtain respective current loads of the multiple processing devices; and taking the corresponding processing device with the minimum current load as a target processing device. Optionally, the algorithm executing unit 420 is specifically configured to, if the third preset processing algorithm supports operation in multiple processing devices, read pre-stored estimated loads of the multiple processing devices within a specified time length in the future, where the estimated loads are determined based on a current load of the processing devices and an application program in which the electronic device is operating; and taking the processing device with the minimum estimated load as a target processing device.
As one mode, the algorithm determining unit 410 is specifically configured to obtain an algorithm dependency relationship in response to receiving an end trigger condition of a first preset processing algorithm for a current processing process of a target object; a third preset processing algorithm is selected from the plurality of preset processing algorithms by obtaining the algorithm dependency. Optionally, the algorithm determining unit 410 is specifically configured to trigger the logic processing thread to acquire the algorithm dependency relationship in response to receiving an end trigger condition of the first preset processing algorithm for the current processing process of the target object. Correspondingly, the method is further specifically used for acquiring a third preset processing algorithm obtained by the logic processing thread through the algorithm dependency relationship.
As a manner, the algorithm executing unit 420 is specifically configured to configure corresponding threads for the selected first preset processing algorithm and the second preset processing algorithm, respectively; and running the first preset processing algorithm and the second preset processing algorithm in parallel through threads corresponding to the first preset processing algorithm and the second preset processing algorithm respectively. Optionally, the algorithm executing unit 420 is specifically configured to obtain an occupancy level of a processing device in the electronic device; and if the occupation degree of the processing device is lower than the occupation threshold value, respectively configuring corresponding threads for the selected first preset processing algorithm and the second preset processing algorithm.
As one way, the algorithm determining unit 410 is further configured to start to perform multiple processes on the image based on multiple algorithms corresponding to the image in response to the image being captured by the camera.
According to the target object processing device provided by the embodiment, in the processing process of the target object, the first preset processing algorithm and the second preset processing algorithm in the plurality of preset processing algorithms corresponding to the target object can run in parallel, so that the time consumption for processing the whole target object is reduced.
An electronic device provided by the present application will be described with reference to fig. 10.
Referring to fig. 10, based on the target object processing method and apparatus, another electronic device 100 capable of executing the terminal control method is further provided in the embodiment of the present application. The electronic device 100 includes one or more processors 102 (only one shown), a memory 104, a network module 106, and an image acquisition apparatus 108 coupled to each other. The memory 104 stores programs that can execute the content of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104.
Processor 102 may include one or more processing cores, among other things. The processor 102 interfaces with various components throughout the electronic device 100 using various interfaces and circuitry to perform various functions of the electronic device 100 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 104 and invoking data stored in the memory 104. Alternatively, the processor 102 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 102 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 102, but may be implemented by a communication chip.
The Memory 104 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 104 may be used to store instructions, programs, code sets, or instruction sets. The memory 104 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the terminal 100 in use, such as a phonebook, audio-video data, chat log data, and the like.
The network module 106 is used for receiving and sending electromagnetic waves, and implementing interconversion between the electromagnetic waves and the electrical signals, so as to communicate with a communication network or other devices, for example, an audio playing device. Wireless module 106 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. Wireless module 106 may communicate with various networks, such as the internet, an intranet, a wireless network, or with other devices via a wireless network. The wireless network may comprise a cellular telephone network, a wireless local area network, or a metropolitan area network.
Furthermore, the image capture device 108 may be used for image capture. Optionally, the image capturing device 108 may include a color image capturing device and a depth image capturing device.
Referring to fig. 11, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer readable medium 800 has stored therein a program code that can be called by a processor to execute the method described in the above method embodiments.
The computer-readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 800 includes a non-volatile computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.
In summary, according to the target object processing method, the target object processing apparatus, and the electronic device provided in the present application, under the condition that the multiple initial processing algorithms corresponding to the target object are split based on the data on which the algorithms depend to obtain the multiple algorithms corresponding to the target object, in the process of processing the target object, the execution may be completed in response to the completion of the execution of the algorithm corresponding to the previous processing process, the algorithm corresponding to the current processing process is determined from the multiple algorithms based on the algorithm corresponding to the previous processing process, and the algorithm corresponding to the current processing process is run through the thread configured to the algorithm corresponding to the current processing process, so as to process the processing result data generated in the previous processing process. Therefore, in the processing process of the target object, the first preset processing algorithm and the second preset processing algorithm in the plurality of preset processing algorithms corresponding to the target object can run in parallel, and therefore the time consumption of the whole processing of the target object can be shortened.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (13)

1. A target object processing method is applied to an electronic device, and the method comprises the following steps:
selecting a first preset processing algorithm and a second preset processing algorithm from a plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object;
running the selected first preset processing algorithm and the second preset processing algorithm in parallel;
responding to the condition that the ending trigger of the first preset processing algorithm aiming at the current processing process of the target object is received, selecting a third preset processing algorithm from the plurality of preset processing algorithms, and operating the selected third preset processing algorithm, wherein the third preset processing algorithm is used for calculating and processing data generated by the first preset processing algorithm.
2. The method of claim 1, wherein said running the selected third predetermined processing algorithm comprises:
if the third preset processing algorithm supports operation in a plurality of processing devices, determining a target processing device from the plurality of processing devices based on respective loads of the plurality of processing devices;
and controlling the target processing device to run the third preset processing algorithm.
3. The method of claim 2, wherein determining a target processing device from the plurality of processing devices based on the respective loads of the plurality of processing devices comprises:
if the third preset processing algorithm supports operation in a plurality of processing devices, acquiring respective current loads of the plurality of processing devices;
and taking the corresponding processing device with the minimum current load as a target processing device.
4. The method of claim 2, wherein determining a target processing device from the plurality of processing devices based on respective loads of the plurality of processing devices comprises:
if the third preset processing algorithm supports operation in the plurality of processing devices, reading pre-stored estimated loads of the plurality of processing devices within a specified time length in the future, wherein the estimated loads are determined based on the current loads of the processing devices and the application program of the electronic equipment in operation;
and taking the processing device with the minimum corresponding estimated load as a target processing device.
5. The method of claim 1, wherein selecting a third pre-set processing algorithm from the plurality of pre-set processing algorithms in response to receiving an end trigger condition for the first pre-set processing algorithm for the current processing of the target object comprises:
the method comprises the steps of responding to the fact that a triggering condition for ending a first preset processing algorithm aiming at the current processing process of a target object is received, and obtaining an algorithm dependency relationship;
and selecting a third preset processing algorithm from the plurality of preset processing algorithms according to the acquired algorithm dependency relationship.
6. The method according to claim 5, wherein the obtaining algorithm dependency in response to receiving an end trigger condition of a first preset processing algorithm for a current processing procedure of the target object comprises:
triggering a logic processing thread to acquire an algorithm dependency relationship in response to receiving a triggering condition for ending a first preset processing algorithm aiming at the current processing process of a target object;
selecting a third preset processing algorithm from the plurality of preset processing algorithms by obtaining the algorithm dependency relationship, wherein the method comprises the following steps:
and acquiring a third preset processing algorithm acquired by the logic processing thread through the algorithm dependency relationship.
7. The method of claim 1, wherein the running the selected first and second pre-set processing algorithms in parallel comprises:
configuring corresponding threads for the selected first preset processing algorithm and the second preset processing algorithm respectively;
and running the first preset processing algorithm and the second preset processing algorithm in parallel through threads corresponding to the first preset processing algorithm and the second preset processing algorithm respectively.
8. The method according to claim 7, wherein the configuring the selected first and second predetermined processing algorithms with corresponding threads respectively comprises:
acquiring the occupation degree of a processing device in the electronic equipment;
and if the occupation degree of the processing device is lower than an occupation threshold value, respectively configuring corresponding threads for the selected first preset processing algorithm and the selected second preset processing algorithm.
9. The method according to any one of claims 1 to 8, wherein the target object is an image captured by a camera, and wherein selecting a first predetermined processing algorithm and a second predetermined processing algorithm from a plurality of predetermined processing algorithms in response to receiving a trigger condition for initiating a current processing procedure of the target object further comprises:
and responding to the image acquired by the camera, and starting to process the image for multiple times based on multiple algorithms corresponding to the image.
10. A target object processing method is applied to a server, and the method comprises the following steps:
selecting a first preset processing algorithm and a second preset processing algorithm from a plurality of preset processing algorithms in response to receiving a starting trigger condition aiming at the current processing process of the target object;
running the selected first preset processing algorithm and the second preset processing algorithm in parallel;
responding to the condition that the ending trigger of the first preset processing algorithm aiming at the current processing process of the target object is received, selecting a third preset processing algorithm from the plurality of preset processing algorithms, and operating the selected third preset processing algorithm, wherein the third preset processing algorithm is used for calculating and processing data generated by the first preset processing algorithm.
11. A target object processing apparatus, operable on an electronic device, the apparatus comprising:
the algorithm determining unit is used for responding to the fact that a starting triggering condition aiming at the current processing process of the target object is received, and selecting a first preset processing algorithm and a second preset processing algorithm from the plurality of preset processing algorithms;
the algorithm execution unit is used for running the selected first preset processing algorithm and the second preset processing algorithm in parallel;
the algorithm determining unit is further configured to select a third preset processing algorithm from the plurality of preset processing algorithms in response to receiving a triggering condition for ending the first preset processing algorithm for the current processing process of the target object, and the algorithm executing unit is further configured to run the selected third preset processing algorithm, where the third preset processing algorithm is to perform calculation processing on data generated by the first preset processing algorithm.
12. An electronic device comprising one or more processors and memory;
one or more programs stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-9.
13. A computer-readable storage medium, having program code stored therein, wherein the method of any of claims 1-9 is performed when the program code is run.
CN202210533507.8A 2022-05-13 2022-05-13 Target object processing method and device and electronic equipment Pending CN114968564A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210533507.8A CN114968564A (en) 2022-05-13 2022-05-13 Target object processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210533507.8A CN114968564A (en) 2022-05-13 2022-05-13 Target object processing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114968564A true CN114968564A (en) 2022-08-30

Family

ID=82984271

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210533507.8A Pending CN114968564A (en) 2022-05-13 2022-05-13 Target object processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114968564A (en)

Similar Documents

Publication Publication Date Title
WO2021057619A1 (en) Memory reclamation method and apparatus, electronic device, and storage medium
CN111782403B (en) Data processing method and device and electronic equipment
CN111163345A (en) Image rendering method and device
CN107295352B (en) Video compression method, device, equipment and storage medium
US20220058772A1 (en) Image Processing Method and Device
JP2022509191A (en) Video decoding control methods, devices, electronic devices and storage media
CN111782402A (en) Data processing method and device and electronic equipment
CN110599581B (en) Image model data processing method and device and electronic equipment
CN112291475A (en) Photographing method and device and electronic equipment
CN112487223A (en) Image processing method and device and electronic equipment
CN111813529B (en) Data processing method, device, electronic equipment and storage medium
CN114968564A (en) Target object processing method and device and electronic equipment
CN114995898A (en) Target object processing method and device and electronic equipment
CN112052089B (en) Memory recovery method and device and electronic equipment
CN114860447A (en) Object processing method and device and electronic equipment
CN115587049A (en) Memory recovery method and device, electronic equipment and storage medium
US11900661B2 (en) Image processing method, device, storage medium and camera
CN111444022B (en) Data processing method, system and electronic equipment
CN112099736A (en) Data storage method and device, electronic equipment and storage medium
CN108647097B (en) Text image processing method and device, storage medium and terminal
CN117130764A (en) Algorithm operation method, device, electronic equipment and storage medium
CN106776010B (en) Resource allocation method and terminal
CN112037814A (en) Audio fingerprint extraction method and device, electronic equipment and storage medium
CN115004643B (en) Authority configuration method, device, node equipment and data processing system
CN117011154A (en) Image processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination