Data processing method and device, equipment and storage medium

By determining the target compression operator model based on prediction processing of multimedia data in the neural network model, the problems of low compression accuracy and insufficient utilization of computing resources in the existing technology are solved, and more efficient model compression and business processing are achieved.

CN118690816AActive Publication Date: 2024-09-24CHINA AUTOMOTIVE INNOVATION CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410795023.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-09-24
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

When the existing technology compresses the neural network model, the utilization rate of computing resources is low and the accuracy of the model is greatly lost after compression. As a result, accurate prediction results cannot be output on end-side devices with limited computing power, which affects business processing efficiency.

Method used

By obtaining the preset operator model and its candidate compression operator model from the memory, using multimedia data for prediction processing, and determining the target compression operator model based on the prediction results, the compression accuracy is improved and the accuracy loss is reduced, and the computing resource usage rate and model are improved. Compression processing efficiency.

Benefits of technology

It improves the compression accuracy of the preset operator model, reduces the accuracy loss of the compressed model, improves the business processing efficiency of end-side equipment, and improves computing resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690816A
    Figure CN118690816A
Patent Text Reader

Abstract

The invention belongs to the technical field of artificial intelligence, and particularly relates to a data processing method and device, equipment and a storage medium. The method comprises the following steps: acquiring a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory; the candidate compression operator model is obtained by compressing a preset operator model based on at least two compression strategies through the processor; inputting the multimedia data into a preset operator model and each candidate compression operator model for prediction processing to obtain a first prediction result output by the preset operator model and a second prediction result output by each compression operator model; and based on the first prediction result and each second prediction result, determining a target compression operator model corresponding to a preset operator model in the candidate compression operator models. According to the scheme, the compression precision of each preset operator model in the preset operator models can be improved, so that the service processing efficiency of the end-side equipment and the utilization rate of computing resources are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and specifically relates to a data processing method, device, equipment and storage medium. Background Art

[0002] With the rapid development of artificial intelligence technology, neural network models are widely used in all areas of life. With the popularization of smart devices on the edge, more and more neural network models need to be deployed and run on edge devices with relatively small storage capacity and limited computing power. Therefore, how to efficiently apply neural network models on devices with limited computing power is an urgent problem that needs to be solved.

[0003] In the related art, the neural network model is usually compressed and then deployed on the end-side device with limited computing power. However, when compressing the neural network model, the neural network model as a whole is often only compressed to a fixed bit. On the one hand, during the model compression process, the bit width used by the neural network model is fixed, that is, the compressed neural network model is processed using the same computing resources, resulting in low computing resource utilization. On the other hand, this method does not rely on inputting feature data into the model during the model compression process, and the neural network model obtained after compression will have a large loss of accuracy. After the compressed neural network model is deployed on the end-side device, the end-side device cannot output accurate prediction results, which not only reduces the processing efficiency of the business, but also affects the normal use of the end-side device. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a data processing method, device, equipment and storage medium.

[0005] On the one hand, an embodiment of the present application provides a data processing method, the method comprising:

[0006] Obtaining a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory; wherein the preset operator model is any one of a plurality of operator models included in the preset model; and the candidate compression operator model is obtained by compressing the preset operator model by a processor based on at least two compression strategies;

[0007] Inputting the multimedia data into the preset operator model and each candidate compression operator model for prediction processing respectively, obtaining a first prediction result output by the preset operator model and a second prediction result output by each compression operator model;

[0008] Based on the first prediction result and each second prediction result, a target compression operator model corresponding to the preset operator model is determined among the candidate compression operator models.

[0009] In some optional embodiments, the method for determining the candidate compression operator model includes:

[0010] Obtain a preset operator model and at least two compression strategies;

[0011] The processor compresses weight parameters and / or activation parameters in a preset operator model based on at least two compression strategies to obtain a candidate compression operator model.

[0012] In some optional embodiments, based on the first prediction result and each second prediction result, determining a target compression operator model corresponding to a preset operator model in candidate compression operator models includes:

[0013] Based on the first prediction result, determining a target second prediction result that meets a preset condition in each second prediction result;

[0014] A candidate compression operator model that outputs the target second prediction result is determined among the candidate compression operator models, and a target compression operator model corresponding to the preset operator model is obtained.

[0015] In some optional embodiments, based on the first prediction result, determining a target second prediction result that meets a preset condition in each second prediction result includes:

[0016] Calculating the similarity between each second prediction result and the first prediction result by the processor, and obtaining the first similarity data corresponding to each second prediction result;

[0017] According to the first similarity data corresponding to each second prediction result, a target second prediction result is determined in the second prediction results; the first similarity data corresponding to the target second prediction result is greater than a similarity threshold.

[0018] In some optional embodiments, calculating the similarity between each second prediction result and the first prediction result by a processor to obtain first similarity data corresponding to each second prediction result includes:

[0019] Performing conversion processing on each second prediction result by a processor to obtain a converted second prediction result corresponding to each second prediction result;

[0020] The processor calculates the similarity between each converted second prediction result and the first prediction result respectively, and obtains the first similarity data corresponding to each second prediction result.

[0021] In some optional embodiments, the method further includes:

[0022] Obtaining from the memory a target compression operator model corresponding to each operator model included in the preset model;

[0023] Combining each target compression operator model to obtain an initial compression model;

[0024] Inputting the multimedia data into the preset model and the initial compression model for prediction processing respectively, obtaining the original prediction result output by the preset model and the initial compressed prediction result output by the initial compression model;

[0025] Calculating the similarity between the original prediction result and the initial compressed prediction result by the processor to obtain second similarity data;

[0026] When the second similarity data meets the preset condition, the initial compression model is determined as the target compression model corresponding to the preset model.

[0027] In some optional embodiments, after calculating the similarity between the original prediction result and the initial compressed prediction result by the processor to obtain the second similarity data, the method further includes:

[0028] In the case where the second similarity data does not satisfy the preset condition, determining a preset target compression operator model in the initial compression model; the preset target compression operator model is a target compression operator model that satisfies the preset condition in the initial compression model that satisfies the preset condition;

[0029] Replacing the preset target compression operator model in the initial compression model with the preset operator model corresponding to the preset target compression operator model to obtain an updated compression model;

[0030] Inputting the multimedia data into the preset model and the updated compression model for prediction processing respectively, obtaining the original prediction result output by the preset model and the updated compression prediction result output by the updated compression model;

[0031] Calculating the similarity between the original prediction result and the updated compressed prediction result by the processor to obtain third similarity data;

[0032] When the third similarity data meets the preset condition, the updated compression model is determined as the target compression model corresponding to the preset model.

[0033] On the other hand, an embodiment of the present application further provides a data processing device, the device comprising:

[0034] An acquisition module, used to acquire a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory; wherein the preset operator model is any one of a plurality of operator models included in the preset model; and the candidate compression operator model is obtained by compressing the preset operator model by a processor based on at least two compression strategies;

[0035] A prediction processing module, used to input multimedia data into a preset operator model and each candidate compression operator model for prediction processing, and obtain a first prediction result output by the preset operator model and a second prediction result output by each compression operator model;

[0036] The target compression operator model determination module is used to determine a target compression operator model corresponding to a preset operator model from candidate compression operator models based on the first prediction result and each second prediction result.

[0037] In some optional embodiments, the apparatus further includes a candidate compression operator model determination module, and the candidate compression operator model determination module includes:

[0038] An acquisition submodule, used to acquire a preset operator model and at least two compression strategies;

[0039] The compression processing submodule is used to compress the weight parameters and / or activation parameters in the preset operator model based on at least two compression strategies through a processor to obtain a candidate compression operator model.

[0040] In some optional embodiments, the target compression operator model determination module includes:

[0041] A target second prediction result determination submodule, configured to determine, based on the first prediction result, a target second prediction result that satisfies a preset condition in each second prediction result;

[0042] The target compression operator model determination submodule is used to determine the candidate compression operator model that outputs the target second prediction result among the candidate compression operator models, and obtain the target compression operator model corresponding to the preset operator model.

[0043] In some optional embodiments, the target second prediction result determination submodule includes:

[0044] A first similarity data determining unit, configured to calculate the similarity between each second prediction result and the first prediction result through a processor, to obtain first similarity data corresponding to each second prediction result;

[0045] The target second prediction result determination unit is used to determine the target second prediction result in the second prediction results according to the first similarity data corresponding to each second prediction result; the first similarity data corresponding to the target second prediction result is greater than the similarity threshold.

[0046] In some optional embodiments, the first similarity data determining unit includes:

[0047] A conversion processing subunit, configured to perform conversion processing on each second prediction result through a processor to obtain a converted second prediction result corresponding to each second prediction result;

[0048] The first similarity data determining subunit is used to calculate the similarity between each converted second prediction result and the first prediction result through a processor to obtain the first similarity data corresponding to each second prediction result.

[0049] In some optional embodiments, the device further comprises:

[0050] A model acquisition module, used to acquire from the memory a target compression operator model corresponding to each operator model included in the preset model;

[0051] An initial compression model determination module, used for combining each target compression operator model to obtain an initial compression model;

[0052] An initial compression prediction result determination module is used to input multimedia data into a preset model and an initial compression model for prediction processing, and obtain an original prediction result output by the preset model and an initial compression prediction result output by the initial compression model;

[0053] A second similarity data determination module, configured to calculate the similarity between the original prediction result and the initial compressed prediction result through a processor to obtain second similarity data;

[0054] The target compression model determination module is used to determine the initial compression model as the target compression model corresponding to the preset model when the second similarity data meets the preset conditions.

[0055] In some optional embodiments, the device further comprises:

[0056] A preset target compression operator model determination module, used to determine a preset target compression operator model in the initial compression model when the second similarity data does not meet the preset conditions; the preset target compression operator model is a target compression operator model that meets the preset conditions in the initial compression model that meets the preset conditions;

[0057] An updated compression model determination module is used to replace the preset target compression operator model in the initial compression model with a preset operator model corresponding to the preset target compression operator model to obtain an updated compression model;

[0058] An updated compression prediction result determination module is used to input multimedia data into a preset model and an updated compression model for prediction processing, and obtain an original prediction result output by the preset model and an updated compression prediction result output by the updated compression model;

[0059] A third similarity data determination module, configured to calculate the similarity between the original prediction result and the updated compressed prediction result through a processor to obtain third similarity data;

[0060] The target compression model determination module is used to determine the updated compression model as the target compression model corresponding to the preset model when the third similarity data meets the preset conditions.

[0061] On the other hand, an embodiment of the present application also provides an electronic device for data processing, the device comprising a processor and a memory, the memory storing at least one instruction or at least one program, and the at least one instruction or at least one program is loaded by the processor and executes the data processing method as described above.

[0062] On the other hand, an embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement the data processing method as described above.

[0063] The data processing method, apparatus, device and storage medium proposed in the embodiments of the present application obtain the preset operator model in the preset model and the candidate compression operator model corresponding to the preset operator model from the memory, use multimedia data to input the preset operator model and each candidate compression operator model for prediction processing, obtain the first prediction result output by the preset operator model and the second prediction result output by each compression operator model, and then determine the target compression operator model corresponding to the preset operator model in the candidate compression operator model based on the first prediction result and each second prediction result, which can improve the compression accuracy of each preset operator model in the preset operator model and reduce the accuracy loss of the model obtained after compression, thereby improving the business processing efficiency of the terminal side device. In addition, the candidate compression operator model is obtained by compressing the preset operator model by the processor based on at least two compression strategies, which can improve the utilization rate of computing resources and improve the efficiency of model compression processing, thereby reducing system operation consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0065] Figure 1 It is a schematic diagram of an implementation environment of a data processing method according to an exemplary embodiment.

[0066] Figure 2 It is a flowchart of a data processing method according to an exemplary embodiment.

[0067] Figure 3It is a block diagram of a data processing device according to an exemplary embodiment.

[0068] Figure 4 It is a hardware structure block diagram of a server of a data processing method provided according to an exemplary embodiment. DETAILED DESCRIPTION

[0069] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0070] It should be noted that the terms "first", "second", etc. in the specification and claims of the embodiment of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the embodiment of the present application described here can be implemented in an order other than those illustrated or described here. Thus, the features defined as "first" and "second" can expressly or implicitly include one or more of the features. In the description of the present embodiment, unless otherwise specified, the meaning of "multiple" is two or more. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0071] In order to make the purpose, technical solution and advantages disclosed in the embodiments of the present application more clearly understood, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present application and are not used to limit the embodiments of the present application.

[0072] With the development of deep learning, neural networks are widely used in various fields. While improving model performance, they also introduce a huge amount of parameters and calculations. Applications require a large amount of memory and have a huge computational overhead. Therefore, the application of models on devices with limited computing power is limited. Compressing the model can speed up model reasoning and reduce hardware requirements. However, traditional model compression methods usually compress the entire neural network model to a fixed bit. This compression method cannot achieve a good balance between accuracy and performance. The neural network model obtained after compression will have a large loss of accuracy, making it impossible for the model to output accurate prediction results after being applied to the end-side device. This not only reduces the processing efficiency of the business, but also causes problems such as waste of computing resources.

[0073] In view of this, the embodiments of the present application propose a data processing method, apparatus, device and storage medium, which obtains the preset operator model in the preset model and the candidate compression operator model corresponding to the preset operator model from the memory, and uses multimedia data to input the preset operator model and each candidate compression operator model for prediction processing, so as to obtain the first prediction result output by the preset operator model and the second prediction result output by each compression operator model, and then determines the target compression operator model corresponding to the preset operator model in the candidate compression operator model based on the first prediction result and each second prediction result, so as to improve the compression accuracy of each preset operator model in the preset operator model, reduce the accuracy loss of the model obtained after compression, and thus improve the business processing efficiency of the terminal side device. In addition, the candidate compression operator model is obtained by compressing the preset operator model by the processor based on at least two compression strategies, which can improve the utilization rate of computing resources and improve the efficiency of model compression processing.

[0074] Figure 1 FIG. 1 is a schematic diagram of an implementation environment of a data processing method according to an exemplary embodiment. Figure 1 As shown, the implementation environment may include at least a client 01 and a server 02. The client 01 and the server 2 may be directly or indirectly connected via wired or wireless communication, which is not limited in the present application.

[0075] Specifically, the server 02 can be used to obtain a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory; wherein the preset operator model is any one of the multiple operator models included in the preset model; the candidate compression operator model is obtained by compressing the preset operator model based on at least two compression strategies by the processor. It is also used to input multimedia data into the preset operator model and each candidate compression operator model for prediction processing, and obtain a first prediction result output by the preset operator model and a second prediction result output by each compression operator model. It is also used to determine the target compression operator model corresponding to the preset operator model in the candidate compression operator model based on the first prediction result and each second prediction result. Optionally, the server 02 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0076] Specifically, the client 01 can be used to obtain a compression model corresponding to a preset model from the server 02, and use the compression model for business processing. Optionally, the client 01 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, an intelligent voice interaction device, a smart home appliance, a smart watch, a vehicle terminal, an aircraft, etc., but is not limited thereto. The embodiments of the present application can be applied to various scenarios, including but not limited to rendering and displaying interactive information involved in various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving.

[0077] It should be noted that Figure 1 This is just an example. In other scenarios, other implementation environments may also be included.

[0078] Figure 2 is a flowchart of a data processing method according to an exemplary embodiment. The method can be used for Figure 1 In the implementation environment of the embodiment. This specification provides the method operation steps as described in the embodiment or flowchart, but based on routine or non-creative labor, more or fewer operation steps may be included. The order of steps listed in the embodiment is only one way of executing the order of many steps, and does not represent the only execution order. When the actual system or server product is executed, the method sequence shown in the embodiment or the figure can be executed or executed in parallel (for example, in a parallel processor or multi-threaded processing environment). The method can be applied to a server, specifically as Figure 2 As shown, including:

[0079] S101: Acquire a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory.

[0080] In an embodiment of the present application, the preset operator model is any one of the multiple operator models included in the preset model. The preset model is obtained by model training using sample multimedia data. Optionally, the sample multimedia data may be any one of a variety of data such as text data, audio data, image data, etc. The preset model may be a model for making predictions based on multimedia data. As an example, the preset model may be an autonomous driving control model, and by inputting the environmental perception data collected by the vehicle-mounted sensor into the preset model for predictive processing, the preset model may output corresponding autonomous driving parameters. As another example, the preset model may be a generative language model, and by inputting text data into the preset model for predictive processing, the preset model may output corresponding generated text.

[0081] In order to enable the preset model to be deployed in the terminal device with limited computing power, after the preset model is obtained through model training, the preset model can be compressed to obtain a target compression model corresponding to the preset model.

[0082] Specifically, the preset model may include a preset number of neural network layers. Optionally, the preset number may be one layer, two layers, or more layers, and the embodiments of the present application do not impose too many restrictions on this. For each neural network layer, it can be compressed as a separate operator model, thereby improving the compression rate of the model.

[0083] For any operator model, there may be two or more candidate compression operator models corresponding to it. These candidate compression operator models are obtained by compressing the operator model by the processor based on at least two compression strategies.

[0084] Specifically, the method for determining the candidate compression operator model may include: obtaining a preset operator model and at least two compression strategies. The processor compresses weight parameters and / or activation parameters in the preset operator model based on the at least two compression strategies to obtain the candidate compression operator model.

[0085] In an embodiment of the present application, when compressing a preset operator model, a compression strategy can be obtained first, and then the preset operator model can be compressed according to the determined compression strategy. Each compression strategy may include a compression type and a compression algorithm. Among them, the compression type includes but is not limited to symmetric compression, asymmetric compression, layer-by-layer compression, channel-by-channel compression, etc. The compression algorithm includes but is not limited to the maximum-minimum algorithm, the sliding average maximum-minimum algorithm, the relative entropy (Kullback-Leibler divergence, KL distance) algorithm, etc. When determining the compression strategy, a compression type can be selected from the pre-constructed compression type information table, and a compression algorithm can be selected from the compression algorithm information table, thereby combining into a compression strategy. According to the above method, one or more compression strategies can be obtained, and these compression strategies can be constituted into a compression strategy set.

[0086] In an embodiment of the present application, when compressing a preset operator model, at least two candidate compression factors corresponding to the preset operator model can be determined based on at least two compression strategies. Each compression strategy corresponds to a candidate compression factor. Then, based on each candidate compression factor, the preset operator model is compressed. Specifically, after compressing the preset operator model, each compression strategy can obtain a candidate compression operator model. When compressing the preset operator model, the weight parameters and / or activation parameters corresponding to the preset operator model can be compressed. The weight parameters and activation parameters in the preset operator model are obtained based on model training. After compressing the preset operator model using each candidate compression factor, candidate compression operator models corresponding to at least two preset operator models can be obtained.

[0087] In an embodiment of the present application, when compressing a single operator model, one or more compression strategies may be selected from a compression strategy set, and then the weights and activation parameters corresponding to the single operator model may be compressed using the selected one or more compression strategies. Different compression strategies may obtain different compression operator models when compressing the single operator model. These different compression operator models constitute candidate compression operator models corresponding to the preset operator model.

[0088] S103: Inputting the multimedia data into the preset operator model and each candidate compression operator model for prediction processing respectively, and obtaining a first prediction result output by the preset operator model and a second prediction result output by each compression operator model.

[0089] In an embodiment of the present application, after obtaining the preset operator model and its corresponding candidate operator model, multimedia data can be used to detect the prediction accuracy of each candidate operator model, so that the candidate operator model whose prediction accuracy meets the requirements is used as the compression operator model corresponding to the preset operator model.

[0090] Specifically, the multimedia data is first acquired, and then the multimedia data is respectively input into the preset operator model and each candidate operator model for prediction processing. Optionally, the multimedia data can be the model training data used when training the preset model, or it can be data that can be input into the preset model for prediction. Before the multimedia data is input into the preset operator model and each candidate compression operator model, it is necessary to first embed the multimedia data and convert it into feature data that the model can process, such as feature vectors, and then input the feature data into the preset operator model and each candidate compression operator model for prediction.

[0091] As an example, for the first layer operator model in the preset model, after obtaining the feature data, the feature data is input into the operator model, and the operator model uses its corresponding weight parameter to calculate the input feature data, thereby outputting the corresponding first prediction result. Similarly, for any candidate operator model, after obtaining the feature data, the feature data is input into the candidate operator model, and the candidate operator model uses its corresponding weight parameter to calculate the input feature data, thereby outputting the corresponding second prediction result.

[0092] As another example, for a non-first-layer operator model in a preset model, after obtaining feature data, the feature data is input into the first-layer operator model in the preset model to obtain the activation value output by the first-layer operator model, and then the activation value is input into the next-layer operator model to obtain the activation value output by the next-layer operator model. Repeat this process until the activation value output by the previous layer of the current operator model is obtained. Then the activation value output by the previous layer of the current operator model is input into the current operator model, so that the current operator model inputs the first prediction result. For any candidate operator model, the activation value output by the previous layer of the current operator model is input into the candidate operator model to obtain the second prediction result output by the candidate operator model. For example, the current operator model is the third-layer neural network in the preset model. After obtaining feature data, the feature data is input into the first-layer operator model in the preset model to obtain the activation value output by the first-layer operator model, and then the activation value is input into the second-layer operator model to obtain the activation value output by the second-layer operator model. Then, the activation value output by the second layer operator model is input into the current operator model for prediction processing, and the first prediction result can be obtained. Similarly, the activation value output by the second layer operator model is input into each candidate operator model for prediction processing, and the second prediction result output by each candidate operator model can be obtained.

[0093] S105: Based on the first prediction result and each second prediction result, determine a target compression operator model corresponding to the preset operator model from candidate compression operator models.

[0094] In the embodiment of the present application, among the multiple candidate compression operator models corresponding to a preset operator model, these candidate compression operator models are screened to select a candidate compression operator model with high accuracy as the target compression operator model corresponding to the preset operator model. Specifically, based on the first prediction result, a target second prediction result that satisfies the preset condition is determined in each second prediction result. Then, a candidate compression operator model that outputs the target second prediction result is determined in the candidate compression operator models to obtain the target compression operator model corresponding to the preset operator model.

[0095] When determining the target second prediction result that meets the preset conditions in each second prediction result, the processor can calculate the similarity between each second prediction result and the first prediction result respectively to obtain the first similarity data corresponding to each second prediction result. Then, according to the first similarity data corresponding to each second prediction result, the target second prediction result is determined in the second prediction results. The first similarity data corresponding to the target second prediction result is greater than the similarity threshold. In other words, when determining the target compression operator model corresponding to the preset operator model, the first prediction result output by the preset operator model and the second prediction result output by each candidate operator model are used to perform similarity calculation to obtain multiple first similarity data. Thus, among the candidate compression operator models, the candidate compression operator model whose first similarity data meets the preset conditions is determined as the target compression operator model corresponding to the preset operator model.

[0096] In an embodiment of the present application, when the candidate compression operator models are screened according to the preset conditions, the screening can be performed based on the first similarity data corresponding to each second prediction result to obtain the target compression operator model. Optionally, the preset condition can be that the first similarity data is greater than a threshold value, or that the first similarity data is the largest. Screening based on the first similarity data corresponding to each second prediction result can ensure the compression accuracy of each layer of the operator model, thereby improving the accuracy of the target compression model.

[0097] In the embodiment of the present application, since the second prediction result is integer type data, and the first prediction result is usually floating point type data. Moreover, when compressing the first prediction result, the first prediction result may be numerically mapped, so that the second prediction result and the first prediction result are not necessarily in the same numerical space. Therefore, when calculating the first similarity data corresponding to the second prediction result, the second prediction result needs to be decompressed before the first similarity data can be calculated. Specifically, each second prediction result is converted by the processor to obtain the converted second prediction result corresponding to each second prediction result. Then, the processor calculates the similarity of each converted second prediction result with the first prediction result respectively through the processor to obtain the first similarity data corresponding to each second prediction result.

[0098] When performing similarity calculation based on the first prediction result output by the preset operator model and the second prediction result output by each candidate operator model, it is necessary to first perform decompression processing on each second prediction result to obtain the decompressed prediction result corresponding to each second prediction result. Then, similarity calculation is performed based on the first prediction result output by the preset operator model and the decompressed prediction result corresponding to each second prediction result to obtain the first similarity data corresponding to each second prediction result. The similarity calculation of the second prediction result and the first prediction result can be calculated according to the following formula:

[0099]

[0100] Among them, S is the first similarity data, x i is the i-th component of the N-dimensional vector X, y i is the i-th component of the N-dimensional vector Y, vector X is the inverse compression prediction result corresponding to the second prediction result, and vector Y is the first prediction result output by the preset operator model.

[0101] In an embodiment of the present application, after obtaining the target compression operator model corresponding to each operator model in the preset model, the target compression operator model corresponding to each operator model can be stored in a memory to facilitate subsequent compression or decompression of each operator model in the preset model.

[0102] In the embodiment of the present application, after obtaining the target compression operator models corresponding to all the operator models in the preset model, the target compression operator models can be combined according to the positions of the operator models in the preset model to obtain the initial compression model corresponding to the preset model. In order to ensure the accuracy of the model after compression, the accuracy of the initial compression model can be judged, and if the accuracy meets the requirements, the initial compression model is used as the target compression model of the preset model.

[0103] Specifically, a target compression operator model corresponding to each operator model included in the preset model is obtained from the memory. Then, each target compression operator model is combined to obtain an initial compression model. By inputting multimedia data into the preset model and the initial compression model for prediction processing, an original prediction result output by the preset model and an initial compression prediction result output by the initial compression model are obtained. Then, the processor calculates the similarity between the original prediction result and the initial compression prediction result to obtain second similarity data. When the second similarity data meets the preset condition, the initial compression model is determined as the target compression model corresponding to the preset model.

[0104] Specifically, after obtaining the target compression operator model corresponding to each operator model in the preset model, the target compression operator models corresponding to each operator model can be connected according to the connection order of each layer in the preset model to obtain an initial compression model. In order to ensure the compression accuracy, the accuracy of the initial compression model can be determined using multimedia data. That is, the multimedia data is respectively input into the initial compression model and the preset model for processing. After obtaining the original prediction result and the initial compression prediction result, the accuracy of the initial compression model is judged by calculating the similarity between the two. The similarity between the original prediction result and the initial compression prediction result can be calculated by referring to the similarity calculation method of the first prediction result and the second prediction result output by the preset operator model, which will not be repeated here.

[0105] In the embodiment of the present application, after obtaining the second similarity data, the second similarity data being greater than the similarity threshold can be used as a preset condition to perform accuracy judgment. If the second similarity data is greater than the similarity threshold, the initial compression model can be determined as the target compression model corresponding to the preset model.

[0106] In the embodiment of the present application, when the second similarity data does not meet the preset condition, that is, when the second similarity data is less than or equal to the similarity threshold, in order to ensure the accuracy of model compression, the initial compression model can be updated according to the first similarity data.

[0107] Specifically, when the second similarity data does not meet the preset conditions, a preset target compression operator model is determined in the initial compression model. The preset target compression operator model is a target compression operator model that meets the preset conditions in the initial compression model that meets the preset conditions. Then, in the initial compression model, the preset target compression operator model is replaced with a preset operator model corresponding to the preset target compression operator model to obtain an updated compression model. Next, the multimedia data is respectively input into the preset model and the updated compression model for prediction processing to obtain the original prediction result output by the preset model and the updated compression prediction result output by the updated compression model. The processor calculates the similarity of the original prediction result and the updated compression prediction result to obtain the third similarity data. When the third similarity data meets the preset conditions, the updated compression model is determined as the target compression model corresponding to the preset model.

[0108] That is to say, when the accuracy of the initial compression model does not meet the accuracy requirements, the first similarity data corresponding to each layer of the target compression operator model in the initial compression model is determined, and then the layer whose first similarity data is less than the similarity threshold or whose first similarity data is the smallest is determined, and the target compression operator model is changed to the operator model before compression, and then the updated compression model is obtained. The accuracy of the updated compression model is also tested using multimedia data. If the accuracy of the updated compression model meets the conditions, the updated compression model is used as the target compression model. If the accuracy of the updated compression model does not meet the conditions, the target compression operator model is repeatedly changed to the operator model before compression for the layer whose first similarity data is less than the similarity threshold or whose first similarity data is the smallest, until the accuracy of the updated compression model meets the conditions or all layers of the updated compression model are replaced with the operator model before compression.

[0109] The data processing method described in the embodiment of the present application compresses each layer of the neural network in the preset model separately, determines the target compression strategy with the largest first similarity data, compresses the corresponding operator model, and ensures the compression accuracy of each layer of the operator model. For the layer with lower first similarity data, the compression is canceled, the original accuracy is maintained, and the final accuracy of the compression model is ensured to meet the standard through the mixed accuracy strategy. While achieving model compression, this method ensures that the accuracy of the target compression model meets the standard, and can automatically adjust the compression strategy of each operator model to avoid resource consumption caused by manual search, thereby improving the model compression efficiency and reducing the model compression cost. At the same time, since the target compression model finally obtained has a high prediction accuracy, it can be applied to terminal devices such as smart phones, tablet computers, laptops, desktop computers, smart speakers, smart voice interaction devices, smart home appliances, smart watches, vehicle terminals, aircraft, etc., so that the terminal devices can better perform multimedia-related services, such as content generation, audio and video recommendation, voice and video optimization, etc.

[0110] The present application also provides a data processing device. Figure 3 FIG. 1 is a block diagram of a data processing device according to an exemplary embodiment. Figure 3 As shown, the device may include at least:

[0111] The acquisition module 201 is used to acquire a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory; wherein the preset operator model is any one of the multiple operator models included in the preset model; the candidate compression operator model is obtained by compressing the preset operator model based on at least two compression strategies by a processor;

[0112] The prediction processing module 203 is used to input the multimedia data into the preset operator model and each candidate compression operator model for prediction processing, and obtain a first prediction result output by the preset operator model and a second prediction result output by each compression operator model;

[0113] The target compression operator model determination module 205 is used to determine a target compression operator model corresponding to a preset operator model from candidate compression operator models based on the first prediction result and each second prediction result.

[0114] In some optional embodiments, the apparatus further includes a candidate compression operator model determination module, and the candidate compression operator model determination module includes:

[0115] An acquisition submodule, used to acquire a preset operator model and at least two compression strategies;

[0116] The compression processing submodule is used to compress the weight parameters and / or activation parameters in the preset operator model based on at least two compression strategies through a processor to obtain a candidate compression operator model.

[0117] In some optional embodiments, the target compression operator model determination module includes:

[0118] A target second prediction result determination submodule, configured to determine, based on the first prediction result, a target second prediction result that satisfies a preset condition in each second prediction result;

[0119] The target compression operator model determination submodule is used to determine the candidate compression operator model that outputs the target second prediction result among the candidate compression operator models, and obtain the target compression operator model corresponding to the preset operator model.

[0120] In some optional embodiments, the target second prediction result determination submodule includes:

[0121] A first similarity data determining unit, configured to calculate the similarity between each second prediction result and the first prediction result through a processor, to obtain first similarity data corresponding to each second prediction result;

[0122] The target second prediction result determination unit is used to determine the target second prediction result in the second prediction results according to the first similarity data corresponding to each second prediction result; the first similarity data corresponding to the target second prediction result is greater than the similarity threshold.

[0123] In some optional embodiments, the first similarity data determining unit includes:

[0124] A conversion processing subunit, configured to perform conversion processing on each second prediction result through a processor to obtain a converted second prediction result corresponding to each second prediction result;

[0125] The first similarity data determining subunit is used to calculate the similarity between each converted second prediction result and the first prediction result through a processor to obtain the first similarity data corresponding to each second prediction result.

[0126] In some optional embodiments, the device further comprises:

[0127] A model acquisition module, used to acquire from the memory a target compression operator model corresponding to each operator model included in the preset model;

[0128] An initial compression model determination module, used for combining each target compression operator model to obtain an initial compression model;

[0129] An initial compression prediction result determination module is used to input multimedia data into a preset model and an initial compression model for prediction processing, and obtain an original prediction result output by the preset model and an initial compression prediction result output by the initial compression model;

[0130] A second similarity data determination module, configured to calculate the similarity between the original prediction result and the initial compressed prediction result through a processor to obtain second similarity data;

[0131] The target compression model determination module is used to determine the initial compression model as the target compression model corresponding to the preset model when the second similarity data meets the preset conditions.

[0132] In some optional embodiments, the device further comprises:

[0133] A preset target compression operator model determination module, used to determine a preset target compression operator model in the initial compression model when the second similarity data does not meet the preset conditions; the preset target compression operator model is a target compression operator model that meets the preset conditions in the initial compression model that meets the preset conditions;

[0134] An updated compression model determination module is used to replace the preset target compression operator model in the initial compression model with a preset operator model corresponding to the preset target compression operator model to obtain an updated compression model;

[0135] An updated compression prediction result determination module is used to input multimedia data into a preset model and an updated compression model for prediction processing, and obtain an original prediction result output by the preset model and an updated compression prediction result output by the updated compression model;

[0136] A third similarity data determination module, configured to calculate the similarity between the original prediction result and the updated compressed prediction result through a processor to obtain third similarity data;

[0137] The target compression model determination module is used to determine the updated compression model as the target compression model corresponding to the preset model when the third similarity data meets the preset conditions.

[0138] It should be noted that the data processing device embodiment provided in the embodiments of the present application and the above-mentioned data processing method embodiment are based on the same inventive concept.

[0139] An embodiment of the present application also provides an electronic device for data processing, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement a data processing method provided in any of the above embodiments.

[0140] An embodiment of the present application also provides a computer-readable storage medium, which can be set in a terminal to store at least one instruction or at least one program for implementing a data processing method in a method embodiment, and the at least one instruction or at least one program is loaded and executed by a processor to implement the data processing method provided in the above method embodiment.

[0141] Optionally, in the embodiment of this specification, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the above storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0142] The memory of the embodiment of this specification can be used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, applications required for functions, etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.

[0143] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the data processing method provided by the above method embodiment.

[0144] The method embodiments provided in the embodiments of the present application can be executed in a terminal, a computer terminal, a server or a similar computing device. Taking running on a server as an example, Figure 4 FIG. 1 is a hardware structure diagram of a server of a data processing method provided according to an exemplary embodiment. Figure 4As shown, the server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 310 (the central processing unit 310 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 330 for storing data, and one or more storage media 320 (such as one or more mass storage devices) for storing application programs 323 or data 322. Among them, the memory 330 and the storage medium 320 can be short-term storage or permanent storage. The program stored in the storage medium 320 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 310 can be configured to communicate with the storage medium 320 and execute a series of instruction operations in the storage medium 320 on the server 300. The server 300 may also include one or more power supplies 360, one or more wired or wireless network interfaces 350, one or more input and output interfaces 340, and / or one or more operating systems 321, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0145] The input / output interface 340 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 300. In one example, the input / output interface 340 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In one example, the input / output interface 340 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0146] It can be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 4 More or fewer components as shown, or with Figure 4 Different configurations shown.

[0147] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0148] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and server embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0149] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0150] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A data processing method, It is characterized in that The method comprises: Obtaining a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory; wherein the preset operator model is any one of a plurality of operator models included in the preset model; and the candidate compression operator model is obtained by compressing the preset operator model by a processor based on at least two compression strategies; Inputting multimedia data into the preset operator model and each candidate compression operator model for prediction processing respectively, obtaining a first prediction result output by the preset operator model and a second prediction result output by each compression operator model; Based on the first prediction result and each of the second prediction results, a target compression operator model corresponding to the preset operator model is determined from among the candidate compression operator models.

2. The method according to claim 1, It is characterized in that The method for determining the candidate compression operator model includes: Obtain a preset operator model and at least two compression strategies; The processor compresses the weight parameters and / or activation parameters in the preset operator model based on at least two of the compression strategies to obtain the candidate compression operator model.

3. The method according to claim 1 or 2, It is characterized in that The determining, based on the first prediction result and each of the second prediction results, a target compression operator model corresponding to the preset operator model from among the candidate compression operator models comprises: Based on the first prediction result, determining a target second prediction result that meets a preset condition in each of the second prediction results; A candidate compression operator model that outputs the target second prediction result is determined among the candidate compression operator models, and a target compression operator model corresponding to the preset operator model is obtained.

4. The method according to claim 3, It is characterized in that The determining, based on the first prediction result, a target second prediction result that meets a preset condition in each of the second prediction results includes: Calculating, by a processor, the similarity between each of the second prediction results and the first prediction result, respectively, to obtain first similarity data corresponding to each of the second prediction results; The target second prediction result is determined in the second prediction results according to the first similarity data corresponding to each of the second prediction results; the first similarity data corresponding to the target second prediction result is greater than a similarity threshold.

5. The method according to claim 4, It is characterized in that The processor calculates the similarity between each second prediction result and the first prediction result to obtain first similarity data corresponding to each second prediction result, including: Performing conversion processing on each of the second prediction results by a processor to obtain a converted second prediction result corresponding to each of the second prediction results; The processor calculates the similarity between each of the converted second prediction results and the first prediction result respectively, and obtains first similarity data corresponding to each of the second prediction results.

6. The method according to claim 1, It is characterized in that The method further comprises: Acquire from the memory a target compression operator model corresponding to each operator model included in the preset model; Combining each of the target compression operator models to obtain an initial compression model; Inputting multimedia data into the preset model and the initial compression model respectively for prediction processing, and obtaining an original prediction result output by the preset model and an initial compressed prediction result output by the initial compression model; Calculating the similarity between the original prediction result and the initial compressed prediction result by a processor to obtain second similarity data; When the second similarity data meets a preset condition, the initial compression model is determined as a target compression model corresponding to the preset model.

7. The method according to claim 6, It is characterized in that After the processor calculates the similarity between the original prediction result and the initial compressed prediction result to obtain second similarity data, the method further includes: In the case where the second similarity data does not satisfy the preset condition, determining a preset target compression operator model in the initial compression model; the preset target compression operator model is a target compression operator model that satisfies the preset condition in the initial compression model that satisfies the preset condition; Replacing the preset target compression operator model in the initial compression model with a preset operator model corresponding to the preset target compression operator model to obtain an updated compression model; Inputting multimedia data into the preset model and the updated compression model for prediction processing respectively, and obtaining an original prediction result output by the preset model and an updated compression prediction result output by the updated compression model; Calculating, by a processor, the similarity between the original prediction result and the updated compressed prediction result to obtain third similarity data; When the third similarity data meets a preset condition, the updated compression model is determined as a target compression model corresponding to the preset model.

8. A data processing device, It is characterized in that The device comprises: An acquisition module, configured to acquire a preset operator model and a candidate compression operator model corresponding to the preset operator model from a memory; wherein the preset operator model is any one of a plurality of operator models included in the preset model; and the candidate compression operator model is obtained by compressing the preset operator model by a processor based on at least two compression strategies; A prediction processing module, used to input multimedia data into the preset operator model and each candidate compression operator model for prediction processing, and obtain a first prediction result output by the preset operator model and a second prediction result output by each of the compression operator models; A target compression operator model determination module is used to determine a target compression operator model corresponding to the preset operator model from the candidate compression operator models based on the first prediction result and each of the second prediction results.

9. An electronic device for data processing, It is characterized in that The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded by the processor and executes the data processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The storage medium stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the data processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Super-resolution method based on single image

    CN104008538A

  • Graph neural network compression method and device, electronic equipment and storage medium

    CN115934661A

  • Method and device for determining target intention customer group, electronic equipment and storage medium

    CN118134647A

  • Operator scheduling operation time comparison method and device, and storage medium

    WO2023150912A1