CN113392688A - Data processing method and device, computer equipment and storage medium - Google Patents

Data processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113392688A
CN113392688A CN202011551623.XA CN202011551623A CN113392688A CN 113392688 A CN113392688 A CN 113392688A CN 202011551623 A CN202011551623 A CN 202011551623A CN 113392688 A CN113392688 A CN 113392688A
Authority
CN
China
Prior art keywords
data processing
data
weight
weight matrix
convolution kernel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011551623.XA
Other languages
Chinese (zh)
Inventor
向天戈
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011551623.XA priority Critical patent/CN113392688A/en
Publication of CN113392688A publication Critical patent/CN113392688A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the application discloses a data processing method and device, computer equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: acquiring sample data and a corresponding labeling result, calling a data processing model, processing the sample data to obtain a prediction result, adjusting a convolution kernel and a corresponding weight matrix in the data processing model according to the labeling result and the prediction result, reducing the convolution kernel and the corresponding weight matrix in the convolution layer after the current adjustment in response to that the weight variance corresponding to any convolution layer in the data processing model is greater than a reference threshold value to obtain an updated data processing model, calling the updated data processing model, processing the data to obtain a processing result of the data, and reducing the sizes of the convolution kernel and the corresponding weight matrix in the convolution layer through the weight variance to reduce the data amount in the data processing model.

Description

Data processing method and device, computer equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a data processing method, a data processing device, computer equipment and a storage medium.
Background
With the development of artificial intelligence technology, network models are widely applied to various service scenes, such as image classification scenes, image segmentation scenes, image recognition scenes and the like, the network models can be respectively deployed in different service scenes, and service data can be processed by calling the network models. Usually, a network model is deployed by a technician according to sample data, the network model deployed in this way includes a plurality of convolution layers and a plurality of convolution kernels, the size of the convolution kernels is large, and the amount of data included is large, so that the efficiency of processing data by the network model is low.
Disclosure of Invention
The embodiment of the application provides a data processing method and device, computer equipment and a storage medium, and the data processing efficiency of a data processing model can be improved. The technical scheme is as follows:
in one aspect, a data processing method is provided, and the method includes:
acquiring sample data and a corresponding labeling result;
calling a data processing model, processing the sample data to obtain a prediction result, wherein the data processing model comprises at least one convolution layer, each convolution layer comprises at least one convolution kernel, and each convolution kernel corresponds to a weight matrix;
adjusting a convolution kernel and a corresponding weight matrix in the data processing model according to the labeling result and the prediction result;
in response to that the weight variance corresponding to any convolutional layer in the data processing model is larger than a reference threshold, reducing the convolutional cores and the corresponding weight matrixes in the convolutional layers after the current adjustment to obtain an updated data processing model, wherein the weight variance is the variance of the weight matrixes in the convolutional layers before the current adjustment;
and calling the updated data processing model, and processing the data to obtain a processing result of the data.
In another aspect, there is provided a data processing apparatus, the apparatus comprising:
the acquisition module is used for acquiring sample data and a corresponding labeling result;
the processing module is used for calling a data processing model and processing the sample data to obtain a prediction result, wherein the data processing model comprises at least one convolution layer, each convolution layer comprises at least one convolution kernel, and each convolution kernel corresponds to a weight matrix;
the adjusting module is used for adjusting a convolution kernel and a corresponding weight matrix in the data processing model according to the labeling result and the prediction result;
a reduction module, configured to reduce a convolution kernel and a corresponding weight matrix in a convolutional layer after the current adjustment in response to that a weight variance corresponding to any convolutional layer in the data processing model is greater than a reference threshold, so as to obtain an updated data processing model, where the weight variance is a variance of the weight matrix in the convolutional layer before the current adjustment;
the processing module is further configured to invoke the updated data processing model, and process the data to obtain a processing result of the data.
In a possible implementation manner, the obtaining module is further configured to obtain a weight variance corresponding to each convolutional layer according to weights in at least one weight matrix corresponding to each convolutional layer.
In another possible implementation manner, the obtaining unit is configured to determine an initial loss value of the data processing model according to the labeling result and the prediction result; determining a first sum of weight variances corresponding to the at least one convolutional layer; determining a difference between the initial loss value and the first sum value as a loss value for the data processing model.
In another possible implementation manner, the obtaining unit is configured to determine an initial loss value of the data processing model according to the labeling result and the prediction result; determining a second sum of the weights in the weight matrix corresponding to the at least one convolutional layer; and determining the sum of the initial loss value and the second sum as the loss value of the data processing model.
In another possible implementation manner, the data processing model is an image classification model, and the data is image data;
and the processing module is used for calling the updated image classification model, classifying the image data and obtaining the category of the image data.
In another possible implementation manner, the data processing model is an object recognition model, and the data is image data;
and the processing module is used for calling the updated object identification model, identifying the image data and obtaining the category of the object contained in the image data and the position of the object in the image data.
In another aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory having stored therein at least one computer program, the at least one computer program being loaded and executed by the processor to perform operations performed in the data processing method according to the above aspect.
In another aspect, a computer-readable storage medium is provided, in which at least one computer program is stored, the at least one computer program being loaded and executed by a processor to implement the operations performed in the data processing method according to the above aspect.
In yet another aspect, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer program code, the computer program code being stored in a computer readable storage medium. The processor of the computer device reads the computer program code from the computer-readable storage medium, and executes the computer program code, so that the computer device implements the operations performed in the data processing method as described in the above aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
according to the method, the device, the computer equipment and the storage medium provided by the embodiment of the application, in the process of training the data processing model, the convolution kernels in the data processing model and the corresponding weight matrixes are adjusted to ensure the accuracy of the data processing model, the data volume of the convolution layers is judged through the weight variance of the convolution layers, and when the data volume of the convolution layers is large, the convolution kernels in the convolution layers and the corresponding weight matrixes are reduced in size through the weight variance to reduce the data volume of the data processing model, so that the processing efficiency of the data processing model is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application;
fig. 2 is a flowchart of a data processing method provided in an embodiment of the present application;
fig. 3 is a flowchart of a data processing method provided in an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating an average pooling of weight matrices according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a reduction of a convolution kernel according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an automatic search model using a data processing method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail with reference to the accompanying drawings.
As used herein, the terms "at least one," "a plurality," "each," and "any," at least one of which includes one, two, or more than two, and a plurality of which includes two or more than two, each of which refers to each of the corresponding plurality, and any of which refers to any of the plurality. For example, the plurality of convolutional layers includes 3 convolutional layers, each of which refers to each of the 3 convolutional layers, and any of the 3 convolutional layers can be a first convolutional layer, a second convolutional layer, or a third convolutional layer.
Artificial Intelligence (AI) is a theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human Intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.
The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
Machine Learning (ML) is a multi-domain cross discipline, and relates to a plurality of disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and the like. The special research on how a computer simulates or realizes the learning behavior of human beings so as to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve the performance of the computer. Machine learning is the core of artificial intelligence, is the fundamental approach for computers to have intelligence, and is applied to all fields of artificial intelligence. Machine learning and deep learning generally include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
According to the scheme provided by the embodiment of the application, the data processing model can be updated based on the machine learning technology of artificial intelligence, and the data processing method is realized by using the updated data processing model.
The data processing method provided by the embodiment of the application can be used in computer equipment. Optionally, the computer device is a terminal or a server. Optionally, the server is an independent physical server, or a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, and the like. Optionally, the terminal is a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto.
Fig. 1 is a schematic structural diagram of an implementation environment provided by an embodiment of the present application, and as shown in fig. 1, the system includes a terminal 101 and a server 102, where the terminal 101 and the server 102 can be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
Alternatively, the terminal 101 has installed thereon a target application served by the server 102, by which the terminal 101 can implement functions such as image classification, object recognition, and the like. Optionally, the target application is a target application in an operating system of the terminal 101, or a target application provided by a third party. For example, the target application is a smart camera application having a face recognition function, but of course, the smart camera application can also have other functions, such as, for example, age recognition, face changing, automatic make-up, and the like.
The terminal 101 is configured to log in a target application based on the user identifier, and send data to the server 102 through the target application, and the server 102 is configured to receive the data sent by the terminal 101, process the data sent by the terminal 101, and can return a processing result of the data to the terminal 101.
The method provided by the embodiment of the application can be used for various scenes.
For example, in a face recognition scenario:
after a terminal acquires a sample face image and a corresponding labeling result, a convolution kernel in a data processing model and a corresponding weight matrix are adjusted through the sample face image and the corresponding labeling result, the sizes of the convolution kernel in a convolution layer with a weight variance larger than a reference threshold and the corresponding weight matrix are adjusted, then the updated data processing model is called by the terminal, the face image is processed, face features in the face image are extracted, and then comparison is carried out on the face image and a plurality of stored face features according to the extracted face features, so that the face recognition effect is achieved.
As another example, in an image segmentation scenario:
after the terminal acquires the sample image and the corresponding labeling result, the convolution kernel in the data processing model and the corresponding weight matrix are adjusted through the sample image and the corresponding labeling result, the sizes of the convolution kernel in the convolution layer with the weight variance larger than the reference threshold and the corresponding weight matrix are adjusted, then the updated image processing model is called by the terminal to process the target image, the region where the target object is located in the target image is extracted, and object identification is carried out on the target object in the extracted region in the following process.
Fig. 2 is a flowchart of a data processing method provided in an embodiment of the present application, which is applied to a computer device, and as shown in fig. 2, the method includes:
201. and the computer equipment acquires the sample data and the corresponding labeling result.
The method comprises the steps of obtaining sample data, wherein the sample data is data in any service scene, and the labeling result is used for representing the labeling result of the sample data in the service scene to which the sample data belongs. For example, in an image classification scene, the sample data is sample image data, and the labeling result is a type label to which the sample image data belongs; or, in the object recognition scene, the sample data is sample image data, and the labeling result is the category label of the object included in the sample image data and the position of the object in the sample image data.
202. And the computer equipment calls the data processing model to process the sample data to obtain a prediction result.
The data processing model comprises at least one convolutional layer, each convolutional layer comprises at least one convolution kernel, and each convolution kernel corresponds to a weight matrix. After the sample data is input into the data processing model, the sample data is processed through the convolution kernel in at least one convolution layer included in the data processing model and the corresponding weight matrix, and therefore the prediction result of the sample data is obtained.
203. And the computer equipment adjusts the convolution kernel and the corresponding weight matrix in the data processing model according to the labeling result and the prediction result.
Because the labeling result is the real result corresponding to the sample data, the prediction result is the result predicted by the data processing model, and the convolution kernel and the corresponding weight matrix in the data processing model are adjusted through the labeling result and the prediction result, so that the accuracy of the data processing model is improved, and the accurate data processing model can be obtained.
204. And the computer equipment responds to the situation that the weight variance corresponding to any convolutional layer in the data processing model is larger than a reference threshold value, and reduces the convolutional kernels and the corresponding weight matrixes in the convolutional layers after the current adjustment to obtain an updated data processing model.
The updated data processing model comprises the convolution kernel with the reduced size and a corresponding weight matrix, and the weight variance is the variance of the weight matrix in the convolution layer before the current adjustment. When the weight variance corresponding to the convolutional layer is larger than a reference threshold, the data size of the convolutional kernel and the corresponding weight matrix included in the convolutional layer is large, and the convolutional kernel and the corresponding weight matrix in the convolutional layer are reduced to obtain an updated data processing model.
205. And the computer equipment calls the updated data processing model to process the data to obtain a data processing result.
After the updated data processing model is obtained, the data can be processed through the updated data processing model so as to ensure the accuracy of the obtained processing result.
According to the method provided by the embodiment of the application, in the process of training the data processing model, the convolution kernels and the corresponding weight matrixes in the data processing model are adjusted to ensure the accuracy of the data processing model, the data volume of the convolution layer is judged through the weight variance of the convolution layer, and when the data volume of the convolution layer is large, the convolution kernels and the corresponding weight matrixes in the convolution layer are reduced in size through the weight variance to reduce the data volume of the data processing model, so that the processing efficiency of the data processing model is improved.
Fig. 3 is a flowchart of a data processing method provided in an embodiment of the present application, which is applied to a computer device, and as shown in fig. 3, the method includes:
301. and the computer equipment acquires the sample data and the corresponding labeling result.
The method comprises the steps of obtaining sample data, wherein the sample data is data in any service scene, and the labeling result is used for representing the labeling result of the sample data in the service scene to which the sample data belongs. For example, in an image classification scene, the sample data is sample image data, and the labeling result is a type label to which the sample image data belongs; or, in the object recognition scene, the sample data is sample image data, and the labeling result is the category label of the object included in the sample image data and the position of the object in the sample image data.
In one possible implementation, this step 301 includes: the computer equipment acquires a plurality of sample data and a labeling result corresponding to each sample data. And by acquiring a plurality of sample data and the labeling result corresponding to each sample data, the data processing model is updated by the acquired sample data and the corresponding labeling result.
In one possible implementation, this step 301 includes: and the computer equipment receives the sample data and the corresponding labeling result sent by other equipment. For example, a background manager labels the sample data to obtain a labeling result corresponding to the sample data, and sends the sample data and the corresponding labeling result to the computer device through a terminal of the background manager.
302. And the computer equipment calls the data processing model to process the sample data to obtain a prediction result.
The data processing model comprises at least one convolutional layer, each convolutional layer comprises at least one convolution kernel, and each convolution kernel corresponds to a weight matrix. Optionally, each convolution kernel is the same size as the corresponding weight matrix. For example, the size of any convolution kernel is 7 × 7, and the size of the weight matrix is 7 × 7. Optionally, a plurality of parameters included in any convolution kernel correspond to a plurality of weights included in the corresponding weight matrix in a one-to-one correspondence. For example, the size of any convolution kernel and the corresponding weight matrix is 7 × 7, and the parameter at each position in the convolution kernel corresponds to the weight at the corresponding position in the weight matrix.
After the sample data is input into the data processing model, the sample data is processed through the convolution kernel in at least one convolution layer included in the data processing model and the corresponding weight matrix, and therefore the prediction result of the sample data is obtained. For example, when the data processing model processes sample data, any convolutional layer receives the data features output by the previous convolutional layer, multiplies the data features by each convolutional kernel and the weight matrix corresponding to the convolutional kernel to obtain a plurality of updated data features, fuses the updated data features to obtain new data features, outputs the new data features, and processes the data features again by the next convolutional layer, wherein the plurality of convolutional layers process the data features in the above manner until the last convolutional layer outputs the prediction result.
In one possible implementation, the data processing model is a super-network model that includes a plurality of convolutional layers, and in the initialized super-network model, the convolutional kernel in each convolutional layer is a large-sized convolutional kernel. For example, the convolution kernel size in the initialized hyper-network model is 7 × 7, or 9 × 9, etc.
303. And the computer equipment acquires the weight variance corresponding to each convolutional layer according to the weight in the at least one weight matrix corresponding to each convolutional layer.
Wherein the weight variance is a variance of each weight in the weight matrix. In this embodiment, each convolutional layer includes at least one convolutional core, and each convolutional core should have a weight matrix, and the weight matrix includes at least one weight, so that for any convolutional layer, the weight variance corresponding to the convolutional layer can be obtained through the weight in the at least one weight matrix corresponding to the convolutional layer.
In one possible implementation, this step 303 includes: determining an average value of a plurality of weights in at least one weight matrix corresponding to any convolutional layer, determining a square of a difference value between each weight in the convolutional layer and the average value, and determining a ratio between the sum of squares of the difference values corresponding to the plurality of weights and the number of the plurality of weights as a weight variance corresponding to the convolutional layer.
304. And the computer equipment acquires the loss value of the data processing model according to the labeling result and the prediction result.
Wherein the loss value is used to represent an inaccuracy of the data processing model. Because the labeling result is the real result corresponding to the sample data, and the prediction result is the prediction result obtained by the data processing model, the difference between the labeling result and the prediction result can be determined through the labeling result and the prediction result, and thus the loss value of the data processing model is obtained.
In one possible implementation, this step 304 includes: and determining an initial loss value of the data processing model according to the labeling result and the prediction result, determining a first sum of weight variances corresponding to at least one convolution layer, and determining a difference value between the initial loss value and the first sum as a loss value of the data processing model.
Wherein the initial loss value is used for representing the difference between the labeling result and the prediction result. For example, the initial loss value is obtained by cross-entropy loss. The first sum is the sum of the weight variances corresponding to all convolutional layers in the data processing model, for example, the data processing model includes 3 convolutional layers, and the first sum is the sum of the weight variances corresponding to 3 convolutional layers.
When determining the loss value of the data processing model, considering the influence of the weight variance corresponding to the convolutional layer on the data processing model, the difference value between the initial loss value and the first sum value is taken as the loss value of the data processing model to constrain the weights in the weight matrix, so as to ensure that a plurality of weights corresponding to any convolutional layer have large difference, and then the convolutional core and the corresponding weight matrix in the data processing model are adjusted through the loss value so as to ensure the accuracy of the data processing model.
In one possible implementation, this step 304 includes: and determining an initial loss value of the data processing model according to the labeling result and the prediction result, determining a second sum value of the weights in the weight matrix corresponding to at least one convolution layer, and determining the sum value of the initial loss value and the second sum value as the loss value of the data processing model.
Wherein the second sum is a sum of weights in the weight matrix in all convolutional layers in the data processing model. For example, the data processing model includes 3 convolutional layers, each convolutional layer includes 3 convolutional kernels, and each convolutional layer corresponds to 3 weight matrices, then there are 9 weight matrices in the data processing model, and then the second sum value corresponding to the data processing model is the sum value of the weights in the 9 weight matrices.
When determining the loss value of the data processing model, considering the influence of the weight in each weight matrix in the data processing model on the data processing model, the sum value of the initial loss value and the second sum value is used as the loss value of the data processing model, so that the convolution kernel and the corresponding weight matrix in the data processing model can be adjusted by the loss value subsequently, and the accuracy of the data processing model is ensured.
In one possible implementation, this step 304 includes: and determining an initial loss value of the data processing model according to the labeling result and the prediction result, determining a first sum value of the weight variance corresponding to at least one convolution layer and a second sum value of the weights in the weight matrix corresponding to at least one convolution layer, and determining a difference value between the sum value of the initial loss value and the second sum value and the first sum value as the loss value of the data processing model.
Optionally, the loss value L of the data processing model satisfies the following relationship:
wherein L' represents an initial loss value of the data processing model; a represents the weights in the weight matrix,represents a second sum value; var (a)layer) A weighting method for representing the correspondence of a convolutional layer, var (-) is a function for calculating the variance,representing a first sum value.
305. And the computer equipment adjusts the convolution kernel and the corresponding weight matrix in the data processing model according to the loss value.
And adjusting the data processing model according to the loss value so as to improve the accuracy of the data processing model.
In one possible implementation, this step 305 includes: and the computer equipment adjusts parameters in convolution kernels in the data processing model and weights in the corresponding weight matrix according to the loss values.
It should be noted that, in the present embodiment, the convolution kernel and the corresponding weight matrix in the data processing model are adjusted according to the loss value, but in another embodiment, the step 304 and the step 305 need not be executed, and other manners can be adopted to adjust the convolution kernel and the corresponding weight matrix in the data processing model according to the labeling result and the prediction result.
306. And the computer equipment responds to the situation that the weight variance corresponding to any convolutional layer in the data processing model is larger than a reference threshold value, and according to the reference size, the weight matrix corresponding to the convolutional layer after the current adjustment is subjected to average pooling to obtain the weight matrix with the reduced size.
The weight variance is the variance of the weight matrix in the convolutional layer before the current adjustment, that is, the variance before the adjustment of the weight matrix. In the embodiment of the present application, the weight variance is the variance obtained by performing step 303, and the convolutional layer after the current adjustment is the convolutional layer obtained by performing step 304-305. The reference threshold is an arbitrarily set numerical value, for example, the reference threshold is 0.8 or 0.5, or the like. The reference size is an arbitrary size, and for example, the reference size is 3 × 3, or 5 × 5, or the like. Weights are selected from the weight matrix according to the reference size, and the selected weights are averaged and pooled, so that a reduced weight matrix is obtained.
The weight variance corresponding to any convolutional layer is greater than the reference threshold, which indicates that the amount of data contained in the convolutional layer is large, and it is necessary to perform average pooling on each weight matrix corresponding to the convolutional layer after the current adjustment to reduce the amount of data contained in the convolutional layer, so as to obtain a reduced-size weight matrix corresponding to each weight matrix.
In one possible implementation, this step 306 includes: for any weight matrix in the convolutional layer, selecting multiple groups of weights from the weight matrix according to the reference size, determining the average value of each group of weights, respectively using the obtained multiple average values as the weights of the central positions corresponding to each group of weights, and forming a reduced-size weight matrix by using the multiple average values.
For example, if the size of the weight matrix before the average pooling is 5 × 5 and the reference size is 3 × 3, the size of the weight matrix after the size reduction is 3 × 3. As shown in fig. 4, a first set of weights is selected from the weight matrix by referring to the size, the average value of the first set of weights is 0.41, and 0.41 is used as the weight of the center position corresponding to the first set of weights; selecting a second group of weights from the weight matrix through the reference size, obtaining the average value of the second group of weights as 0.38, and taking 0.38 as the weight of the central position corresponding to the second group of weights; and selecting a third group of weights from the weight matrix by referring to the size, wherein the average value of the third group of weights is 0.49, and 0.49 is used as the weight of the central position corresponding to the third group of weights. In the above manner, the weight matrices are averaged and pooled, so that the size of the reduced weight matrix is 3 × 3.
307. The computer device determines a position corresponding to the maximum weight in the reduced-size weight matrix among convolution kernels corresponding to the weight matrix as a center position.
Since the weight matrix before size reduction is the same size as the corresponding convolution kernel, the maximum weight in the weight matrix after size reduction is determined after size reduction of the weight matrix, the corresponding position of the maximum weight in the convolution kernel can be determined based on the maximum weight, and the determined position is taken as the center position. As shown in fig. 5, when the maximum weight in the weight matrix 501 after the size reduction is 0.49, the position corresponding to 0.49 is determined as the center position 502.
308. And the computer equipment cuts the convolution kernel after the adjustment according to the central position and the size of the weight matrix after the size reduction to obtain the convolution kernel after the size reduction.
Wherein the reduced size of the convolution kernel is equal to the reduced size of the weight matrix. In the embodiment of the present application, the convolution kernel after the current adjustment refers to the convolution kernel obtained by performing steps 304-305.
In the convolution kernel, a partial region in the convolution kernel can be determined according to the central position and the size of the reduced weight matrix, and the determined partial region is cut to obtain the reduced convolution kernel. As shown in fig. 5, the size of the reduced weight matrix is 3 × 3, and after the center position 502 is determined, the convolution kernel is clipped to obtain a reduced convolution kernel 503.
When the weight variance corresponding to any convolutional layer is larger than a reference threshold, the convolutional kernels in the convolutional layers and the corresponding weight matrixes are reduced to obtain an updated data processing model, so that the updated data processing model comprises the convolutional kernels with reduced sizes and the corresponding weight matrixes, the number of the convolutional layers is reduced, and the processing efficiency of the data processing model is ensured.
It should be noted that in the embodiment of the present application, the weight matrix is averaged and pooled first by referring to the size, and then the reduced-size weight matrix is used to obtain the reduced-size convolution kernel, while in another embodiment, step 306 and step 308 do not need to be executed, and in response to that the weight variance corresponding to any convolution layer in the data processing model is greater than the reference threshold, the convolution kernel and the corresponding weight matrix in the convolution layer after the current adjustment can be reduced by adopting other manners to obtain the updated data processing model.
In one possible implementation, after step 308, the method further includes: the computer device resets each weight in the reduced-size weight matrix to a reference value. Wherein the reference value is an arbitrary value, for example, the reference value is 1.
It should be noted that, in the embodiment of the present application, the step 301-one 308 is only to describe one update turn of the data processing model, and after the step 308, the updated data processing model can be directly invoked to process the data, or alternatively, the next update turn of the data processing model can be performed according to the step 301-one 308, and after the data processing model is performed for multiple update turns, the updated data processing model is invoked to process the data.
When updating the data processing model in a plurality of update rounds, in one possible implementation, in response to the number of iterative update rounds reaching a reference value, stopping updating the data processing model; alternatively, updating the data processing model is stopped in response to the penalty value for the data processing model being less than the reference penalty value. Wherein, the reference value is an arbitrarily set value, for example, the reference value is 10 or 15, etc.; the reference loss value is an arbitrarily set value, for example, the reference loss value is 0.2 or 0.3, or the like.
In addition, in the above-mentioned multiple update rounds, the sizes of the convolution kernel and the corresponding weight matrix in the data processing model may be reduced, the updated data processing model is obtained after the training of the multiple update rounds, and then the updated data processing model can be trained again through the sample data and the labeled sample.
In a possible implementation manner, sample data and a labeled sample are obtained, an updated data processing model is called, the sample data is processed to obtain a prediction result, a loss value of the data processing model is determined according to the labeled result and the prediction result, and a convolution kernel and a corresponding weight matrix in the data processing model are adjusted according to the loss value.
In the training process, the updated data processing model can be trained for multiple rounds, and when the updated data processing model is trained for multiple rounds, the updated data processing model is stopped being updated in response to the iteration round reaching a reference value; or, in response to the loss value of the updated data processing model being less than the reference loss value, stopping updating the updated data processing model.
309. And the computer equipment calls the updated data processing model to process the data to obtain a data processing result.
After the updated data processing model is obtained, the data can be processed through the updated data processing model so as to ensure the accuracy of the obtained processing result.
In one possible implementation, this step 309 includes: and calling the updated image classification model to classify the image data to obtain the category of the image data.
In the embodiment of the application, the data processing model is an image classification model, the data is image data, the sample data is sample image data, the labeling result is a class label corresponding to the sample image data, and the prediction result is a class label predicted by the data processing model. After the image classification model is updated, the classification to which the image data belongs can be determined through the updated image classification model, and the accuracy of the determined classification is ensured.
In one possible implementation, this step 309 includes: and calling the updated object recognition model, and recognizing the image data to obtain the category of the object contained in the image data and the position of the object in the image data.
In this embodiment of the present application, the data processing model is an image classification model, the data is image data, the sample data is sample image data, the labeling result is a class label corresponding to an object included in the sample image data, and the prediction result is a class label of the object included in the sample image data predicted by the data processing model. After the object recognition model is updated, the class to which the object contained in the image data belongs and the position of the object in the image data can be determined through the updated object recognition model, and the accuracy of the determined class is ensured.
It should be noted that the method provided in the embodiment of the present application is only described with respect to data in any service scenario, and in another embodiment, the data processing model provided in the embodiment of the present application can update and obtain a data processing model providing functions for different service scenarios with respect to data in different service scenarios. Moreover, based on the method provided by the embodiment of the application, a neural architecture searching method is realized, a data model providing functions for a corresponding service scene is searched from the data processing model aiming at data in any service scene, and the model searched by the neural architecture has good feature extraction capability and can be applied to different service scenes.
According to the method provided by the embodiment of the application, in the process of training the data processing model, the convolution kernels and the corresponding weight matrixes in the data processing model are adjusted to ensure the accuracy of the data processing model, the data volume of the convolution layer is judged through the weight variance of the convolution layer, and when the data volume of the convolution layer is large, the convolution kernels and the corresponding weight matrixes in the convolution layer are reduced in size through the weight variance to reduce the data volume of the data processing model, so that the processing efficiency of the data processing model is improved.
And determining a loss value through the weight variance corresponding to each convolutional layer, and updating the data processing model by using the loss value, so that the weight variance corresponding to each convolutional layer is large enough, namely, the difference of the weights in the weight matrix corresponding to each convolutional layer is ensured to be large enough, so that the weights among different convolutional kernels in the convolutional layers are highlighted, and the accuracy of the data processing model is ensured.
In addition, the method provided by the embodiment of the application can automatically search the data processing model matched with the data in the search space of the data processing model, and the data processing model has the advantages of less required parameters and high search efficiency in the search process.
In the embodiment of the present application, the adopted sample data can be data in a public data set, or private data provided by a user, and whatever form of sample data can be trained on the data processing model, and the data is processed through the trained data processing model. Moreover, the method provided by the embodiment of the application can be applied to a cloud server, and the method provided by the embodiment of the application and deployed by the cloud server can provide a required model for a user. For example, by using the method provided by the above embodiment, a data processing model is trained for a user according to training data provided by the user, and the data processing model can be used after the training data is highly accurate and is convenient for the user. As shown in fig. 6, in the related art, the accuracy of a model deployed by a technician through public data is high, but the generalization capability is poor, so that the technician is required to deploy different models for different application scenarios. The data processing method provided by the application can be deployed in a cloud server, and a data processing model matched with private data can be searched from an initialized data processing model through the private data of a user, so that the high accuracy of the searched data processing model is ensured, the data volume in the data processing model is small, and the data processing efficiency is high. In addition, by adopting the method provided by the above embodiment, only one initialized data processing model needs to be deployed, and then the data in any scene is taken as sample data to train the initialized data processing model, so that one data processing model can be trained for the scene, that is, different data processing models can be respectively searched for different scenes aiming at the data of different scenes, and different models do not need to be deployed respectively aiming at different data, so that the method is strong in generalization capability, and can be applied to various scenes, such as an image recognition scene, an image segmentation scene, an object detection scene, an object positioning scene, an object recognition scene, and the like.
The method provided by the embodiment of the application can be applied to the intelligent camera. According to the method provided by the embodiment of the application, the acquired image data is used as sample data, and the data processing model providing multiple functions can be searched from the deployed initialized data processing model, so that multiple functions such as face recognition, age recognition, face changing, automatic make-up making and the like are provided for the intelligent camera, and technicians do not need to develop corresponding models for each function respectively. Thereby saving time and labor consumption. Moreover, based on the method provided by the embodiment of the application, the stress of non-professionals can be relieved in the project. For example, if a plurality of data processing models are needed, a plurality of sample data and corresponding labeling results can be respectively obtained based on the method provided by the embodiment of the present application, so that a plurality of data processing models can be searched from the initialized data processing models, and the searched models can be repeatedly used.
In the embodiment of the present application, a data processing model is an image classification model, sample data is sample image data, data is image data, an annotation result is a sample label to which the sample image data belongs, and a prediction result is a prediction label of the sample image data. The process comprises the following steps:
1. the computer device obtains sample image data and a corresponding sample label.
2. And calling the image classification model by the computer equipment, and processing the sample image data to obtain the prediction label.
3. And the computer equipment acquires the weight variance corresponding to each convolutional layer according to the weight in the at least one weight matrix corresponding to each convolutional layer.
4. And the computer equipment acquires the loss value of the image classification model according to the sample label and the prediction label.
5. And the computer equipment adjusts the convolution kernel and the corresponding weight matrix in the image classification model according to the loss value.
6. And the computer equipment responds to the situation that the weight variance corresponding to any convolutional layer in the image classification model is larger than a reference threshold value, and carries out average pooling on the weight matrix corresponding to the convolutional layer according to the reference size to obtain the weight matrix with the reduced size.
7. The computer device determines a position corresponding to the maximum weight in the reduced-size weight matrix among convolution kernels corresponding to the weight matrix as a center position.
8. And the computer equipment cuts the convolution kernel according to the central position and the size of the weight matrix with the reduced size to obtain the convolution kernel with the reduced size.
9. And calling the updated image classification model by the computer equipment, processing the image data and determining the category of the image data.
It should be noted that steps 1-9 in the present embodiment are similar to step 301-309 in the above embodiment, and are not described herein again.
Fig. 7 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application, and as shown in fig. 7, the apparatus includes:
an obtaining module 701, configured to obtain sample data and a corresponding tagging result;
the processing module 702 is configured to invoke a data processing model, process the sample data, and obtain a prediction result, where the data processing model includes at least one convolution layer, each convolution layer includes at least one convolution kernel, and each convolution kernel corresponds to a weight matrix;
an adjusting module 703, configured to adjust a convolution kernel and a corresponding weight matrix in the data processing model according to the labeling result and the prediction result;
a reducing module 704, configured to reduce the convolution kernel and the corresponding weight matrix in the convolutional layer after the current adjustment in response to that a weight variance corresponding to any convolutional layer in the data processing model is greater than a reference threshold, to obtain an updated data processing model, where the weight variance is a variance of the weight matrix in the convolutional layer before the current adjustment;
the processing module 702 is further configured to invoke the updated data processing model, and process the data to obtain a processing result of the data.
In one possible implementation, the scaling module 704 includes:
a pooling unit 7041, configured to, in response to the weight variance being greater than the reference threshold, perform average pooling on the weight matrix corresponding to the convolutional layer according to the reference size, so as to obtain a reduced-size weight matrix;
a determining unit 7042 configured to determine, as a center position, a position corresponding to a maximum weight in the reduced-size weight matrix in the convolution kernel corresponding to the weight matrix;
a clipping unit 7043, configured to clip the convolution kernel according to the center position and the size of the reduced weight matrix, so as to obtain a reduced convolution kernel.
In another possible implementation manner, the apparatus further includes:
a resetting module 705, configured to reset each weight in the reduced-size weight matrix to a reference value.
In another possible implementation manner, the obtaining module 701 is further configured to obtain a weight variance corresponding to each convolutional layer according to a weight in at least one weight matrix corresponding to each convolutional layer.
In another possible implementation manner, the adjusting module 703 includes:
an obtaining unit 7031, configured to obtain a loss value of the data processing model according to the labeling result and the prediction result;
an adjusting unit 7032 is configured to adjust a convolution kernel and a corresponding weight matrix in the data processing model according to the loss value.
In another possible implementation manner, the obtaining unit 7031 is configured to determine an initial loss value of the data processing model according to the labeling result and the prediction result; determining a first sum of weight variances corresponding to at least one convolutional layer; the difference between the initial loss value and the first sum value is determined as a loss value for the data processing model.
In another possible implementation manner, the obtaining unit 7031 is configured to determine an initial loss value of the data processing model according to the labeling result and the prediction result; determining a second sum of the weights in the weight matrix corresponding to the at least one convolutional layer; and determining the sum of the initial loss value and the second sum as the loss value of the data processing model.
In another possible implementation manner, the data processing model is an image classification model, and the data is image data;
and the processing module 702 is configured to invoke the updated image classification model, and classify the image data to obtain a category to which the image data belongs.
In another possible implementation, the data processing model is an object recognition model, and the data is image data;
the processing module 702 is configured to invoke the updated object identification model, identify the image data, and obtain the category to which the object included in the image data belongs and the position of the object in the image data.
It should be noted that: the data processing apparatus provided in the foregoing embodiment is only illustrated by dividing the functional modules, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the data processing apparatus and the data processing method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
The embodiment of the present application further provides a computer device, where the computer device includes a processor and a memory, and the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the data processing method of the foregoing embodiment.
Optionally, the computer device is provided as a terminal. Fig. 9 shows a block diagram of a terminal 900 according to an exemplary embodiment of the present application. The terminal 900 may be a portable mobile terminal such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. Terminal 900 may also be referred to by other names such as user equipment, portable terminals, laptop terminals, desktop terminals, and the like.
The terminal 900 includes: a processor 901 and a memory 902.
Processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 901 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 901 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 902 is used to store at least one computer program for execution by the processor 901 to implement the data processing methods provided by the method embodiments in the present application.
In some embodiments, terminal 900 can also optionally include: a peripheral interface 903 and at least one peripheral. The processor 901, memory 902, and peripheral interface 903 may be connected by buses or signal lines. Various peripheral devices may be connected to the peripheral interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908, and a power supply 909.
The peripheral interface 903 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, memory 902, and peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902 and the peripheral interface 903 may be implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 904 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 904 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 904 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 904 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 904 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 904 may also include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 905 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to capture touch signals on or over the surface of the display screen 905. The touch signal may be input to the processor 901 as a control signal for processing. At this point, the display 905 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 905 may be one, disposed on the front panel of the terminal 900; in other embodiments, the number of the display panels 905 may be at least two, and each of the display panels is disposed on a different surface of the terminal 900 or is in a foldable design; in other embodiments, the display 905 may be a flexible display disposed on a curved surface or a folded surface of the terminal 900. Even more, the display screen 905 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display panel 905 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 906 is used to capture images or video. Optionally, camera assembly 906 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 906 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuit 907 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 901 for processing, or inputting the electric signals to the radio frequency circuit 904 for realizing voice communication. For stereo sound acquisition or noise reduction purposes, the microphones may be multiple and disposed at different locations of the terminal 900. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuit 907 may also include a headphone jack.
The positioning component 908 is used to locate the current geographic Location of the terminal 900 for navigation or LBS (Location Based Service). The Positioning component 908 may be a Positioning component based on the Global Positioning System (GPS) in the united states, the beidou System in china, or the galileo System in russia.
Power supply 909 is used to provide power to the various components in terminal 900. The power source 909 may be alternating current, direct current, disposable or rechargeable. When the power source 909 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 900 can also include one or more sensors 910. The one or more sensors 910 include, but are not limited to: acceleration sensor 911, gyro sensor 912, pressure sensor 913, fingerprint sensor 914, optical sensor 915, and proximity sensor 916.
The acceleration sensor 911 can detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 900. For example, the acceleration sensor 911 may be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 911. The acceleration sensor 911 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 912 may detect a body direction and a rotation angle of the terminal 900, and the gyro sensor 912 may cooperate with the acceleration sensor 911 to acquire a 3D motion of the user on the terminal 900. The processor 901 can implement the following functions according to the data collected by the gyro sensor 912: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 913 may be disposed on a side bezel of the terminal 900 and/or underneath the display 905. When the pressure sensor 913 is disposed on the side frame of the terminal 900, the user's holding signal of the terminal 900 may be detected, and the processor 901 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 913. When the pressure sensor 913 is disposed at a lower layer of the display screen 905, the processor 901 controls the operability control on the UI interface according to the pressure operation of the user on the display screen 905. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 914 is used for collecting a fingerprint of the user, and the processor 901 identifies the user according to the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 identifies the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, processor 901 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 914 may be disposed on the front, back, or side of the terminal 900. When a physical key or vendor Logo is provided on the terminal 900, the fingerprint sensor 914 may be integrated with the physical key or vendor Logo.
The optical sensor 915 is used to collect ambient light intensity. In one embodiment, the processor 901 may control the display brightness of the display screen 905 based on the ambient light intensity collected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is reduced. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 915.
A proximity sensor 916, also referred to as a distance sensor, is provided on the front panel of the terminal 900. The proximity sensor 916 is used to collect the distance between the user and the front face of the terminal 900. In one embodiment, when the proximity sensor 916 detects that the distance between the user and the front face of the terminal 900 gradually decreases, the processor 901 controls the display 905 to switch from the bright screen state to the dark screen state; when the proximity sensor 916 detects that the distance between the user and the front surface of the terminal 900 gradually becomes larger, the display 905 is controlled by the processor 901 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 9 does not constitute a limitation of terminal 900, and may include more or fewer components than those shown, or may combine certain components, or may employ a different arrangement of components.
Optionally, the computer device is provided as a server. Fig. 10 is a schematic structural diagram of a server according to an embodiment of the present application, where the server 1000 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1001 and one or more memories 1002, where the memory 1002 stores at least one computer program, and the at least one computer program is loaded and executed by the processors 1001 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
The embodiment of the present application further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor to implement the operations performed in the data processing method of the foregoing embodiment.
Embodiments of the present application also provide a computer program product or a computer program comprising computer program code stored in a computer readable storage medium. The processor of the computer apparatus reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer apparatus realizes the operations performed in the data processing method as the above-described embodiment.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only an alternative embodiment of the present application and should not be construed as limiting the present application, and any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (15)

1. A method of data processing, the method comprising:
acquiring sample data and a corresponding labeling result;
calling a data processing model, processing the sample data to obtain a prediction result, wherein the data processing model comprises at least one convolution layer, each convolution layer comprises at least one convolution kernel, and each convolution kernel corresponds to a weight matrix;
adjusting a convolution kernel and a corresponding weight matrix in the data processing model according to the labeling result and the prediction result;
in response to that the weight variance corresponding to any convolutional layer in the data processing model is larger than a reference threshold, reducing the convolutional cores and the corresponding weight matrixes in the convolutional layers after the current adjustment to obtain an updated data processing model, wherein the weight variance is the variance of the weight matrixes in the convolutional layers before the current adjustment;
and calling the updated data processing model, and processing the data to obtain a processing result of the data.
2. The method of claim 1, wherein the reducing convolution kernels and corresponding weight matrices in convolutional layers after the current adjustment in response to a weight variance corresponding to any convolutional layer in the data processing model being greater than a reference threshold to obtain an updated data processing model comprises:
in response to the weight variance being larger than the reference threshold, performing average pooling on the weight matrix corresponding to the convolutional layer according to the reference size to obtain a reduced-size weight matrix;
determining a position corresponding to the maximum weight in the reduced-size weight matrix in the convolution kernel corresponding to the weight matrix as a central position;
and cutting the convolution kernel according to the central position and the size of the weight matrix with the reduced size to obtain the convolution kernel with the reduced size.
3. The method of claim 2, wherein after the clipping the convolution kernel according to the center position and the size of the reduced-size weight matrix to obtain a reduced-size convolution kernel, the method further comprises:
resetting each weight in the reduced-size weight matrix to a reference value.
4. The method of claim 1, wherein before adjusting the convolution kernel and the corresponding weight matrix in the data processing model according to the labeling result and the prediction result, the method further comprises:
and acquiring the weight variance corresponding to each convolutional layer according to the weight in at least one weight matrix corresponding to each convolutional layer.
5. The method of claim 1, wherein adjusting the convolution kernel and the corresponding weight matrix in the data processing model according to the labeling result and the prediction result comprises:
obtaining a loss value of the data processing model according to the labeling result and the prediction result;
and adjusting a convolution kernel in the data processing model and a corresponding weight matrix according to the loss value.
6. The method of claim 5, wherein obtaining the loss value of the data processing model according to the labeling result and the prediction result comprises:
determining an initial loss value of the data processing model according to the labeling result and the prediction result;
determining a first sum of weight variances corresponding to the at least one convolutional layer;
determining a difference between the initial loss value and the first sum value as a loss value for the data processing model.
7. The method of claim 5, wherein obtaining the loss value of the data processing model according to the labeling result and the prediction result comprises:
determining an initial loss value of the data processing model according to the labeling result and the prediction result;
determining a second sum of the weights in the weight matrix corresponding to the at least one convolutional layer;
and determining the sum of the initial loss value and the second sum as the loss value of the data processing model.
8. The method according to any one of claims 1-7, wherein the data processing model is an image classification model and the data is image data;
the calling the updated data processing model to process the data to obtain the processing result of the data, and the method comprises the following steps:
and calling the updated image classification model to classify the image data to obtain the category of the image data.
9. The method according to any one of claims 1 to 7, wherein the data processing model is an object recognition model and the data is image data;
the calling the updated data processing model to process the data to obtain the processing result of the data, and the method comprises the following steps:
and calling the updated object identification model, and identifying the image data to obtain the category of the object contained in the image data and the position of the object in the image data.
10. A data processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring sample data and a corresponding labeling result;
the processing module is used for calling a data processing model and processing the sample data to obtain a prediction result, wherein the data processing model comprises at least one convolution layer, each convolution layer comprises at least one convolution kernel, and each convolution kernel corresponds to a weight matrix;
the adjusting module is used for adjusting a convolution kernel and a corresponding weight matrix in the data processing model according to the labeling result and the prediction result;
a reduction module, configured to reduce a convolution kernel and a corresponding weight matrix in a convolutional layer after the current adjustment in response to that a weight variance corresponding to any convolutional layer in the data processing model is greater than a reference threshold, so as to obtain an updated data processing model, where the weight variance is a variance of the weight matrix in the convolutional layer before the current adjustment;
the processing module is further configured to invoke the updated data processing model, and process the data to obtain a processing result of the data.
11. The apparatus of claim 10, wherein the scaling module comprises:
the pooling unit is used for responding to the fact that the weight variance is larger than the reference threshold value, carrying out average pooling on the weight matrix corresponding to the convolutional layer according to the reference size, and obtaining the weight matrix with the reduced size;
a determining unit, configured to determine, as a center position, a position corresponding to a maximum weight in the reduced-size weight matrix in a convolution kernel corresponding to the weight matrix;
and the cutting unit is used for cutting the convolution kernel according to the central position and the size of the weight matrix with the reduced size to obtain the convolution kernel with the reduced size.
12. The apparatus of claim 11, further comprising:
a resetting module, configured to reset each weight in the reduced-size weight matrix to a reference value.
13. The apparatus of claim 10, wherein the adjustment module comprises:
the obtaining unit is used for obtaining a loss value of the data processing model according to the labeling result and the prediction result;
and the adjusting unit is used for adjusting the convolution kernel in the data processing model and the corresponding weight matrix according to the loss value.
14. A computer device, characterized in that the computer device comprises a processor and a memory, in which at least one computer program is stored, which is loaded and executed by the processor to implement the operations performed in the data processing method according to any of claims 1 to 9.
15. A computer-readable storage medium, in which at least one computer program is stored, which is loaded and executed by a processor to perform the operations performed in the data processing method according to any one of claims 1 to 9.
CN202011551623.XA 2020-12-24 2020-12-24 Data processing method and device, computer equipment and storage medium Pending CN113392688A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011551623.XA CN113392688A (en) 2020-12-24 2020-12-24 Data processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011551623.XA CN113392688A (en) 2020-12-24 2020-12-24 Data processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113392688A true CN113392688A (en) 2021-09-14

Family

ID=77616563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011551623.XA Pending CN113392688A (en) 2020-12-24 2020-12-24 Data processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113392688A (en)

Similar Documents

Publication Publication Date Title
CN110083791B (en) Target group detection method and device, computer equipment and storage medium
CN111091132B (en) Image recognition method and device based on artificial intelligence, computer equipment and medium
CN110942046A (en) Image retrieval method, device, equipment and storage medium
CN108320756B (en) Method and device for detecting whether audio is pure music audio
CN110839128A (en) Photographing behavior detection method and device and storage medium
CN111489378B (en) Video frame feature extraction method and device, computer equipment and storage medium
CN111325220A (en) Image generation method, device, equipment and storage medium
CN110807361A (en) Human body recognition method and device, computer equipment and storage medium
CN112084811A (en) Identity information determining method and device and storage medium
CN113392688A (en) Data processing method and device, computer equipment and storage medium
CN111738365B (en) Image classification model training method and device, computer equipment and storage medium
CN111104980B (en) Method, device, equipment and storage medium for determining classification result
CN113569822B (en) Image segmentation method and device, computer equipment and storage medium
CN108288032B (en) Action characteristic acquisition method, device and storage medium
CN113343709A (en) Method for training intention recognition model, method, device and equipment for intention recognition
CN112053360A (en) Image segmentation method and device, computer equipment and storage medium
CN111611414A (en) Vehicle retrieval method, device and storage medium
CN111581481A (en) Search term recommendation method and device, electronic equipment and storage medium
CN111753154A (en) User data processing method, device, server and computer readable storage medium
CN112990424A (en) Method and device for training neural network model
CN111782767A (en) Question answering method, device, equipment and storage medium
CN113705677A (en) Image recognition method and device, electronic equipment and storage medium
CN113570510A (en) Image processing method, device, equipment and storage medium
CN111192072A (en) User grouping method and device and storage medium
CN112836714A (en) Intelligent model training method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication