Data processing method and electronic equipment
By dynamically adjusting the data accuracy of the network module based on the data characteristic analysis results in the intelligent device, the problem of insufficient computing efficiency and accuracy in the prior art is solved, and efficient identification and response in complex environments is achieved.
Patent Information
- Application Number
- CN202510401312.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, in intelligent devices, the computing efficiency and response speed of speech recognition models and image generation models cannot meet the real-time application needs, and traditional acceleration methods are difficult to ensure high-precision recognition effects in complex environments, and hardware acceleration methods are poor in versatility.
By obtaining the characteristic analysis results of the to-process data, dynamically adjusting the data accuracy of the network module, loading the target data accuracy network module for processing, and adapting data characteristics to improve the calculation rate and response speed.
Under different environments and task complexity, the model accuracy is dynamically adjusted to balance speed and accuracy, improving the computing efficiency and identification accuracy of smart devices, and is suitable for resource-constrained devices.
Smart Images

Figure CN120340469A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a data processing method and an electronic device. Background Art
[0002] With the rapid development of artificial intelligence, technologies such as speech recognition, image generation, and video generation have been widely used in daily life, especially in intelligent devices such as desktop computers, laptop computers, and all-in-one computers. However, due to the limitations of the hardware resources of intelligent devices, the computing efficiency and response speed of artificial intelligence models such as speech recognition models and image generation models often cannot meet the requirements of real-time applications. Summary of the Invention
[0003] The technical solution of this application is implemented as follows:
[0004] An embodiment of this application provides a data processing method, which includes:
[0005] Obtain data to be processed;
[0006] Determine the target data precision of the network module of the model used to process the data to be processed according to the feature analysis result of the data to be processed; the network module has different data precisions;
[0007] Load the network module with the target data precision to process the data to be processed through the network module with the target data precision.
[0008] An embodiment of this application provides an electronic device, including a processor and at least one processing model that can run on the processor. The processing model can be called by a target application to perform at least one of the following:
[0009] Obtain data to be processed;
[0010] Determine the target data precision of the network module of the model used to process the data to be processed according to the feature analysis result of the data to be processed; the network module has different data precisions;
[0011] Load the network module with the target data precision to process the data to be processed through the network module with the target data precision.
[0012] An embodiment of this application provides a computer-readable storage medium, in which computer-executable instructions are stored. The computer-executable instructions are configured to execute the steps of the above data processing method. Brief Description of the Drawings
[0013] Figure 1 It is a schematic flowchart of a data processing method provided by an embodiment of this application;
[0014] Figure 2 Flow diagram of a method for accelerating data processing provided by an embodiment of the present application;
[0015] Figure 3 Schematic diagram of the system architecture for accelerating data processing provided by an embodiment of the present application;
[0016] Figure 4 Schematic diagram of the composition structure of a data processing device provided by an embodiment of the present application.
[0017] Figure 5 Schematic diagram of the composition structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0018] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application.
[0019] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in conjunction with the accompanying drawings. The described embodiments should not be regarded as limitations of the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0020] In the following description, "some embodiments / other embodiments" are involved, which describe subsets of all possible embodiments. However, it can be understood that "some embodiments / other embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0021] In the following description, the terms "first / second / " involved are only used to distinguish similar objects, and do not represent a specific order for the objects. It can be understood that "first / second" can be interchanged with a specific order or sequence when allowed, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0023] Traditional speech recognition acceleration methods include model pruning and quantization techniques, static acceleration methods, hardware acceleration methods, etc. Although model pruning and quantization techniques improve speed, they often sacrifice a certain degree of accuracy, especially in complex speech scenarios where the recognition effect is not good; static acceleration methods lack the ability to perform real-time analysis and dynamic adjustment of audio inputs and cannot provide consistent high-efficiency performance under different audio conditions; hardware acceleration methods require specific hardware support, have poor generality, and limit their application on a wide range of devices. Therefore, although the above methods improve the computing speed to a certain extent, it is still difficult to ensure high-precision recognition effects in complex environments, and they are generally static methods determined at the time of installation.
[0024] Based on the problems existing in the related technologies, the embodiments of the present application provide a data processing method, which can be applied to electronic devices such as desktop computers, laptop computers, all-in-one computers, etc., as Figure 1 shown, is a schematic flowchart of a data processing method provided by an embodiment of the present application. The method includes the following steps:
[0025] S101. Obtain the data to be processed.
[0026] It should be noted that the data to be processed may include speech, text, images, videos, etc. Hereinafter, the data processing method provided by the present application will be described by taking the data to be processed as speech.
[0027] In some embodiments, the data to be processed may be input by a user through an interaction interface of an application program during the use of the application program; it may also be obtained from a storage area of a local device according to data input by the user from the interaction interface of the application program; it may also be data sent by a remote server, a cloud server, etc. after generating a data acquisition instruction for sending to the remote server, the cloud server, etc. based on the data input by the user from the interaction interface of the application program.
[0028] S102. Determine the target data accuracy of the network module of the model used to process the data to be processed according to the feature analysis result of the data to be processed.
[0029] It should be noted that the model used to process the data to be processed may be a speech recognition model, a text-to-text model, a text-to-image model, etc., and the network module may be one or more network layers in the model.
[0030] In some embodiments, the network module may be divided according to functions. For example, if model A has a total of 100 network layers, the first 5 network layers with encoding functions may be determined as the first network module, the 11th to 90th network layers with feature extraction functions may be determined as the second network model, and the 91st to 100th network layers may be determined as the third network module.
[0031] In some embodiments, the network modules can also be divided according to the number of layers. For example, if Model B has a total of 36 network layers, 6 network layers can be regarded as one network module, thus dividing Model B into 4 network modules.
[0032] In some embodiments, the network modules have different data precisions. The data precision can be the precision of the data (such as weights, biases, hyperparameters, etc.) in the weight file corresponding to the network module. This precision can represent the format of the data, and the format of the data can include integer type, floating-point type, and the number of decimal places corresponding to the floating-point type, etc.
[0033] Here, the data precision of the network module can include low data precision, medium data precision, and high data precision. The low data precision can represent that the format of the data is 8-bit integer, the medium data precision can represent that the format of the data is 16-bit floating-point number, and the high data precision can represent that the format of the data is full-precision floating-point number (32-bit floating-point number).
[0034] In some embodiments, the target data precision can be a data precision determined from multiple data precisions of the network module according to the feature analysis result of the data to be processed. The features of the data to be processed can be analyzed to obtain the feature analysis result. When the data to be processed is speech, the features of the data to be processed can include the speech rate, pauses, intonation changes, signal-to-noise ratio, etc. By analyzing and processing the speech rate, pauses, intonation changes, signal-to-noise ratio, etc. of the speech, the complexity of the speech can be determined, and thus, according to the complexity of the speech, the target data precision of the network module of the model used to process the data to be processed can be determined.
[0035] In some embodiments, when the model used to process the data to be processed includes multiple network modules, according to the feature analysis result of the data to be processed, the target data precision of one or more network modules of the model can be determined. For example, the target data precision of the first network module of the model, or the target data precision of the first three network modules of the model, or the target data precision of all network modules of the model.
[0036] S103: Load the network module with the target data precision to process the data to be processed through the network module with the target data precision.
[0037] In some embodiments, loading the network module with the target data precision can be loading the weight file corresponding to the network module with the precision of the target data precision. After determining that the data precision of the network module of the model used to process the data to be processed is the target data precision, the weight file corresponding to the network module with the precision of the target data precision can be loaded from the external storage area of the electronic device into the memory, so as to facilitate the use of the network module to perform inference operations on the data to be processed.
[0038] In an embodiment of the present application, obtain data to be processed; determine the target data precision of the network module of the model for processing the data to be processed according to the result of feature analysis of the data to be processed; the network module has different data precisions; load the network module with the target data precision to process the data to be processed through the network module with the target data precision. In this way, according to the result of feature analysis of the data to be processed, the target data precision of the network module of the model for processing the data to be processed is determined, so that the data precision of the network module for processing the data to be processed is adapted to the result of feature analysis of the data to be processed. Therefore, during the process of using the network module with the target data precision to process the data to be processed, the calculation rate and response speed of the data to be processed can be improved.
[0039] In some embodiments of the present application, the result of feature analysis includes the complexity of the data to be processed; based on this, according to the result of feature analysis of the data to be processed, determine the target data precision of the network module of the model for processing the data to be processed, that is, step S102 can be implemented by the following steps S1021 to S1022, and each step will be described separately below.
[0040] S1021. Analyze the features of the data to be processed to determine the complexity of the data to be processed.
[0041] It should be noted that the complexity of the data to be processed can be used to represent the complexity of the data to be processed itself, or the complexity of the corresponding processing task determined according to the data to be processed.
[0042] In some embodiments, when the data to be processed is voice data, the speech rate of the voice data can be analyzed, the pauses in the voice data can be detected, the intonation changes in the voice data can be analyzed, and the signal-to-noise ratio of the voice data can be calculated. Finally, based on the analysis results of the speech rate, pauses, intonation changes, and signal-to-noise ratio of the voice data, determine the complexity of the data to be processed.
[0043] Exemplarily, the short-time energy and zero-crossing rate (ZCR) can be used to estimate the speech rate, detect pauses, and judge the complexity of the speech; the frequency of the voice data can be analyzed to extract the fundamental frequency change and analyze the intonation fluctuation to reflect the complexity of the speech content; the ratio of the voice signal to the background noise can be calculated through statistical features to evaluate the quality of the audio, and the complexity of the voice can be determined according to the quality of the audio. Finally, determine the complexity of the data to be processed based on the complexity determined by the comprehensive three analysis results. For example, the sum of the complexities determined by the three analysis results can be determined as the complexity of the data to be processed, or the weighted sum of the complexities determined by the three analysis results can be determined as the complexity of the data to be processed.
[0044] S1022. Determine the target data precision of the network module according to the complexity, the preset corresponding relationship between the complexity of the processed data and the data precision of the network module of the model.
[0045] In some embodiments, the complexity of the data to be processed can be divided into low complexity, medium complexity, and high complexity. When the value range of the complexity is [0, 100%], the value range corresponding to low complexity can be [0, 40%), the value range corresponding to medium complexity is [40%, 70%), and the value range corresponding to high complexity is [70%, 100%].
[0046] In some embodiments, the preset corresponding relationship between the complexity of the processed data and the data precision of the network module of the model can be pre-established. For example, during the process of testing experimental data using network modules with different data precisions, determine the data precision of the network module of the model with the fastest inference speed, and analyze the complexity of the test data. Based on the complexity of the test data and the data precision of the network module of the model used, create the preset corresponding relationship between the complexity of the processed data and the data precision of the network module of the model.
[0047] In some embodiments, when the data precision of the network module is divided into low data precision, medium data precision, and high data precision, the preset corresponding relationship between the complexity of the processed data and the data precision of the network module of the model can be that low complexity corresponds to low data precision, medium complexity corresponds to medium data precision, and high complexity corresponds to high data precision.
[0048] It can be understood that based on the complexity of the data to be processed and the preset corresponding relationship between the complexity of the processed data and the data precision of the network module of the model, the accuracy of the determined data precision of the network module can be improved.
[0049] In some embodiments of the present application, the network module includes at least one, and the above method may further include the following steps S104 to S106, which will be described separately for each step below.
[0050] S104. Obtain the output result of the first specific network module.
[0051] It should be noted that the first specific network module is any one of the other network modules except the last network module in the model.
[0052] In some embodiments, the output result of the first specific network module may be an intermediate output result of a model for processing the data to be processed. When the network module is an encoding module, the corresponding output result may be an encoding vector; when the network module is a feature extraction module, the corresponding output result may be a feature vector. The description of the network module and the output result of the network module here is only exemplary, and the present application does not limit this.
[0053] S105. Predict the accuracy rate of the processing result of the model according to the output result.
[0054] In some embodiments, a relationship model (such as a neural network model, a data function relationship, etc.) between the reference output result of the network module established in advance and the accuracy rate of the final processing result of the model may be calculated to obtain the model prediction accuracy rate corresponding to the output result after the current network module processes the data to be processed.
[0055] S106. If it is determined according to the accuracy rate that the model does not meet the processing accuracy requirement, load the first candidate network module with the first data precision to process the data to be processed.
[0056] It should be noted that the first data precision of the first candidate network module is greater than the target data precision of the first candidate network module, and the first candidate network module is a network module connected after the first specific network module in the model. The first candidate network module may be one or more network modules after the first specific network module. For example, the first candidate network module may be the first network module after the first specific network module, the first candidate network module may be two network modules after the first specific network module, and the first candidate network module may also be the second network module after the first specific network module. The description of the first candidate network module and the relationship between the first candidate network module and the first specific network module here is only exemplary, and the present application does not limit this.
[0057] In some embodiments, the situation where the model does not meet the processing accuracy requirement may be that the accuracy rate of the processing result of the predicted model is less than a preset threshold. In this case, it is considered that the inference accuracy of the model is low. Therefore, the data precision of the first candidate network module after the first specific network module may be adjusted to improve the inference accuracy of the model. The first candidate network module with the first data precision greater than the target data precision may be loaded to continue processing the data to be processed through the first candidate network module with the first data precision.
[0058] In some embodiments, if the target data accuracy of the first candidate network module is low data accuracy, the first data accuracy of the first candidate network module may be medium data accuracy or high data accuracy; if the target data accuracy of the first candidate network module is medium data accuracy, the first data accuracy of the first candidate network module may be high data accuracy.
[0059] It can be understood that in the case where it is determined that the model does not meet the processing accuracy requirements based on the accuracy of the processing result of the output result prediction model of the first specific network module, by loading the first candidate network module with the first data accuracy, the processing accuracy of the first candidate network module can be improved, thereby improving the accuracy of the processing result of the model.
[0060] In some embodiments of the present application, according to the accuracy of the processing result of the output result prediction model, that is, the above step S105 can be implemented by the following steps S1051 to S1052, and each step will be described separately below.
[0061] S1051. Determine the evaluation index value of the credibility of the first specific network module according to the output result.
[0062] It should be noted that the evaluation index value of the credibility of the first specific network module may be the confidence level of the output result of the first specific network module, or other index values that can be used to judge the credibility of the output result of the first specific network module.
[0063] In some embodiments, a relationship model between the output result of the network module and the evaluation index of credibility may be established in advance, and the evaluation index value of the credibility corresponding to the output result of the first specific network module is calculated; alternatively, the output result of the first specific network module may also be directly determined as the evaluation index value of the credibility of the first specific network module.
[0064] In some embodiments, the evaluation index values corresponding to different network modules may be different. For example, in the case where the evaluation index value of credibility is the confidence level, the stability degree value of the spectral characteristics of the output result of the feature extraction module may be used as the confidence level; the sparsity degree of the output result of the encoding module may be used as the confidence level, and the probability distribution of the decoded result used by the decoding module may be used as the confidence level.
[0065] S1052. Input the evaluation index value into a preset mathematical model to obtain the accuracy of the processing result of the model.
[0066] It should be noted that the preset data model is a correlation model between the confidence level of the network module of the model and the accuracy rate of the output result. The preset data model can be a neural network model or a non-neural network model. After determining the sum of the evaluation index values of the credibility of the first specific network module, the evaluation index value can be directly input into the preset mathematical model, so as to obtain the accuracy rate of the processing result of the model through calculation.
[0067] It can be understood that by inputting the evaluation index value of the credibility determined by the output result of the first specific network module into the preset mathematical model, the accuracy rate of the processing result of the model for processing the data to be processed can be quickly predicted.
[0068] In some embodiments of the present application, the above method may further include the following step S107:
[0069] S107. If the network module does not include the first candidate network module, based on the accuracy rate, determine the first data precision of the first candidate network module.
[0070] It should be noted that the first data precision is the same as or different from the target data precision.
[0071] In some embodiments, the network module may be a network module that has been loaded into the memory. The fact that the network module does not include the first candidate network module may mean that the first candidate network module has not been loaded into the memory. In this case, the first data precision of the first candidate network module can be determined according to the accuracy rate of the predicted processing result of the model.
[0072] In some embodiments, the first data precision of the first candidate network module can be determined according to the magnitude of the accuracy rate of the predicted processing result of the model. For example, if the model does not meet the processing precision requirement, that is, the accuracy rate of the predicted processing result of the model is less than 70%, when the accuracy rate of the predicted processing result of the model is less than or equal to 50%, the first data precision of the first candidate network module can be determined as high precision; when the accuracy rate of the predicted processing result of the model is greater than 50% and less than 70%, the first data precision of the first candidate network module can be determined as medium precision or high precision.
[0073] It can be understood that in the case where the network module does not include the first candidate network module, determining the first data precision of the first candidate network module based on the accuracy rate of the predicted model can accurately determine the data precision of the unloaded network module, which is convenient for subsequent use of the unloaded network module to continue processing the data to be processed.
[0074] In some embodiments of the present application, the above method may further include the following step S108:
[0075] S108. If the network module includes a first candidate network module, clear the first candidate network module with the loaded target data precision from the memory.
[0076] It should be noted that the first data precision of the first candidate network module is greater than the target data precision of the first candidate network module.
[0077] In some embodiments, that the network module includes a first candidate network module may indicate that the first candidate network module with the current loaded target precision has been loaded into the memory. In this case, the first candidate network module with the target data precision can be cleared from the memory, and the first candidate network module with the first data precision can be loaded into the memory to process the data to be processed using the first candidate network module with the first data precision.
[0078] It can be understood that, in the case where the network module includes a first candidate network module, clearing the first candidate network module with the loaded target data precision from the memory can avoid occupying the memory, improve the memory utilization rate, and thus can improve the processing speed of the data to be processed.
[0079] In some embodiments of the present application, the above method may further include the following steps S109 to S111, and each step will be described separately below.
[0080] S109. Obtain the hardware resource information of the electronic device corresponding to the second specific network module during the process of processing the data to be processed.
[0081] It should be noted that the second specific network module is any one of the other network modules except the last network module in the model.
[0082] In some embodiments, the hardware resource information of the electronic device may include the remaining power of the battery of the electronic device, the memory occupancy rate, the utilization rate of the central processing unit (CPU), the utilization rate of the graphics processing unit (GPU), etc.
[0083] In some embodiments, the hardware resource information of the electronic device can be monitored in real time during the process of the network module of the model processing the data to be processed, so as to obtain the hardware resource information of the electronic device corresponding to the specific network module during the process of processing the data to be processed.
[0084] S110. Determine the second data precision of the second candidate network module according to the hardware resource information.
[0085] Here, the second candidate network module is the network module connected after the second specific network module in the model. The second candidate network module can be one or more network modules after the second specific network module. For example, it can be the first network module after the second specific network module, or the first and second network modules after the second specific network module, or five consecutive network modules after the second specific network module. The description of the second candidate network module and the relationship between the second candidate network module and the second specific network module here is only an exemplary illustration, and this application does not make any limitations in this regard.
[0086] In some embodiments, the second data precision of the second candidate network module can be determined according to the remaining power of the battery of the electronic device. For example, when the current remaining power of the battery of the electronic device is less than the remaining power threshold (such as 30%), the second data precision of the second candidate network module can be set to a low data precision.
[0087] In some other embodiments, the second data precision of the second candidate network module can be determined according to the memory occupancy rate of the electronic device. For example, when the current memory occupancy rate of the electronic device is greater than the memory occupancy rate threshold (such as 70%), the second data precision of the second candidate network module can be set to a low data precision or a medium data precision.
[0088] In some other embodiments, the second data precision of the second candidate network module can be determined according to the utilization rate of the CPU of the electronic device. For example, when the current CPU utilization rate of the electronic device is less than the preset threshold (such as 40%), the second data precision of the second candidate network module can be determined to be a medium data precision or a high data precision.
[0089] In some other embodiments, the second data precision of the second candidate network module can be determined according to the utilization rate of the GPU of the electronic device. For example, when the current GPU utilization rate of the electronic device is greater than the GPU utilization rate threshold (such as 60%), the second data precision of the second candidate network module can be determined to be a low data precision or a medium data precision.
[0090] S111. Load the second candidate network module with the second data precision to process the data to be processed.
[0091] In some embodiments, when the second candidate network module has not been loaded into the memory, the second candidate network module with the second data precision can be loaded from an external storage area into the memory; when the second candidate network module has already been loaded into the memory, the second candidate network module with the target data precision can be cleared from the memory, and at the same time, the second candidate network module with the second data precision can be loaded into the memory. Thereafter, the second candidate network module with the second data precision can be used to process the data to be processed.
[0092] It can be understood that, according to the hardware resource information of the electronic device during the process of processing the data to be processed by the second specific network module, the second data precision of the second candidate network module after the second specific network module is determined, so as to dynamically adjust the data precision of the second candidate network module according to the hardware resource usage of the electronic device, so that during the process of processing the data to be processed based on the second candidate network module with the second data precision, the resource utilization rate of the electronic device can be improved, resource consumption can be reduced, and the balance between the performance and resource consumption of the electronic device can be promoted.
[0093] In some embodiments of the present application, the hardware resource information includes the current hardware resource consumption value of the electronic device; according to the hardware resource information, determining the second data precision of the data in the second candidate network module, that is, step S110 can be implemented by the following step S1101A.
[0094] S1101A. If the network module does not include the second candidate network module, based on the current hardware resource consumption value and the preset corresponding relationship between the hardware resource consumption value and the data precision of the second candidate network module, determine the second data precision.
[0095] It should be noted that the current hardware resource consumption value of the electronic device can be the remaining battery power of the electronic device, the memory occupancy rate, the utilization rate of the central processing unit (CPU), the utilization rate of the graphics processing unit (GPU), etc. Correspondingly, the preset corresponding relationship between the hardware resource consumption value and the data precision of the second candidate network module can be at least one of the preset corresponding relationship between the remaining battery power and the data precision of the second candidate network module, the preset corresponding relationship between the memory occupancy rate and the data precision of the second candidate network module, the preset corresponding relationship between the CPU utilization rate and the data precision of the second candidate network module, and the preset corresponding relationship between the GPU utilization rate and the data precision of the second candidate network module.
[0096] In some embodiments, the preset correspondence between the hardware resource consumption value and the data precision of the second candidate network module may be pre-established. For example, when the remaining battery power is low (e.g., the remaining power is less than 30%), the corresponding data precision is low-level data precision; when the remaining battery power is high (e.g., the remaining power is greater than 80%), the corresponding data precision is high-level data precision. The description of the hardware resource consumption value and the preset correspondence between the hardware resource consumption value and the data precision of the second candidate network module herein is merely illustrative, and the present application is not limited thereto.
[0097] In some embodiments, the preset correspondence between the hardware resource consumption value and the data precision of the second candidate network module can be reflected in the form of a preset correspondence table. Therefore, after determining the current hardware resource consumption value of the electronic device, if the second candidate network module has not been loaded into the memory, the current hardware resource consumption value can be compared with the hardware resource consumption values in the preset correspondence table to determine the second data precision of the second candidate network module.
[0098] It can be understood that in the case where the network module does not include the second candidate network module, based on the current hardware resource consumption value of the electronic device and the preset correspondence between the hardware resource consumption value and the data precision of the second candidate network module, the data precision of the second candidate network module adapted to the hardware resource consumption value of the electronic device can be determined, so as to realize the reasonable utilization of the hardware resources of the electronic device in the subsequent process of processing the data to be processed by the second candidate network module with the second data precision.
[0099] In some embodiments of the present application, the hardware resource information includes the current hardware resource consumption value of the electronic device; according to the hardware resource information, determining the second data precision of the data in the second candidate network module, that is, step S110 can be implemented by the following step S1101B or step S1101C.
[0100] S1101B. If the network module includes the second candidate network module and the current hardware resource consumption value does not reach the hardware resource consumption threshold, determine the second data precision based on the first ratio of the current hardware resource consumption value to the hardware resource consumption threshold.
[0101] Here, the second data precision is greater than the target data precision of the second candidate network module. The hardware resource consumption threshold can be a preset threshold, for example, it can include the battery usage threshold, the memory occupancy threshold, the CPU utilization threshold, the GPU utilization threshold, etc.
[0102] In some embodiments, the current hardware resource consumption value not reaching the hardware resource consumption threshold may mean that the current hardware consumption threshold is less than the hardware resource consumption threshold, that is, the current hardware resource utilization rate of the electronic device is relatively low, or there are redundant unutilized hardware resources.
[0103] In some embodiments, the second data precision of the second candidate network module may be determined according to the first ratio of the current hardware resource consumption value to the hardware resource consumption threshold. Exemplarily, if the current power consumption of the battery of the electronic device is 60%, and the power consumption threshold of the battery is 90%, then the corresponding first ratio is 2 / 3, and the second data precision of the corresponding second candidate network module may be medium data precision; if the current memory occupancy rate of the electronic device is 20%, and the memory occupancy rate threshold is 80%, then the corresponding first ratio is 1 / 4, and the second data precision of the corresponding second candidate network module may be medium data precision or high data precision; if the current CPU utilization rate of the electronic device is 50%, and the CPU utilization rate threshold is 70%, then the corresponding first ratio is 4 / 3, and the second data precision of the corresponding second candidate network module may be medium data precision; if the current CPU utilization rate of the electronic device is 20%, and the CPU utilization rate threshold is 60%, then the corresponding first ratio is 1 / 3, and the second data precision of the corresponding second candidate network module may be medium data precision. Here, the current hardware resource consumption value, the hardware resource consumption threshold, and the second data precision are only exemplary descriptions, and the present application is not limited thereto.
[0104] In some embodiments, the second data precision of the second candidate network module may be determined based on the first ratio of the current hardware resource consumption value to the hardware resource consumption threshold and the target data precision of the second candidate network module. For example, if the target data precision of the second candidate network module is low data precision, and the data precision of the second candidate network module determined based on the first ratio of the current hardware resource consumption value to the hardware resource consumption threshold is high data precision, then medium data precision or high data precision may be determined as the second data precision of the second candidate network module.
[0105] It can be understood that in the case where the network module includes the second candidate network module and the current hardware resource consumption value of the electronic device does not reach the hardware resource consumption threshold, a second candidate network module with a second data precision greater than the target data precision can be determined through the first ratio of the current hardware resource consumption value to the hardware resource consumption threshold, so that the utilization rate of the hardware resources of the electronic device can be improved in the subsequent process of processing the data to be processed using the second candidate network module with the second data precision.
[0106] S1101C. If the network module includes a second candidate network module and the current hardware resource consumption value exceeds the hardware resource consumption threshold, determine a second data accuracy based on a second ratio of the current hardware resource consumption value to the hardware resource consumption threshold.
[0107] Here, the second data accuracy is less than the target data accuracy of the second candidate network module.
[0108] In some embodiments, the current hardware resource consumption value exceeding the hardware resource consumption threshold may be that the current hardware consumption threshold is greater than or equal to the hardware resource consumption threshold, that is, the current hardware resource consumption of the electronic device is relatively large.
[0109] In some embodiments, the second data accuracy of the second candidate network module may be determined according to the second ratio of the current hardware resource consumption value to the hardware resource consumption threshold. Exemplarily, if the current power consumption of the battery of the electronic device is 90% and the power consumption threshold of the battery is 80%, the corresponding second ratio is 9 / 8, and the second data accuracy of the corresponding second candidate network module may be low data accuracy; if the current memory occupancy rate of the electronic device is 80% and the memory occupancy rate threshold is 60%, the corresponding second ratio is 4 / 3, and the second data accuracy of the corresponding second candidate network module may be low data accuracy; if the current CPU utilization rate of the electronic device is 70% and the CPU utilization rate threshold is 60%, the corresponding second ratio is 7 / 6, and the second data accuracy of the corresponding second candidate network module may be low data accuracy; if the current GPU utilization rate of the electronic device is 80% and the GPU utilization rate threshold is 70%, the corresponding second ratio is 8 / 7, and the second data accuracy of the corresponding second candidate network module may be low data accuracy. The above are only exemplary descriptions of the current hardware resource consumption value, the hardware resource consumption threshold, and the second data accuracy, and the present application is not limited thereto.
[0110] In some embodiments, the second data accuracy of the second candidate network module may be determined based on the second ratio of the current hardware resource consumption value to the hardware resource consumption threshold and the target data accuracy of the second candidate network module. For example, if the target data accuracy of the second candidate network module is high data accuracy and the data accuracy of the second candidate network module determined based on the second ratio of the current hardware resource consumption value to the hardware resource consumption threshold is low data accuracy, then the low data accuracy or medium data accuracy may be determined as the second data accuracy of the second candidate network module.
[0111] It can be understood that in the case where the network module includes a second candidate network module and the current hardware resource consumption value of the electronic device exceeds the hardware resource consumption threshold, the second candidate network module with a second data accuracy lower than the target data accuracy can be determined through the second ratio of the current hardware resource consumption value to the hardware resource consumption threshold, so as to reduce the hardware resource consumption of the electronic device in the subsequent process of processing the data to be processed by the second candidate network module with the second data accuracy.
[0112] In some embodiments of the present application, the above method may further include the following steps S112 to S113:
[0113] S112. Obtain a selection operation of the user for the third data accuracy of the network module of the model.
[0114] It should be noted that the network module with the third data accuracy and the network module with the target data accuracy may be the same or different. The third data accuracy may be a low data accuracy, a medium data accuracy, or a high data accuracy.
[0115] In some embodiments, the selection operation of the user for the third data accuracy of the network module of the model may be a click operation, a touch operation, a text input operation, a voice input operation, etc. on the data accuracy control in the interaction interface of the application program. This selection operation may indicate that the user has selected the network module with the third data accuracy.
[0116] S113. In response to the selection operation, load the network module with the third data accuracy to process the data to be processed through the network module with the third data accuracy.
[0117] In some embodiments, after obtaining the selection operation of the user for the third data accuracy of the network module of the model, the network module with the third accuracy indicated by this selection operation can be loaded, so as to process the data to be processed by the network module with the third accuracy.
[0118] It can be understood that by responding to obtain the selection operation of the user for the third data accuracy of the network module of the model and loading the network module with the third accuracy to process the data to be processed, personalized customization is achieved, which can improve the user experience.
[0119] In the embodiments of the present application, the data to be processed is obtained; according to the feature analysis result of the data to be processed, the target data precision of the network module of the model used to process the data to be processed is determined; the network module has different data precisions; the network module with the target data precision is loaded to process the data to be processed through the network module with the target data precision. In this way, according to the feature analysis result of the data to be processed, the target data precision of the network module of the model used to process the data to be processed is determined, so that the data precision of the network module used to process the data to be processed is adapted to the feature analysis result of the data to be processed. Therefore, during the process of using the network module with the target data precision to process the data to be processed, the calculation rate and response speed of the data to be processed can be improved.
[0120] Next, the implementation process of the application embodiments in the actual application scenario will be introduced.
[0121] As Figure 2 shown, it is a schematic flowchart of a method for accelerating data processing provided by the present application. The method includes:
[0122] S201. Obtain audio data.
[0123] In some embodiments, the audio signal can be collected by the built-in microphone of the device, and noise filtering and signal enhancement processing are performed on it to obtain the processed audio data, so as to facilitate the analysis of the features of the audio data.
[0124] S202. Analyze the audio data to determine the complexity and quality of the audio data.
[0125] According to different features of the audio data (such as speech rate, pause, intonation change, signal-to-noise ratio, etc.), the complexity and quality of the audio can be deeply analyzed. These analysis results provide a basis for subsequent precision mode switching.
[0126] By using simple signal processing techniques such as short-time energy and ZCR, the system can quickly estimate the speech rate of the speech signal without relying on a complex ASR model. High speech rate or frequently changing speech may require higher inference precision.
[0127] By analyzing the short-time energy of the audio signal, the system can identify low-energy or silent time periods. These pause information helps to judge the complexity of the speech content. Frequent or long pauses may indicate a complex context.
[0128] Signal processing techniques such as the fast Fourier transform (FFT) can be used to extract the fundamental frequency change in the speech and analyze the fluctuation of the intonation. These intonation information can reflect the emotional state or semantic level of the speaker. Complex intonation changes usually require higher inference precision.
[0129] The ratio of the speech signal to the background noise (SNR) can be calculated through statistical feature analysis to evaluate the quality of the audio. Audio with a low signal-to-noise ratio may require a lower inference accuracy to speed up the processing speed, while a high signal-to-noise ratio allows for high-precision processing to ensure accuracy.
[0130] By analyzing features such as the speech rate, pauses, intonation changes, and signal-to-noise ratio of the input audio, the complexity and quality of the audio can be evaluated, and a complexity with a specific meaning can be calculated. For example, by weighted summing the data used to evaluate complexity, the complexity of the audio can be determined.
[0131] S203. Determine the inference accuracy of the speech recognition model (equivalent to the "target data accuracy" in other embodiments) based on the complexity and quality of the audio data.
[0132] The inference accuracy of the speech recognition model can include high accuracy, medium accuracy, and low accuracy. The high-accuracy mode is suitable for complex or noisy audio and uses full-precision floating-point numbers (FP32) for calculation; the medium-accuracy mode is suitable for general audio and uses 16-bit floating-point numbers (FP16) for calculation; the low-accuracy mode is suitable for simple or high-quality audio and uses 8-bit integers (INT8) for calculation.
[0133] Based on the complexity and quality of the audio data, dynamic switching can be performed between the inference accuracy modes of the speech recognition model. Based on the audio complexity and quality, the inference accuracy of the entire speech recognition model can be determined, or the inference accuracy of each network layer of the speech recognition model can be determined. The correspondence between the audio complexity, quality, and the inference accuracy of the speech recognition model (or each network layer of the speech recognition model) can be pre-experimented.
[0134] Different network modules can use different precision calculations according to the inference requirements to optimize computing resources. The first few layers (such as the feature extraction network layer) can use the low-accuracy mode, while the key layers use the high-accuracy mode. For example, the first few layers responsible for simple feature extraction use low precision (such as INT8) to save computing resources; the subsequent layers dynamically adjust the precision according to the confidence level or error rate monitored in real time. The complex decision layer can use higher precision (such as FP16 or FP32) to ensure the accuracy of the final output.
[0135] S204. Determine the confidence level of the intermediate result of the speech recognition model.
[0136] By monitoring the confidence level (or error rate) of the intermediate result of the speech recognition model in real time, the computing precision of the subsequent layers can be dynamically adjusted as needed. For example, when the confidence level in the decoding stage is detected to decrease, the computing precision of the subsequent layers may be increased to ensure the accuracy and reliability of the recognition result.
[0137] S205. Dynamically adjust the inference accuracy of network modules in the speech recognition model based on the confidence of intermediate results and the load condition of the device.
[0138] When the confidence in the decoding stage is detected to decrease, the computational accuracy of subsequent layers may be increased to ensure the accuracy and reliability of the recognition result. This dynamic adjustment mechanism ensures that the system can balance speed and accuracy under different environments and task complexities. Further, the current CPU / GPU load condition and battery state can be continuously monitored. In the case of high load or low battery, the inference accuracy can be automatically reduced to reduce resource consumption; when resources are abundant, the inference accuracy can be increased to ensure the accuracy of speech recognition. This resource-aware dynamic adjustment mechanism enables the system to achieve an optimal balance between performance and resources on various devices.
[0139] S206. Obtain the speech recognition result of the output speech recognition model for the audio data.
[0140] After all network modules of the speech recognition model have completed inference, the speech recognition result of the audio data can be obtained.
[0141] The method for accelerating data processing provided by this application can dynamically adjust the inference accuracy of different parts in the speech recognition model according to the complexity and quality of the input audio, thereby improving the inference speed while maintaining the recognition accuracy.
[0142] As Figure 3 shown, it is a schematic diagram of the system architecture for accelerating data processing provided by this application. The system 300 for accelerating data processing includes an audio input module 301, an audio complexity analysis and preprocessing module 302, a resource awareness and optimization module 303, an accuracy mode switching module 304, and a multi-level processing and dynamic adjustment module 305.
[0143] The audio input module 301 is mainly used to obtain or collect audio data; the audio complexity analysis and preprocessing module 302 analyzes the complexity and quality of the audio based on different characteristics of the audio signal (such as speech rate, pause, intonation change, signal-to-noise ratio, etc.) to obtain analysis results, and these analysis results can provide a basis for subsequent accuracy mode switching; the resource awareness and optimization module 303 can continuously detect the current CPU / GPU load condition and battery state, and dynamically adjust the inference accuracy of the model according to the CPU / GPU load condition and battery state.
[0144] The precision mode switching module 304 dynamically switches between high-precision, medium-precision, and low-precision modes based on the results of audio complexity analysis and resource status. High-precision mode is used for complex audio, while low-precision mode is used for simple or noisy audio. In different modes, the system adjusts the calculation parameters of the model (such as floating-point bit width) according to the selected precision to optimize the use of computing resources.
[0145] The multi-level processing and dynamic adjustment module 305 can adopt different precision settings for different model layers to optimize computing resources and inference speed. The following takes the Whisper model as an example to illustrate the multi-level processing and dynamic adjustment mechanism:
[0146] The initial layer is mainly used for feature extraction and can be processed with low precision. The first few layers of the Whisper model are mainly used to convert the input audio signal into a spectrogram (such as log-Mel spectrogram). The main task of these layers is to perform basic audio feature extraction, so low precision (such as INT8) can be used for calculation. This processing method can greatly save computing resources and speed up the processing speed, especially when processing simple or high-quality audio.
[0147] The middle layers are responsible for capturing complex features in the audio signal under the self-attention mechanism, such as changes in intonation, speech rate, and background noise. Medium precision (such as FP16) can be adopted in these layers to balance computing efficiency and the accuracy of feature extraction. The processing at this stage is crucial for generating higher-quality audio representations, so appropriate precision is required to ensure the retention of key features.
[0148] The decoder part and the last few layers (decoding and decision-making layers) of the Whisper model are responsible for generating the final text transcription result. These layers usually require higher precision (such as FP32) to ensure the accuracy of recognition and the confidence of the output result, especially in the case of processing complex speech inputs or low signal-to-noise ratio environments. High-precision processing is crucial at this stage because it directly affects the final recognition result.
[0149] The method for accelerating data processing provided in this application can also be applied to other models, such as the text-to-image module. The following takes the Stable Diffusion model to illustrate the method for processing family data provided in this application. Stable Diffusion is a model for generating high-quality images, and the generation efficiency can be significantly improved through hierarchical processing and precision adjustment.
[0150] 1. Task analysis of precision selection:
[0151] (1) Prompt Semantics and Keyword Recognition: The input text prompt is semantically analyzed and keywords are recognized through the Text Encoder. The system determines the complexity of the generation task based on the text length, complexity, and key descriptive words (such as "high definition", "details", etc.). Complex text prompts may require higher-precision processing, while simple descriptions can use lower precision.
[0152] (2) Feature Distribution and Noise Level: In the intermediate stage of image generation, the system dynamically adjusts the computational precision of Unet (the framework used in the Stable Diffusion model) by analyzing the feature distribution and noise level in the latent space. When the features are complex and concentrated, higher precision is used for processing, while simple regions use low precision to speed up.
[0153] (3) Generation Stage and User Requirements: According to the different stages of image generation (initial, middle, late), the system selects the appropriate precision. When the image details are not yet formed, lower precision is used for processing; in the stage of detail formation and high-resolution output, high precision is used to ensure image quality. At the same time, according to the user's preset requirements (such as "generate quickly" or "generate with high quality"), the system dynamically selects the global precision strategy.
[0154] (4) Resource Availability Monitoring: The system dynamically adjusts the precision strategy by monitoring the CPU / GPU load and battery status. When resources are abundant, high precision is selected to optimize quality; when resources are limited, low precision is preferred to save resources.
[0155] 2. Multi-level Dynamic Precision Processing:
[0156] (1) Text Encoder Stage:
[0157] The Text Encoder (usually CLIP ViT-L / 14) is responsible for converting the text prompt into an embedding vector. This stage mainly involves the conversion from text to feature embedding vector, and medium precision can be selected to ensure the quality of text embedding while optimizing computational resources.
[0158] (2) UNet Stage:
[0159] Initial Processing: In the initial downsampling stage of UNet, the basic features of the image are extracted and processed. Low precision can be used in this stage to speed up processing and reduce resource consumption.
[0160] Intermediate processing: In the intermediate stage of UNet (a deep learning network model for image segmentation, with a U-shaped network structure mainly composed of an encoder and a decoder. The encoder is responsible for gradually downsampling the input image to extract high-level features of the image; the decoder then gradually upsamples the feature map output by the encoder, restores the resolution of the image, and generates a segmentation result of the same size as the input image), the model begins to gradually restore the image from the latent space. At this time, medium precision is used to balance speed and detail retention.
[0161] Refinement processing: In the final upsampling stage of UNet, the restoration of details and image generation require higher precision to ensure high-quality output of the image.
[0162] (3) VAE stage:
[0163] VAE (Variational Autoencoder) is responsible for re-decoding the processed latent representation into the final image. During the decoding process, medium precision can be used to process the latent space data for tasks such as draft generation, while high precision is used for tasks with high detail requirements such as generating high-definition images to ensure that the generated images are clear and realistic.
[0164] The method for accelerating data processing provided by this application can adjust the model according to the load, saving device power consumption and occupancy; it can be dynamically adjusted during the local inference process instead of being statically loaded before the start of inference; it can maintain a high recognition accuracy while accelerating locally; this method can be extended and applied to applications such as video processing and image generation; this method can be applied to resource-constrained devices and has broad application prospects.
[0165] This application also provides a data processing device, Figure 4 which is a schematic diagram of the composition structure of a data processing device provided by an embodiment of this application. As Figure 4 shown, the data processing device 400 includes:
[0166] A first acquisition module 401, configured to acquire data to be processed;
[0167] A first determination module 402, configured to determine the target data precision of the network module of the model used to process the data to be processed according to the feature analysis result of the data to be processed; the network module has different data precisions;
[0168] A first data loading module 403, configured to load the network module with the target data precision to process the data to be processed through the network module with the target data precision.
[0169] In some embodiments, the feature analysis result includes the complexity of the data to be processed; the first determination module 402 includes:
[0170] A feature analysis sub-module, configured to analyze the features of the to-be-processed data and determine the complexity of the to-be-processed data;
[0171] A first determination sub-module, configured to determine the target data precision of the network module according to the complexity, and a preset correspondence between the complexity of the processed data and the data precision of the network module of the model.
[0172] In some embodiments, at least one network module is included, and the data processing device may further include:
[0173] A second acquisition module, configured to acquire the output result of a first specific network module; the first specific network module is any one of the other network modules except the last network module in the model;
[0174] A prediction module, configured to predict the accuracy rate of the processing result of the model according to the output result;
[0175] A second data loading module, configured to, if it is determined according to the accuracy rate that the model does not meet the processing precision requirement, load a first candidate network module with a first data precision to process the to-be-processed data;
[0176] Wherein, the first data precision of the first candidate network module is greater than the target data precision of the first candidate network module, and the first candidate network module is a network module connected after the first specific network module in the model.
[0177] In some embodiments, the data processing device 400 may further include:
[0178] A second determination module, configured to, if the network module does not include the first candidate network module, determine the first data precision of the first candidate network module based on the accuracy rate; the first data precision is the same as or different from the target data precision.
[0179] In some embodiments, the data processing device 400 may further include:
[0180] A data clearing module, configured to, if the network module includes the first candidate network module, clear the first candidate network module with the loaded target data precision from the memory; the first data precision of the first candidate network module is greater than the target data precision of the first candidate network module.
[0181] In some embodiments, the prediction module may include:
[0182] A second determination sub-module, configured to determine an evaluation index value of the credibility of the first specific network module according to the output result;
[0183] A first acquisition sub-module, configured to input the evaluation index value into a preset mathematical model to obtain the accuracy of the processing result of the model; the preset data model is a correlation relationship model between the confidence of the network module of the model and the output result accuracy.
[0184] In some embodiments, the network module includes at least one; the data processing device 400 may further include:
[0185] A third acquisition module, configured to acquire hardware resource information of an electronic device corresponding to a second specific network module during the processing of the data to be processed; the second specific network module is any one of the other network modules except the last network module in the model;
[0186] A third determination module, configured to determine a second data precision of a second candidate network module according to the hardware resource information; the second candidate network module is the network module connected after the second specific network module in the model;
[0187] A third data loading module, configured to load the second candidate network module with the second data precision to process the data to be processed.
[0188] In some embodiments, the hardware resource information includes the current hardware resource consumption value of the electronic device; the third determination module includes:
[0189] A third determination sub-module, configured to, if the network module does not include the second candidate network module, determine the second data precision based on the current hardware resource consumption value and a preset corresponding relationship between the hardware resource consumption value and the data precision of the second candidate network module.
[0190] In some embodiments, the third determination module further includes:
[0191] A fourth determination sub-module, configured to, if the network module includes the second candidate network module and the current hardware resource consumption value does not reach the hardware resource consumption threshold, determine the second data precision based on a first ratio of the current hardware resource consumption value to the hardware resource consumption threshold; the second data precision is greater than the target data precision of the second candidate network module.
[0192] The fifth determination sub-module is configured to, if the network module includes the second candidate network module and the current hardware resource consumption value exceeds the hardware resource consumption threshold, determine the second data accuracy based on a second ratio of the current hardware resource consumption value to the hardware resource consumption threshold; the second data accuracy is less than the target data accuracy of the second candidate network module.
[0193] In some embodiments, the data processing device 400 may further include:
[0194] The fourth acquisition module is configured to acquire a selection operation of the user for the third data accuracy of the network module of the model;
[0195] The fourth data loading module is configured to, in response to the selection operation, load the network module with the third data accuracy to process the data to be processed through the network module with the third data accuracy.
[0196] It should be noted that the description of the data processing device in the embodiments of the present application is similar to the description of the above method embodiments and has similar beneficial effects as the method embodiments, so details are not repeated here. For the technical details not disclosed in the embodiments of the present device, please refer to the description of the method embodiments of the present application for understanding.
[0197] It should be noted that in the embodiments of the present application, if the control method of the above-mentioned first electronic device is implemented in the form of software function modules and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application essentially or the part that contributes to the related solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc that can store program codes. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0198] Correspondingly, the embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the control method of the first electronic device provided in the above embodiments is implemented.
[0199] The embodiments of the present application further provide an electronic device, Figure 5 which is a schematic structural diagram of an electronic device provided in the embodiments of the present application, as Figure 5As shown, the electronic device 500 includes: a processor 501, and at least one processing model that can run on the processor 501. The processing model can be called by a target application to perform at least one of the following:
[0200] Obtain data to be processed;
[0201] According to the feature analysis result of the data to be processed, determine the target data precision of the network module of the model used to process the data to be processed; the network module has different data precisions;
[0202] Load the network module with the target data precision to process the data to be processed through the network module with the target data precision..
[0203] The descriptions of the above embodiments of the electronic device and the storage medium are similar to the descriptions of the above method embodiments, and have beneficial effects similar to those of the method embodiments. For the technical details not disclosed in the embodiments of the electronic device and the storage medium of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.
[0204] It should be noted that in this article, the term "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article, or device. Without more limitations, the element defined by the statement "including at least one..." does not exclude the existence of additional identical elements in the process, method, article, or device including the element.
[0205] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The above-described device embodiments are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed with each other can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical, or other forms.
[0206] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units; they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0207] In addition, in each embodiment of the present application, each functional unit can be fully integrated into one processing unit, or each unit can be separately regarded as one unit, or two or more units can be integrated into one unit; the above-mentioned integrated unit can be implemented in the form of hardware, or in the form of a combination of hardware and software functional units.
[0208] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes: removable storage devices, ROMs, magnetic disks, or optical discs, etc., which can store program codes.
[0209] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a product to execute all or part of the methods described in the embodiments of the present application. And the foregoing storage medium includes: removable storage devices, ROMs, magnetic disks, or optical discs, etc., which can store program codes.
[0210] The above is only the implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, and all of them should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A data processing method, comprising: Obtaining data to be processed; Determining a target data precision of a network module of a model for processing the data to be processed according to a feature analysis result of the data to be processed; the network module has different data precisions; Loading the network module with the target data precision to process the data to be processed through the network module with the target data precision.
2. The method according to claim 1, wherein the feature analysis result includes the complexity of the data to be processed; The determining a target data precision of a network module of a model for processing the data to be processed according to the feature analysis result of the data to be processed includes: Analyzing the features of the data to be processed to determine the complexity of the data to be processed; Determining the target data precision of the network module according to the complexity and a preset corresponding relationship between the complexity of processing data and the data precision of the network module of the model.
3. The method according to claim 1, wherein the network module includes at least one; the method further includes: Obtaining an output result of a first specific network module; The first specific network module is any one of the other network modules except the last network module in the model; Predicting the accuracy rate of the processing result of the model according to the output result; If it is determined according to the accuracy rate that the model does not meet the processing precision requirement, loading a first candidate network module with a first data precision to process the data to be processed; Wherein, the first data precision of the first candidate network module is greater than the target data precision of the first candidate network module, and the first candidate network module is a network module connected after the first specific network module in the model.
4. The method according to claim 3, further includes: If the network module does not include the first candidate network module, determining the first data precision of the first candidate network module based on the accuracy rate; The first data precision is the same as or different from the target data precision.
5. The method according to claim 3, further includes: If the network module includes the first candidate network module, clearing the loaded first candidate network module with the target data precision from the memory; The first data precision of the first candidate network module is greater than the target data precision of the first candidate network module.
6. The method according to claim 3, wherein the predicting the accuracy rate of the processing result of the model according to the output result includes: Determining an evaluation index value of the credibility of the first specific network module according to the output result; Inputting the evaluation index value into a preset mathematical model to obtain the accuracy rate of the processing result of the model; The preset data model is a correlation relationship model between the confidence level of the network module of the model and the output result accuracy rate.
7. The method according to claim 1, wherein the network module includes at least one; the method further includes: Obtaining hardware resource information of an electronic device corresponding to a second specific network module during the process of processing the data to be processed; The second specific network module is any one of the other network modules except the last network module in the model; Determine the second data precision of the second candidate network module according to the hardware resource information; the second candidate network module is the network module connected after the second specific network module in the model; Load the second candidate network module with the second data precision to process the data to be processed.
8. The method according to claim 7, wherein the hardware resource information includes the current hardware resource consumption value of the electronic device; The determining the second data precision of the data in the second candidate network module according to the hardware resource information includes: If the network module does not include the second candidate network module, determine the second data precision based on the current hardware resource consumption value and a preset correspondence between the hardware resource consumption value and the data precision of the second candidate network module.
9. The method according to claim 7, wherein the hardware resource information includes the current hardware resource consumption value of the electronic device; the determining the second data precision of the data in the second candidate network module according to the hardware resource information includes: If the network module includes the second candidate network module and the current hardware resource consumption value does not reach the hardware resource consumption threshold, determine the second data precision based on a first ratio of the current hardware resource consumption value to the hardware resource consumption threshold; the second data precision is greater than the target data precision of the second candidate network module; If the network module includes the second candidate network module and the current hardware resource consumption value exceeds the hardware resource consumption threshold, determine the second data precision based on a second ratio of the current hardware resource consumption value to the hardware resource consumption threshold; the second data precision is less than the target data precision of the second candidate network module.
10. An electronic device, comprising a processor and at least one processing model capable of running on the processor, the processing model being callable by a target application to perform at least one of the following: Obtain data to be processed; Determine the target data precision of the network module of the model for processing the data to be processed according to the feature analysis result of the data to be processed; the network module has different data precisions; Load the network module with the target data precision to process the data to be processed through the network module with the target data precision.