A processing method and apparatus
By transferring the model file to the target processing unit's file system, which then parses and stores it, the problem of low central processing unit efficiency is solved, and the loading efficiency of model files is improved.
Patent Information
- Application Number
- CN202110341342.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-30
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2041-11-21
AI Technical Summary
The central processing unit is not good at processing model files, resulting in low loading efficiency of model files on electronic devices.
The target model file is transferred from the central processing unit to the file system of the target processing unit, which then parses the model file to obtain the processing logic and loads the corresponding file system for storage and management.
This reduces the workload on the central processing unit and improves the loading efficiency of model files on electronic devices.
Smart Images

Figure CN113094331B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a processing method in the processing field, in particular to a processing method and device. BACKGROUND
[0002] The model file refers to a file obtained by saving network parameters and model structures generated finally after a model is built by a deep learning framework, is parameterized and trained and optimized. Currently, the loading of the model file by an electronic device is performed by a central processing unit to analyze the model file and send the analyzed data to a computing unit, and then the computing unit generates processing logic according to the analyzed data. However, the central processing unit is not good at processing the model file, resulting in low loading efficiency of the model file on the electronic device. SUMMARY
[0003] The technical solution of the present application is implemented as follows:
[0004] A processing method comprises the following steps:
[0005] obtaining a target model file;
[0006] determining a target processing unit in an electronic device, wherein the target processing unit is loaded with a corresponding file system;
[0007] sending the target model file to the file system corresponding to the target processing unit by a central processing unit, so that the target processing unit analyzes the target model file to obtain corresponding processing logic, and the processing logic can represent the relationship between input data and output results of the target model file.
[0008] In the above solution, the determination of the target processing unit in the electronic device comprises:
[0009] obtaining configuration information of the electronic device, and determining the target processing unit based at least on the configuration information; or
[0010] obtaining running information of the electronic device, and determining the target processing unit from processing units of the electronic device based at least on the running information; or
[0011] obtaining attribute information of the target model file, and determining the target processing unit from processing units of the electronic device based at least on the attribute information.
[0012] In the above solution, the analysis of the target model file to obtain the corresponding processing logic comprises:
[0013] analyzing the target model file into at least two matrix data, forming an interface of an artificial intelligence model based on the at least two matrix data, and obtaining the processing logic.
[0014] The above scheme further comprises:
[0015] Obtaining a first task, giving the to-be-processed data in the first task to the determined target processing unit, and in the case that the target processing unit obtains a processing result through the processing logic, receiving the processing result sent by the target processing unit.
[0016] In the above scheme, if it is determined that the first task cannot be processed by the processing logic of the target processing unit, the target model file is updated; or,
[0017] If the update information of the target model file is obtained, the updated target model file is given to the file system corresponding to the target processing unit to update the processing logic obtained by the target processing unit.
[0018] In the above scheme, the target processing unit in the electronic device is determined, comprising:
[0019] The first processing unit and the second processing unit in the electronic device are determined.
[0020] Correspondingly, the target model file is given to the file system corresponding to the target processing unit by the central processing unit, so that the target processing unit analyzes the target model file to obtain the corresponding processing logic, comprising:
[0021] The target model file is given to the first file system corresponding to the first processing unit and to the second file system corresponding to the second processing unit by the central processing unit, so that the first processing unit analyzes the target model file to obtain the first processing logic, and the second processing unit analyzes the target model file to obtain the second processing logic.
[0022] The above scheme further comprises:
[0023] Obtaining a second task, giving the first to-be-processed data in the second task to the first processing unit and the second to-be-processed data in the second task to the second processing unit, and in the case that the first processing unit obtains a first processing result through the first processing logic and the second processing unit obtains a second processing result through the second processing logic, receiving the first processing result sent by the first processing unit and the second processing result sent by the second processing unit.
[0024] The above scheme further comprises:
[0025] If it is determined that the first task cannot be processed by the processing logic of the target processing unit, the target model file corresponding to the first task is obtained based on the to-be-processed data in the first task;
[0026] The central processor sends the target model file corresponding to the first task to the file system corresponding to the target processing unit, so that the target processing unit parses the target model file corresponding to the first task to obtain corresponding processing logic;
[0027] The central processor sends the to-be-processed data to the target processing unit corresponding to the target model file corresponding to the first task, and processes the to-be-processed data by the target processing unit to obtain a processing result.
[0028] In the above scheme, further comprising:
[0029] Obtaining a third task and determining attribute information of the third task;
[0030] Based on the attribute information of the third task, determining a plurality of target model files corresponding to the third task in the file system;
[0031] Based on the attribute information of the third task, determining a plurality of target model files corresponding to the third task in the file system;
[0032] For each group of to-be-processed sub-data, based on the target processing unit of each target model file corresponding to the third task, processing each group of to-be-processed sub-data to obtain a plurality of groups of processing sub-results;
[0033] Based on the plurality of groups of processing sub-results, obtaining a processing result.
[0034] A processing device, comprising:
[0035] An acquisition unit configured to obtain a target model file;
[0036] A processing unit configured to determine a target processing unit in an electronic device, the target processing unit loaded with a corresponding file system;
[0037] The processing unit is further configured to send the target model file to the file system corresponding to the target processing unit through a central processor, so that the target processing unit parses the target model file to obtain corresponding processing logic, and the processing logic can represent the relationship between the input data and the output result of the target model file.
[0038] An electronic device, comprising a memory, a processor and a communication bus;
[0039] The communication bus is configured to realize the communication connection between the processor and the memory;
[0040] The processor is configured to execute a processing program stored in the memory to realize the following steps:
[0041] obtain a target model file;
[0042] determine a target processing unit in the electronic device, the target processing unit being loaded with a corresponding file system;
[0043] deliver, by a central processing unit, the target model file to the file system corresponding to the target processing unit, so that the target processing unit parses the target model file to obtain corresponding processing logic, the processing logic being capable of representing a relationship between input data and output results of the target model file.
[0044] A computer-readable storage medium stores one or more programs, which are executable by one or more processors to implement steps of a processing method.
[0045] The processing method and device provided by the embodiments of the present application obtain a target model file; determine a target processing unit in the electronic device, the target processing unit being loaded with a corresponding file system; and deliver, by a central processing unit, the target model file to the file system corresponding to the target processing unit, so that the target processing unit parses the target model file to obtain corresponding processing logic, the processing logic being capable of representing a relationship between input data and output results of the target model file. In this way, only the target processing unit is determined to parse the target model file, and the target model file is stored by the file system loaded by the target processing unit, without the central processing unit being used to process the target model file as in the related art, so that the working load of the central processing unit is reduced, and the loading efficiency of the target model file on the electronic device is improved. BRIEF DESCRIPTION OF DRAWINGS
[0046] Figure 1 A flowchart of a processing method provided by the embodiments of the present application is shown;
[0047] Figure 2 A flowchart of another processing method provided by the embodiments of the present application is shown;
[0048] Figure 3 A structure diagram of a target model provided by the embodiments of the present application is shown;
[0049] Figure 4 A flowchart of still another processing method provided by the embodiments of the present application is shown;
[0050] Figure 5 A structure diagram of a processing device provided by the embodiments of the present application is shown;
[0051] Figure 6 A structure diagram of a processing device provided by the embodiments of the present application is shown. DETAILED DESCRIPTION
[0052] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.
[0053] The present embodiment provides a processing method, which is applied to an electronic device, such as a mobile phone. Figure 1 As shown in the figure, the method comprises the following steps:
[0054] Step 101, obtaining a target model file.
[0055] The target model file refers to a target model in the form of a file. In a feasible implementation manner, the target model file can be a target model built by using a deep learning framework, and after parameter tuning and training optimization, the network parameters and the structure of the target model are saved together to obtain the file.
[0056] In the present embodiment, there are two ways to obtain the target model file, mainly active acquisition and passive acquisition; wherein the active acquisition refers to that the electronic device actively downloads the target model file through the network; the passive acquisition refers to that the electronic device receives the download instruction of the user and downloads the target model file through the network, or the user sends the target model file to the electronic device through the terminal. In a feasible implementation manner, the central processing unit in the electronic device can obtain the target model file.
[0057] Step 102, determining a target processing unit in the electronic device.
[0058] The target processing unit is loaded with a corresponding file system; the target processing unit is a processing unit capable of processing the target model file, which is also called a computing unit; the number of processing units in the electronic device includes at least one; the number of target processing units includes at least one. The processing unit includes a video processing unit (VPU), a graphics processing unit (GPU), a field programmable logic gate array (FPGA) and / or a digital signal processing unit (DSP).
[0059] In the embodiments of the present application, the electronic device can determine a target processing unit corresponding to the target model file from a plurality of processing units in the electronic device based on relevant parameters of the electronic device itself and / or attribute information of the target model file. In a feasible implementation manner, if the target model file represents a face recognition model in the form of a file for processing an image, the electronic device can determine a GPU that can be used for processing the image from the plurality of processing units based on the target model file, and the GPU can serve as the target processing unit. The relevant parameters of the electronic device itself include configuration information of the electronic device and / or running information of the electronic device. In a feasible implementation manner, the target processing unit in the electronic device can be determined by a central processing unit in the electronic device.
[0060] It should be noted that each processing unit of the electronic device is loaded with a corresponding file system, and the number of processing units in the electronic device corresponds to the number of file systems. The file systems of the processing units can be the same or different.
[0061] In step 103, the central processing unit delivers the target model file to the file system corresponding to the target processing unit, so that the target processing unit parses the target model file to obtain the corresponding processing logic.
[0062] The processing logic can represent the relationship between the input data and the output result of the target model file. The file system corresponding to the target processing unit is used to maintain, manage and store the target model file.
[0063] In the embodiments of the present application, the target processing unit can obtain the target model file from the file system of the target processing unit, and then the target processing unit can parse the target model file to obtain the processing logic corresponding to the target model file, so that the target processing unit performs corresponding processing based on the processing logic in the subsequent process.
[0064] It should be noted that the file system corresponding to the target processing unit can store the target model file. When the electronic device is powered off, the target processing unit does not lose the target model file. When the electronic device is powered on, the target processing unit can directly obtain the target model file from the file system loaded by itself, without the need for the central processing unit to deliver the target model file to the target processing unit again, thereby reducing the work load of the central processing unit of the electronic device and improving the work efficiency of the target processing unit.
[0065] The processing method provided in the embodiments of the present application obtains a target model file; determines a target processing unit in the electronic device, the target processing unit being loaded with a corresponding file system; and the target model file is given to the file system corresponding to the target processing unit through a central processing unit, so that the target processing unit analyzes the target model file to obtain corresponding processing logic, the processing logic being capable of representing the relationship between the input data and the output result of the target model file. In this way, only the target processing unit needs to be determined to analyze the target model file, and the target model file is stored through the file system loaded by the target processing unit, without the central processing unit being used to process the target model file as in the related art, thereby reducing the work load of the central processing unit and improving the loading efficiency of the target model file on the electronic device.
[0066] Based on the foregoing embodiments, the embodiments of the present application provide a processing method, as shown in Figure 2 The method comprises the following steps:
[0067] In step 201, the electronic device obtains a target model file.
[0068] In step 202, the electronic device obtains configuration information of the electronic device, and determines a target processing unit based on at least the configuration information.
[0069] The configuration information of the electronic device comprises the number of processing units in the electronic device and / or the category of the processing units in the electronic device.
[0070] In the embodiments of the present application, the electronic device can scan the hardware configuration of itself, obtain the number of processing units and the category of the processing units in the electronic device, and obtain the target processing unit from at least one processing unit based on the number and the category of the processing units.
[0071] In a feasible implementation manner, if the configuration information of the electronic device indicates that the electronic device only has a VPU, the VPU can be used as the target processing unit, and any target model file obtained by the electronic device can be processed by the VPU. If the electronic device has multiple processing units, the optimal target processing unit can be determined for the target model file based on the number and the category of the processing units. The category of the processing units refers to the type of data that the processing units are good at processing. The type of data comprises one of an image, a video and an audio.
[0072] It should be noted that each processing unit in the electronic device can process any target model file, but each processing unit has its own processing data, and therefore, in the target processing unit, the processing unit that is most suitable for processing the target model file can be selected (for example, the data that the VPU is most suitable for processing is video data; the data that the GPU is most suitable for processing is image data; and the data that the DSP is most suitable for processing is audio data).
[0073] In step 203, the electronic device obtains running information of the electronic device, and determines a target processing unit from the processing units of the electronic device based at least on the running information.
[0074] In the embodiments of the present application, the running information of the electronic device represents the running state of each component in the electronic device, and the running information of the electronic device includes the working state of each processing unit in the electronic device and / or the working load of each processing unit.
[0075] In the embodiments of the present application, based on the working states of the plurality of processing units, a processing unit in an idle state is determined from the plurality of processing units, and then the target processing unit is determined from the processing unit in the idle state. When there is no processing unit in the idle state in the plurality of processing units, the electronic device can determine a processing unit with a smaller load as the target processing unit from the plurality of processing units based on the load of each processing unit.
[0076] In a feasible implementation, there are five processing units in the electronic device. If the electronic device determines that only one processing unit in the five processing units is in an idle state, the electronic device can determine the processing unit corresponding to the idle state as the target processing unit. If the electronic device determines that three processing units in the five processing units are in the idle state, the electronic device can determine any one of the three idle processing units as the target processing unit. If none of the five processing units in the electronic device is in the idle state, the processing unit with the smallest load in the five processing units can be determined as the target processing unit.
[0077] In step 204, the electronic device obtains attribute information of the target model file, and determines a target processing unit from the processing units of the electronic device based at least on the attribute information.
[0078] In the embodiments of the present application, the attribute information of the target model file represents the type of input data of the target model, and the type of input data of the target model includes at least one of an image, a video, and audio.
[0079] In the embodiments of the present application, the electronic device can analyze the target model file to determine the type of input data of the target model in the target model file, and then determine the target processing unit corresponding to the type of input data of the target model from the processing units of the electronic device.
[0080] In a feasible implementation, the electronic device determines that the type of the input data of the target model is audio, and then determines the DSP as the target processing unit from the processing units; if the electronic device determines that the type of the input data of the target model is image and audio, then the electronic device determines the DSP and the GPU as the target processing units from the processing units. The target processing unit is determined based on the type of the input data of the target model, and specifically, the type of the input data of the target model is matched with the data types in the attribute parameters of the plurality of processing units that are stored in advance, and the processing unit corresponding to the matched data type is determined as the target processing unit. The data types in the attribute parameters of the processing units represent the data that the processing units are good at processing (for example, the data that the VPU is good at processing is video data).
[0081] In the embodiments of the present application, the target processing unit can be determined based on any two of the configuration information of the electronic device, the running information of the electronic device, and the attribute information of the target model file; or the target processing unit can be determined based on all of the configuration information of the electronic device, the running information of the electronic device, and the attribute information of the target model file.
[0082] In a feasible implementation, the target processing unit is determined based on the configuration information of the electronic device and the running information of the electronic device. When the configuration information of the electronic device shows that there are two processing units, the two processing units are respectively a VPU and a GPU. When the target model file is received, the electronic device can determine whether there is a processing unit in an idle state in the VPU and the GPU based on the running information of the electronic device. If the determination result shows that the VPU is in an idle state, the VPU is determined as the target processing unit. If the determination result shows that the VPU and the GPU are both in a non-idle state, the processing unit with a smaller load is determined as the target processing unit from the VPU and the GPU based on the load of the VPU in the VPU running information and the load of the GPU in the GPU running information.
[0083] In another implementation, the target processing unit is determined based on the configuration information of the electronic device, the running information of the electronic device, and the attribute information of the target model file. When the running information of the electronic device shows that the VPU and the GPU in the current processing units are both in an idle state, the attribute parameters of the VPU and the GPU in the configuration information of the electronic device are matched with the attribute information of the target model file. For example, when the attribute parameters of the target model file represent that the type of the input data of the target model is video, the VPU that is good at processing video is determined from the attribute parameters of the processing units, and the VPU is determined as the target processing unit.
[0084] In step 205, the electronic device sends the target model file to the file system corresponding to the target processing unit through the central processing unit, so that the target processing unit parses the target model file into at least two matrix data, forms an interface of an artificial intelligence model based on the at least two matrix data, and obtains processing logic.
[0085] The at least two matrixes include a multiplication matrix and an addition matrix. The interface of the artificial intelligence model refers to an interface of a target model, which is an artificial intelligence (AI) model. The interface of the target model can include an interface of input data and an interface of output data of the target model.
[0086] In the embodiments of the present application, the target processing unit can parse the target model file to obtain data of each node of a target model structure of the target model in the target model file, analyze data of a plurality of input nodes, a plurality of output nodes and intermediate operation nodes of the target model structure, extract a multiplication matrix and an addition matrix of the target model structure, generate an interface of an artificial intelligence model corresponding to the target model file based on elements in the multiplication matrix and the addition matrix, and obtain processing logic based on the interface of the artificial intelligence model.
[0087] In a feasible implementation manner, as shown in Figure 3 There are 4 input nodes and 3 output nodes in the artificial intelligence model structure. When x1, x2, x3 and x4 data are sequentially input from the 4 input nodes, the plurality of sub-nodes in the artificial intelligence model structure can sequentially output y1, y2 and y3 data at the output nodes after operating the x1, x2, x3 and x4 data. The target processing unit analyzes data of each node, can extract a weight matrix A and a bias (Bias) matrix B (the bias matrix can also be called a bias matrix) from the data of the plurality of nodes, analyzes elements in the weight matrix A and the bias matrix B, generates an interface of an artificial intelligence model, and generates processing logic based on the interface of the artificial intelligence model. The processing logic can be represented by a function Y=f(X). The weight matrix A is a multiplication matrix. The bias matrix B is an addition matrix. X represents input data of the target model in the target model file. Y represents output results (also referred to as output data) of the target model in the target model file.
[0088] In the embodiment of the present application, the target model file is given to the file system corresponding to the target processing unit, so as to facilitate the file system to manage, maintain and store the target model file; when the electronic device is powered off, the target processing unit does not lose the target model file, and when the electronic device is powered on, the target processing unit can obtain the target model file from the file system of the target processing unit, without the need of the central processing unit to send the target model file to the target processing unit again, thereby reducing the load of the central processing unit. Moreover, the target processing unit can directly obtain the target model file from the file system of the target processing unit, without the need of waiting for the central processing unit to send the target model file, thereby reducing the time for the target processing unit to obtain the target model file and reducing the network overhead.
[0089] It should be noted that in one embodiment, steps 206-209 can be performed after step 205; in another embodiment, step 210 or step 211 can be performed after step 205; in yet another embodiment, steps 206-210 or steps 206-209 and 211 can be performed after step 205.
[0090] In step 206, the electronic device obtains a first task, gives the to-be-processed data in the first task to the determined target processing unit, and receives the processing result sent by the target processing unit in the case that the target processing unit obtains the processing result through the processing logic.
[0091] The first task can be sent by a user to the electronic device through a terminal.
[0092] In the embodiment of the present application, the electronic device can obtain the content of the first task, give the to-be-processed data in the first task content to the previously determined target processing unit, and when the processing logic of the target processing unit can process the to-be-processed data, the target processing unit can process the to-be-processed data and feed back the processing result obtained after processing to the electronic device.
[0093] In a feasible implementation manner, the first task obtained by the electronic device is an image license plate recognition task, the electronic device can give the to-be-processed data in the content of the first task to the previously determined GPU, and when the processing logic in the GPU can process the to-be-processed data, the license plate recognition result after processing can be fed back to the electronic device. The target model in the target model file corresponding to the GPU can be a license plate recognition model, and the processing logic can be the processing logic of the license plate recognition model.
[0094] In step 207, if it is determined that the first task cannot be processed by the processing logic of the target processing unit, the electronic device obtains the target model file corresponding to the first task based on the to-be-processed data in the first task.
[0095] In the embodiment of the present application, if it is determined that the first task cannot be processed by the processing logic of the target processing unit, and there is no target model file corresponding to the first task in the file system of the electronic device, the target model file corresponding to the first task needs to be reacquired. The target model file corresponding to the first task can be acquired by actively downloading the target model file corresponding to the first task through the network, or a prompt information is generated based on the first task and is sent to the terminal corresponding to the user to prompt the user to send the target model file corresponding to the first task to the electronic device through the terminal.
[0096] In step 208, the electronic device sends the target model file corresponding to the first task to the file system corresponding to the target processing unit through the central processing unit, so that the target processing unit parses the target model file corresponding to the first task to obtain the corresponding processing logic.
[0097] In the embodiment of the present application, when the electronic device acquires the target model file corresponding to the first task, the target model file can be sent to the file system corresponding to the target processing unit in the plurality of processing units, so that the file system stores the target model file corresponding to the first task, and the target processing unit can obtain the target model file from the file system of itself and parse the target model file to obtain the processing logic corresponding to the target model file corresponding to the first task.
[0098] In step 209, the electronic device sends the to-be-processed data to the target processing unit corresponding to the target model file corresponding to the first task through the central processing unit, and processes the to-be-processed data through the target processing unit to obtain a processing result.
[0099] In step 210, if it is determined that the first task cannot be processed by the processing logic of the target processing unit, the electronic device updates the target model file.
[0100] In the embodiment of the present application, all the model files acquired by the electronic device are target model files. That is, the target model file is a general term of all the model files acquired by the electronic device.
[0101] In the embodiment of the present application, if the first task cannot be processed by the processing logic of the target processing unit, it indicates that there is no model file corresponding to the first task in the target model file, and the target model file corresponding to the first task needs to be reacquired to parse the acquired target model file corresponding to the first task to obtain the processing logic of the target model file corresponding to the first task, and the processing logic of the target model file corresponding to the first task is used to actively update the processing logic in the target processing unit.
[0102] In a feasible implementation, if the first task represents a face recognition task in an image, and the task that the processing logic in the target processing unit can process is a license plate recognition task, the processing logic in the target processing unit cannot process the to-be-processed data in the first task, and then the electronic device can actively initiate an acquisition request for the target model file of the face recognition task to acquire the target model file corresponding to the face recognition task. After that, the target processing unit can parse the obtained target model file corresponding to the face recognition task to obtain new processing logic, and process the to-be-processed data in the first task by using the new processing logic to obtain a processing result.
[0103] In step 211, if the update information of the target model file is obtained, the electronic device sends the updated target model file to the file system corresponding to the target processing unit to update the processing logic obtained by the target processing unit.
[0104] In the embodiments of the present application, when the electronic device receives the update information of the target model file, the electronic device can obtain the to-be-updated model file from the update information of the target model file, and then send the to-be-updated model file to the target processing unit, so that the target processing unit can parse the to-be-updated model file to obtain new processing logic corresponding to the to-be-updated model file, and then update the processing logic in the target processing unit by using the new processing logic.
[0105] Based on the foregoing embodiments, in other embodiments of the present application, after step 201, the following steps can be further included:
[0106] In step A, the first processing unit and the second processing unit in the electronic device are determined.
[0107] In the embodiments of the present application, the electronic device can determine a plurality of target processing units for the target model file, wherein the plurality of target processing units include the first processing unit and the second processing unit, and the first processing unit and the second processing unit can both process the target model file.
[0108] In a feasible implementation, when the electronic device acquires the target model file, if it is determined that the VPU and the GPU in the plurality of processing units are in an idle state, the VPU and the GPU can both be used as the processing unit of the target model file, wherein the VPU can be the first processing unit, and the GPU can be the second processing unit.
[0109] It should be noted that the first processing unit and the second processing unit can be determined based on at least one of the running information of the electronic device, the configuration information of the electronic device, and the attribute information of the target model file.
[0110] Step B, the electronic device sends the target model file to a first file system corresponding to the first processing unit and to a second file system corresponding to the second processing unit through the central processing unit, so that the first processing unit parses the target model file to obtain the first processing logic, and the second processing unit parses the target model file to obtain the second processing logic.
[0111] The first processing logic can be the same or different.
[0112] In the embodiments of the present application, the first processing unit and the second processing unit are processing units determined by the electronic device and capable of processing the target model file; the target processing unit includes the first processing unit and the second processing unit.
[0113] In a possible implementation, the target model in the target model file can include a face recognition model and a voiceprint recognition model, and the central processing unit can send the target model file to a processing unit good at processing images and a processing unit good at processing audio, respectively, so that the processing unit good at processing images can parse the target model file to obtain the first processing logic representing the input data and the output result of the face recognition model, and the processing unit good at processing audio can parse the target model file to obtain the second processing logic representing the input data and the output result of the voiceprint recognition model. The first processing logic and the second processing logic are different; the first processing unit can be the processing unit good at processing images, and the first processing unit can be a GPU in particular; the second processing unit can be the processing unit good at processing audio, and the second processing unit can be a DSP in particular.
[0114] Step C, the electronic device obtains a second task, sends first to-be-processed data in the second task to the first processing unit and second to-be-processed data in the second task to the second processing unit, and receives the first processing result sent by the first processing unit and the second processing result sent by the second processing unit in the case that the first processing unit obtains the first processing result through the first processing logic and the second processing unit obtains the second processing result through the second processing logic.
[0115] In the embodiments of the present application, when the electronic device obtains the second task, the to-be-processed data can be segmented according to the type of the to-be-processed data and / or the size of the to-be-processed data in the second task, and the first to-be-processed data and the second to-be-processed data can be obtained.
[0116] In a feasible implementation, the data type of the to-be-processed data in the second task includes images and audio, and the electronic device can extract image data and audio data from the to-be-processed data based on the data type of the to-be-processed data, and then give the image data to the previously determined VPU or GPU and give the audio data to the previously determined DSP. In another implementation, the to-be-processed data in the second task includes text, and the electronic device can divide the text into two parts based on the size of the text to obtain first to-be-processed data and second to-be-processed data; the first to-be-processed data and the second to-be-processed data have a certain arrangement order, and then the first to-be-processed data and the second to-be-processed data are given to the previously determined first processing unit and the second processing unit, respectively.
[0117] It should be noted that the descriptions of the same steps and the same contents in the embodiments can refer to the descriptions in other embodiments, and will not be described here.
[0118] The processing method provided in the embodiments of the present application only needs to determine the target processing unit to parse the target model file, and store the target model file through the file system loaded by the target processing unit, without using the central processor to process the target model file as in the related art, thereby reducing the workload of the central processor and improving the loading efficiency of the target model file on the electronic device.
[0119] Based on the foregoing embodiments, in other embodiments of the present application, referring to FIG. 3, the processing method can further include the following steps: Figure 4
[0120] Step 301: The electronic device obtains a third task and determines attribute information of the third task.
[0121] In the embodiments of the present application, the third task can be sent by the user to the electronic device through the terminal; after the electronic device obtains the third task, the content of the third task can be obtained, and the attribute information of the third task can be determined from the content of the third task. The attribute information of the third task includes the data type of the to-be-processed data in the third task and / or the task identifier of the third task.
[0122] Step 302: The electronic device determines a plurality of target model files corresponding to the third task in the file system based on the attribute information of the third task.
[0123] In the embodiments of the present application, the task identifier of the third task can be matched with a plurality of model identifiers in a pre-stored model file identifier table, and the model file corresponding to the model identifier matched with the task identifier of the third task can be taken as the target model file. The model identifier represents the role of the target model file in the electronic device.
[0124] In step 303, the electronic device determines, based on the attribute information of the third task, the to-be-processed sub-data corresponding to each target model file in the plurality of target model files corresponding to the third task from the to-be-processed data of the third task.
[0125] In the embodiment of the present application, the electronic device can segment the to-be-processed data in the third task based on the type of the to-be-processed data in the third task to obtain a plurality of to-be-processed sub-data, and then determine the corresponding target model file for the plurality of to-be-processed sub-data based on the task identifier of the third task.
[0126] In a feasible implementation manner, the electronic device can segment the to-be-processed data based on the type of the to-be-processed data in the third task to obtain to-be-processed sub-data corresponding to an image and to-be-processed sub-data corresponding to audio; then, if the to-be-processed task identifier is a face identifier and an audio identifier, the electronic device can determine a target model file corresponding to the face identifier and a target model file corresponding to the audio identifier from the target model files, and give the to-be-processed sub-data corresponding to the image to the target model file corresponding to the face identifier and give the to-be-processed sub-data corresponding to the audio to the target model file corresponding to the audio identifier.
[0127] In step 304, the electronic device processes each group of to-be-processed sub-data based on the target processing unit of each target model file corresponding to the third task to obtain a plurality of groups of processing sub-results.
[0128] In the embodiment of the present application, each group of to-be-processed sub-data can be processed through the plurality of processing logics of the plurality of target model files corresponding to the third task, and finally the processing sub-result of each target model file corresponding to the third task can be obtained.
[0129] In step 305, the electronic device obtains a processing result based on the plurality of groups of processing sub-results.
[0130] In the embodiment of the present application, the electronic device can analyze the plurality of groups of processing sub-results, establish a corresponding relationship between the plurality of groups of processing sub-results, and combine based on the corresponding relationship to obtain the processing result.
[0131] The processing method provided in the embodiment of the present application only needs to determine the target processing unit to parse the target model file, and store the target model file through the file system loaded by the target processing unit, without using the central processing unit to process the target model file as in the related art, thereby reducing the work load of the central processing unit and improving the loading efficiency of the target model file on the electronic device.
[0132] Based on the foregoing embodiment, the embodiment of the present application provides a processing device, which can be applied to Figure 1 、 2The embodiments corresponding to the fourth aspect provide a processing method. The method comprises the following steps: Figure 5 The processing device comprises:
[0133] The obtaining unit 41 is configured to obtain a target model file.
[0134] The processing unit 42 is configured to determine a target processing unit in the electronic device, and the target processing unit is loaded with a corresponding file system.
[0135] The processing unit 42 is further configured to send the target model file to the file system corresponding to the target processing unit through the central processing unit, so that the target processing unit parses the target model file to obtain corresponding processing logic, and the processing logic is capable of representing a relationship between input data and output results of the target model file.
[0136] In the embodiments of the present application, referring to Figure 5 The obtaining unit 41 is further configured to perform the following steps:
[0137] Obtain configuration information of the electronic device, and determine the target processing unit based at least on the configuration information; or
[0138] Obtain running information of the electronic device, and determine the target processing unit from the processing units of the electronic device based at least on the running information; or
[0139] Obtain attribute information of the target model file, and determine the target processing unit from the processing units of the electronic device based at least on the attribute information.
[0140] In the embodiments of the present application, referring to Figure 5 The processing unit 42 is further configured to perform the following steps:
[0141] Parse the target model file into at least two matrix data, form an interface of an artificial intelligence model based on the at least two matrix data, and obtain the processing logic.
[0142] In the embodiments of the present application, referring to Figure 5 The processing unit 42 is further configured to perform the following steps:
[0143] Obtain a first task, send the to-be-processed data in the first task to the determined target processing unit, and receive the processing result sent by the target processing unit in a case that the target processing unit obtains the processing result through the processing logic.
[0144] In the embodiments of the present application, referring to Figure 5 The processing unit 42 is further configured to perform the following steps:
[0145] If it is determined that the first task cannot be processed by the processing logic of the target processing unit, update the target model file; or
[0146] If the update information of the target model file is obtained, the updated target model file is given to the file system corresponding to the target processing unit 42 to update the processing logic obtained by the target processing unit.
[0147] In the embodiments of the present application, with reference to Figure 5 , the processing unit 42 is further configured to perform the following steps:
[0148] determining a first processing unit and a second processing unit in the electronic device;
[0149] the central processor gives the target model file to the first file system corresponding to the first processing unit and to the second file system corresponding to the second processing unit, so that the first processing unit parses the target model file to obtain the first processing logic, and the second processing unit parses the target model file to obtain the second processing logic.
[0150] In the embodiments of the present application, with reference to Figure 5 , the processing unit 42 is further configured to perform the following steps:
[0151] obtain a second task, give the first to-be-processed data in the second task to the first processing unit, and give the second to-be-processed data in the second task to the second processing unit; in the case that the first processing unit obtains the first processing result through the first processing logic and the second processing unit obtains the second processing result through the second processing logic, receive the first processing result sent by the first processing unit and the second processing result sent by the second processing unit.
[0152] In the embodiments of the present application, with reference to Figure 5 , the processing unit 42 is further configured to perform the following steps:
[0153] if it is determined that the first task cannot be processed by the processing logic of the target processing unit, obtaining a target model file corresponding to the first task based on the to-be-processed data in the first task;
[0154] the central processor gives the target model file corresponding to the first task to the file system corresponding to the target processing unit, so that the target processing unit parses the target model file corresponding to the first task to obtain the corresponding processing logic;
[0155] the central processor gives the to-be-processed data to the target processing unit corresponding to the target model file corresponding to the first task, and processes the to-be-processed data through the target processing unit to obtain the processing result.
[0156] In the embodiments of the present application, with reference to Figure 1 , the processing unit 42 is further configured to perform the following steps:
[0157] obtain a third task and determine attribute information of the third task;
[0158] Based on the attribute information of the third task, determine multiple target model files corresponding to the third task in the file system;
[0159] Based on the attribute information of the third task, the sub-data to be processed in each of the multiple target model files corresponding to the third task is determined from the data to be processed in the third task.
[0160] For each set of sub-data to be processed, based on the target processing unit corresponding to each target model file of the third task, each set of sub-data to be processed is processed to obtain multiple sets of processing sub-results;
[0161] The processing result is obtained based on multiple sets of processing sub-results.
[0162] It should be noted that the interaction process between the units in the embodiments of this application can be referred to Figure 1 , 2 The implementation process of the processing method provided in the embodiment corresponding to 4 will not be described in detail here.
[0163] The processing apparatus provided in this application embodiment only requires a defined target processing unit to parse the target model file and stores the target model file through the file system loaded by the target processing unit. Unlike related technologies, it does not require a central processing unit to process the target model file, thus reducing the workload of the central processing unit and improving the loading efficiency of the target model file on the electronic device.
[0164] Based on the foregoing embodiments, embodiments of this application provide an electronic device that can be applied to... Figure 6 , 2 In the processing method provided in the embodiment corresponding to 4, refer to Figure 1 As shown, the electronic device 5 includes: a memory 51, a processor 52, and a communication bus 53;
[0165] Communication bus 53 is used to realize the communication connection between processor 52 and memory 51;
[0166] The processor 52 is used to execute the processing program stored in the memory 51 to perform the following steps:
[0167] Obtain the target model file;
[0168] Identify the target processing unit in the electronic device, wherein the target processing unit loads a corresponding file system;
[0169] The target model file is given to the file system corresponding to the target processing unit through the central processing unit 52, so that the target processing unit analyzes the target model file to obtain corresponding processing logic, and the processing logic can represent the relationship between the input data and the output result of the target model file.
[0170] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0171] Obtain configuration information of the electronic device, and determine the target processing unit based at least on the configuration information; or,
[0172] Obtain running information of the electronic device, and determine the target processing unit from the processing units of the electronic device based at least on the running information; or,
[0173] Obtain attribute information of the target model file, and determine the target processing unit from the processing units of the electronic device based at least on the attribute information.
[0174] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0175] The target model file is parsed into at least two matrix data, and an interface of the artificial intelligence model is formed based on the at least two matrix data to obtain the processing logic.
[0176] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0177] Obtain a first task, give the to-be-processed data in the first task to the determined target processing unit, and receive the processing result sent by the target processing unit in the case that the target processing unit obtains the processing result through the processing logic.
[0178] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0179] If it is determined that the first task cannot be processed by the processing logic of the target processing unit, update the target model file; or,
[0180] If the update information of the target model file is obtained, the updated target model file is given to the file system corresponding to the target processing unit to update the processing logic obtained by the target processing unit.
[0181] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0182] determining a first processing unit and a second processing unit in an electronic device;
[0183] Correspondingly, the target model file is given to the file system corresponding to the target processing unit by the central processor 52, so that the target processing unit parses the target model file to obtain the corresponding processing logic, including:
[0184] The target model file is given to the first file system corresponding to the first processing unit and the second file system corresponding to the second processing unit by the central processor 52, so that the first processing unit parses the target model file to obtain the first processing logic, and the second processing unit parses the target model file to obtain the second processing logic.
[0185] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0186] Obtain a second task, give the first to-be-processed data in the second task to the first processing unit, and give the second to-be-processed data in the second task to the second processing unit. In the case that the first processing unit obtains the first processing result through the first processing logic and the second processing unit obtains the second processing result through the second processing logic, the first processing result sent by the first processing unit and the second processing result sent by the second processing unit are received.
[0187] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0188] If it is determined that the first task cannot be processed by the processing logic of the target processing unit, the target model file corresponding to the first task is obtained based on the to-be-processed data in the first task;
[0189] The target model file corresponding to the first task is given to the file system corresponding to the target processing unit by the central processor 52, so that the target processing unit parses the target model file corresponding to the first task to obtain the corresponding processing logic;
[0190] The to-be-processed data is given to the target processing unit corresponding to the target model file corresponding to the first task by the central processor 52, and the to-be-processed data is processed by the target processing unit to obtain the processing result.
[0191] In other embodiments of the present application, the processor 52 is configured to execute executable instructions stored in the memory 51 to implement the following steps:
[0192] Obtain a third task and determine attribute information of the third task;
[0193] Based on the attribute information of the third task, a plurality of target model files corresponding to the third task in the file system are determined.
[0194] determine, based on the attribute information of the third task, to-be-processed sub-data corresponding to each target model file in the plurality of target model files corresponding to the third task from to-be-processed data of the third task;
[0195] For each group of to-be-processed sub-data, perform processing on each group of to-be-processed sub-data based on a target processing unit corresponding to each target model file corresponding to the third task, to obtain a plurality of groups of processing sub-results;
[0196] obtain a processing result based on the plurality of groups of processing sub-results.
[0197] It should be noted that the specific implementation process of the steps performed by the processor in the embodiments of the present application can refer to the implementation process in the processing method provided by the embodiments corresponding to Figure 1 、 2 and 4, which will not be described here.
[0198] The electronic device provided in the embodiments of the present application only needs to determine a target processing unit to parse the target model file, and store the target model file through the file system loaded by the target processing unit, without using a central processing unit to process the target model file as in the related art, thereby reducing the workload of the central processing unit and improving the loading efficiency of the target model file on the electronic device.
[0199] Based on the foregoing embodiments, the embodiments of the present application provide a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the processing method provided by the embodiments corresponding to Figure 1 、 2 and 4.
[0200] It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0201] It should be noted that the computer readable storage medium above can be a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Ferromagnetic Random Access Memory (FRAM), a Flash Memory, a magnetic surface memory, an optical disc, or a Compact Disc Read-Only Memory (CD-ROM) memory, etc. It can also be various electronic devices including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0202] It should be noted that in this paper, the term "including", "containing" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0203] The above sequence numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0204] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disc, optical disc) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present application.
[0205] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.
[0206] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.
[0207] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. one or more flow or blocks. one or more flow or blocks.
[0208] The above merely provides the preferred embodiment of the present application, and is not intended to limit the patent scope of the present application, and any equivalent structure or equivalent flow transformation made by using the content of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A file processing method applied to an electronic device, the method comprising: Obtain the target model file; A target processing unit in an electronic device is identified, and the target processing unit is loaded with a corresponding file system. The target model file is sent to the file system corresponding to the target processing unit by the central processing unit, so that the target processing unit parses the target model file to obtain the corresponding processing logic. The processing logic can characterize the relationship between the input data and the output results of the target model file. The target processing unit is a processing unit that is different from the central processing unit.
2. The method according to claim 1, wherein determining the target processing unit in the electronic device comprises: Obtain the configuration information of the electronic device, and determine the target processing unit based at least on the configuration information; or, Obtain the operating information of the electronic device, and determine the target processing unit from the processing unit of the electronic device based at least on the operating information; or, Obtain the attribute information of the target model file, and determine the target processing unit from the processing unit of the electronic device based at least on the attribute information.
3. The method according to claim 2, wherein, The target model file is parsed to obtain the corresponding processing logic, including: The target model file is parsed into at least two matrix data, and an interface for an artificial intelligence model is formed based on the at least two matrix data to obtain the processing logic.
4. The method according to claim 1, wherein, Also includes: The system obtains a first task, sends the data to be processed in the first task to a designated target processing unit, and receives the processing result sent by the target processing unit when the target processing unit obtains the processing result through the processing logic.
5. The method according to claim 4, wherein, If it is determined that the first task cannot be processed by the processing logic of the target processing unit, update the target model file; or, If the update information of the target model file is obtained, the updated target model file is given to the file system corresponding to the target processing unit to update the processing logic obtained by the target processing unit.
6. The method according to claim 1, wherein, Determining the target processing unit in the electronic device includes: Determine the first processing unit and the second processing unit in the electronic device; Accordingly, the central processing unit provides the target model file to the file system corresponding to the target processing unit, enabling the target processing unit to parse the target model file and obtain the corresponding processing logic, including: The central processing unit sends the target model file to the first file system corresponding to the first processing unit and to the second file system corresponding to the second processing unit, so that the first processing unit parses the target model file to obtain the first processing logic and the second processing unit parses the target model file to obtain the second processing logic.
7. The method according to claim 6, wherein, Also includes: The system obtains a second task, sends the first data to be processed in the second task to the first processing unit, sends the second data to be processed in the second task to the second processing unit, and receives the first processing result sent by the first processing unit and the second processing result sent by the second processing unit when the first processing unit obtains a first processing result through the first processing logic and the second processing unit obtains a second processing result through the second processing logic.
8. The method according to claim 4, wherein, Also includes: If it is determined that the first task cannot be processed by the processing logic of the target processing unit, the target model file corresponding to the first task is obtained based on the data to be processed in the first task; The central processing unit sends the target model file corresponding to the first task to the file system corresponding to the target processing unit, so that the target processing unit parses the target model file corresponding to the first task to obtain the corresponding processing logic. The central processing unit sends the data to be processed to the target processing unit corresponding to the target model file of the first task, and the target processing unit processes the data to obtain the processing result.
9. The method according to claim 6, wherein, Also includes: Obtain the third task and determine its attribute information; Based on the attribute information of the third task, multiple target model files corresponding to the third task are determined in the file system; Based on the attribute information of the third task, the sub-data to be processed corresponding to each target model file in the multiple target model files corresponding to the third task is determined from the data to be processed in the third task. For each set of sub-data to be processed, based on the target processing unit of each target model file corresponding to the third task, each set of sub-data to be processed is processed to obtain multiple sets of processing sub-results; Based on the multiple sets of processing sub-results, the processing result is obtained.
10. A document processing apparatus, comprising: The acquisition unit is used to obtain the target model file; A processing unit is used to determine a target processing unit in an electronic device, wherein the target processing unit is loaded with a corresponding file system. The processing unit is further configured to send the target model file to the file system corresponding to the target processing unit via the central processing unit, so that the target processing unit can parse the target model file to obtain the corresponding processing logic, and the processing logic can characterize the relationship between the input data and the output results of the target model file; The target processing unit is a processing unit that is different from the central processing unit.
Citation Information
Patent Citations
Data processing method and device, electronic equipment and storage medium
CN111589109A
File information processing method and device, electronic equipment and storage medium
CN112364617A