Neural network model compression method and apparatus, storage medium, and chip
Abstract
A neural network model compression method in the field of artificial intelligence. The method includes: obtaining, by a server, a first neural network model and training data of the first neural network that are uploaded by user equipment; obtaining a positive-unlabeled (PU) classifier based on the training data of the first neural network and unlabeled data stored in the server; selecting, by using the PU classifier, extended data from the unlabeled data stored in the server, where the extended data has a property and distribution similar to a property and distribution of the training data of the first neural network model; and training a second neural network model by using a knowledge distillation (KD) method based on the extended data, where the first neural network model is used as a teacher network model and the second neural network model is used as a student network model.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 37 · Forward citations: 0.
Claims (15 — 3 Independent, 12 Dependent)
- Claim 1Independent Claim
A neural network model compression method, comprising: obtaining, by a server, a first neural network model and training data of the first neural network model that are uploaded by user equipment; obtaining, by the server, a positive-unlabeled (PU) classifier by using a PU learning algorithm based on the training data of the first neural network model and unlabeled data stored in the server; selecting, by the server by using the PU classifier, extended data from the unlabeled data stored in the server, wherein the extended data is positive sample data determined by the PU classifier and has a property and distribution similar to a property and distribution of the training data of the first neural network model; and training, by the server, a second neural network model by using a knowledge distillation (KD) method based on the extended data, wherein the first neural network model is used as a teacher network model of the KD method and the second neural network model is used as a student network model of the KD method; wherein the PU classifier is obtained based on a first feature and a proportion information, the first feature is obtained based on fusion of a plurality of third features and the plurality of third features are in a one-to-one correspondence with a plurality of layers of the first neural network; and the method further comprising: inputting, by the server, the extended data into the first neural network model, to classify the extended data and obtain extended data of the plurality of classes and a second weight of extended data of each of the plurality of classes; and minimizing, by the server, a loss function of the KD method, to obtain a trained second neural network model, wherein the loss function of the KD method is a sum of products of training errors of extended data of all of the plurality of classes and second weights of the extended data of all the classes; and wherein the second weights of the extended data of all the classes comprise a plurality of perturbed weights obtained after random perturbation is performed on initial weights of the extended data of all the classes, and the loss function of the KD method comprises a plurality of loss functions in a one-to-one correspondence with the plurality of perturbed weights, wherein an initial weight of the extended data of each class is in negative correlation with an amount of the extended data of each class; and minimizing, by the server, maximum values of the plurality of loss functions, to obtain the trained second neural network model.
- Claim 2Depends on #1
The neural network model compression method according to claim 1, further comprising: obtaining, by the server, the PU classifier by using the PU learning algorithm based on the training data of the first neural network, the unlabeled data stored in the server, and the proportion information, wherein a loss function of the PU learning algorithm is an expectation of a training loss of the training data of the first neural network and the unlabeled data stored in the server, the proportion information is used to indicate a proportion of the extended data to the unlabeled data stored in the server, and the proportion information is used to calculate the expectation.
- Claim 3Depends on #1
The neural network model compression method according to claim 1, wherein the plurality of third features are obtained by performing feature extraction by using the first neural network model on the training data of the first neural network and the unlabeled data stored in the server; and further comprising: performing, by the server by using the first neural network model, feature extraction on the unlabeled data stored in the server, to obtain a second feature; and inputting, by the server, the second feature into the PU classifier, to determine the extended data.
- Claim 4Depends on #1
The neural network model compression method according to claim 1, wherein the first feature is obtained by fusing the plurality of third features that undergo a first weight adjustment, the first weight adjustment is performed based on the proportion information, the second feature is obtained by fusing a plurality of fourth features by using a first weight, and the plurality of fourth features are in a one-to-one correspondence with the plurality of layers of the first neural network.
- Claim 5Depends on #1
The neural network model compression method according to claim 1, wherein the training data of the first neural network model is a part of training data used to train the first neural network model.
- Claim 6Depends on #5
The neural network model compression method according to claim 5, wherein the part of training data comprises data of each of a plurality of classes output by the first neural network.
- Claim 7Independent Claim
A neural network model compression apparatus, comprising a memory and a processor, wherein the memory is configured to store a computer program, and the processor is configured to invoke the computer program from the memory and run the computer program to perform a neural network compression method comprising: obtaining, by a server, a first neural network model and training data of the first neural network model that are uploaded by user equipment; obtaining, by the server, a positive-unlabeled (PU) classifier by using a PU learning algorithm based on the training data of the first neural network model and unlabeled data stored in the server; selecting, by the server by using the PU classifier, extended data from the unlabeled data stored in the server, wherein the extended data is positive sample data determined by the PU classifier and has a property and distribution similar to a property and distribution of the training data of the first neural network model; training, by the server, a second neural network model by using a knowledge distillation (KD) method based on the extended data, wherein the first neural network model is used as a teacher network model of the KD method and the second neural network model is used as a student network model of the KD method; and wherein the PU classifier is obtained based on a first feature and a proportion information, the first feature is obtained based on fusion of a plurality of third features and the plurality of third features are in a one-to-one correspondence with a plurality of layers of the first neural network; and wherein the processor is further configured to: input, by the server, the extended data into the first neural network model, to classify the extended data and obtain extended data of the plurality of classes and a second weight of extended data of each of the plurality of classes; and minimize, by the server, a loss function of the KD method, to obtain a trained second neural network model, wherein the loss function of the KD method is a sum of products of training errors of extended data of all of the plurality of classes and second weights of the extended data of all the classes; wherein the second weights of the extended data of all the classes comprise a plurality of perturbed weights obtained after random perturbation is performed on initial weights of the extended data of all the classes, and the loss function of the KD method comprises a plurality of loss functions in a one-to-one correspondence with the plurality of perturbed weights, wherein an initial weight of the extended data of each class is in negative correlation with an amount of the extended data of each class; and the processor is further configured to: minimize, by the server, maximum values of the plurality of loss functions, to obtain the trained second neural network model.
- Claim 8Depends on #7
The neural network model compression apparatus according to claim 7, wherein the processor is further configured to: obtain, by the server, the PU classifier by using the PU learning algorithm based on the training data of the first neural network, the unlabeled data stored in the server, and the proportion information, wherein a loss function of the PU learning algorithm is an expectation of a training loss of the training data of the first neural network and the unlabeled data stored in the server, the proportion information is used to indicate a proportion of the extended data to the unlabeled data stored in the server, and the proportion information is used to calculate the expectation.
- Claim 9Depends on #7
The neural network model compression apparatus according to claim 7, wherein the plurality of third features are obtained by performing feature extraction by using the first neural network model on the training data of the first neural network and the unlabeled data stored in the server, and the processor is further configured to: perform, by the server by using the first neural network model, feature extraction on the unlabeled data stored in the server, to obtain a second feature; and input, by the server, the second feature into the PU classifier, to determine the extended data.
- Claim 10Depends on #7
The neural network model compression apparatus according to claim 7, wherein the first feature is obtained by fusing the plurality of third features that undergo a first weight adjustment, the first weight adjustment is performed based on the proportion information, a second feature is obtained by fusing a plurality of fourth features by using a first weight, and the plurality of fourth features are in a one-to-one correspondence with the plurality of layers of the first neural network.
- Claim 11Depends on #7
The neural network model compression apparatus according to claim 7, wherein the training data of the first neural network model is a part of training data used to train the first neural network model.
- Claim 12Depends on #11
The neural network model compression apparatus according to claim 11, wherein the part of training data comprises data of each of a plurality of classes output by the first neural network.
- Claim 13Independent Claim
A non-transitory computer-readable storage medium, wherein the non-transitory computer-readable medium stores program code executed by a device, and the program code is used to perform the method, comprising: obtaining, by a server, a first neural network model and training data of the first neural network model that are uploaded by user equipment; obtaining, by the server, a positive-unlabeled (PU) classifier by using a PU learning algorithm based on the training data of the first neural network model and unlabeled data stored in the server; selecting, by the server by using the PU classifier, extended data from the unlabeled data stored in the server, wherein the extended data is positive sample data determined by the PU classifier and has a property and distribution similar to a property and distribution of the training data of the first neural network model; training, by the server, a second neural network model by using a knowledge distillation (KD) method based on the extended data, wherein the first neural network model is used as a teacher network model of the KD method and the second neural network model is used as a student network model of the KD method; and wherein the PU classifier is obtained based on a first feature and a proportion information, the first feature is obtained based on fusion of a plurality of third features and the plurality of third features are in a one-to-one correspondence with a plurality of layers of the first neural network; and the method further comprising: inputting, by the server, the extended data into the first neural network model, to classify the extended data and obtain extended data of the plurality of classes and a second weight of extended data of each of the plurality of classes; and minimizing, by the server, a loss function of the KD method, to obtain a trained second neural network model, wherein the loss function of the KD method is a sum of products of training errors of extended data of all of the plurality of classes and second weights of the extended data of all the classes; and wherein the second weights of the extended data of all the classes comprise a plurality of perturbed weights obtained after random perturbation is performed on initial weights of the extended data of all the classes, and the loss function of the KD method comprises a plurality of loss functions in a one-to-one correspondence with the plurality of perturbed weights, wherein an initial weight of the extended data of each class is in negative correlation with an amount of the extended data of each class; and minimizing, by the server, maximum values of the plurality of loss functions, to obtain the trained second neural network model.
- Claim 14Depends on #13
The medium according to claim 13, further comprising: obtaining, by the server, the PU classifier by using the PU learning algorithm based on the training data of the first neural network, the unlabeled data stored in the server, and the proportion information, wherein a loss function of the PU learning algorithm is an expectation of a training loss of the training data of the first neural network and the unlabeled data stored in the server, the proportion information is used to indicate a proportion of the extended data to the unlabeled data stored in the server, and the proportion information is used to calculate the expectation.
- Claim 15Depends on #13
The non-transitory computer-readable storage medium according to claim 13, wherein the plurality of third features are obtained by performing feature extraction by using the first neural network model on the training data of the first neural network and the unlabeled data stored in the server; and further comprising: performing, by the server by using the first neural network model, feature extraction on the unlabeled data stored in the server, to obtain a second feature; and inputting, by the server, the second feature into the PU classifier, to determine the extended data.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation of International Application No. PCT/CN2020/097957, filed on Jun. 24, 2020, which claims priority to Chinese Patent Application No. 201910833833.9, filed on Sep. 4, 2019. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD The embodiments relate to the field of artificial intelligence, and a neural network model compression method and apparatus. BACKGROUND Artificial intelligence (AI) is a theory, a method, a technology, or an application system that simulates, extends, and expands human intelligence by using a digital computer or a machine controlled by a digital computer, to perceive an environment, obtain knowledge, and achieve an optimal result by using the knowledge. In other words, artificial intelligence is a branch of computer science, and is intended to understand essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is to study design principles and implementation methods of various intelligent machines, so that the machines have perceiving, inference, and decision-making functions. Computer vision is an integral part of various intelligent/autonomic systems in various application fields, such as manufacturing industry, inspection, document analysis, medical diagnosis, and military affairs. The computer vision is knowledge about how to use a camera/video camera and a computer to obtain required data and information of a photographed subject. To be vivid, eyes (the camera/video camera) and a brain (an algorithm) are mounted on the computer to replace human eyes to recognize, track, and measure a target, so that the computer can perceive an environment. The “ perceiving ” may be considered as extracting information from a perceptual signal. Therefore, the computer vision may also be considered as a science of studying how to
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (37)
Non-Patent Literature (10)
- Xu et al.,
- “
- Positive-Unlabeled Compression on the Cloud
- ”
- , 33rd Conference on Neural Information Processing Systems (NeurIPS 2019), Vancouver, Canada, total:10 pages.
- Hinton et al.,
- “
- Distilling the Knowledge in a Neural Network
- ”
- , arXiv preprint arXiv:1503.02531; Submitted on Mar. 9, 2015, total: 9 pages.