IP Library Granted Patent US 12694478
Granted Patent B2
US 12694478 · App. 18/571,116 · Granted Jul 28, 2026

Network model compression method, apparatus and device, image generation method, and medium

Inventors: Jie Wu (Beijing, CN); Shaojie Li (Beijing, CN); Xuefeng Xiao (Beijing, CN)
Assignee: BEIJING ZITIAO NETWORK TECHNOLOGY CO., LTD.
G06T5/20G06V10/761G06V10/771
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12694478
App. No.
18/571,116
Granted
Jul 28, 2026
Kind
B2
Abstract

Embodiments of the present disclosure provide a network model compression method, apparatus and device, an image generation method, and a medium. The network model compression method includes: performing pruning processing on the first generator to obtain a second generator; and configuring states of convolution kernels in the first discriminator to enable a part of the convolution kernels to be in an activated state and the other part of the convolution kernels to be in a suppressed state, so as to obtain a second discriminator. A loss difference between the first generator and the first discriminator is a first loss difference, a loss difference between the second generator and the second discriminator is a second loss difference, and an absolute value of a difference value between the first loss difference and the second loss difference is less than a first preset threshold.

Claims (58)

1 . A network model compression method, a network model to be compressed comprising a first generator and a first discriminator, and the network model compression method comprising:

performing pruning processing on the first generator to obtain a second generator; and

configuring states of convolution kernels in the first discriminator to enable a part of the convolution kernels to be in an activated state and the other part of the convolution kernels to be in a suppressed state, so as to obtain a second discriminator,

wherein generating a first loss difference between a performance of the first generator and a performance of the first discriminator, and generating a second loss difference between a performance of the second generator and a performance of the second discriminator such that an absolute value of a difference value between the first loss difference and the second loss difference is less than a first preset threshold,

wherein configuring states of convolution kernels in the first discriminator to enable a part of the convolution kernels to be in an activated state and the other part of the convolution kernels to be in a suppressed state, so as to obtain a second discriminator, comprises:

freezing a retention factor corresponding to each convolution kernel in the second discriminator, and determining a first weight parameter of the second discriminator, wherein the retention factor is used for characterizing importance of a convolution kernel corresponding the retention factor;

freezing the first weight parameter of the second discriminator and a second weight parameter of the second generator, and determining respective retention factors; and

repeatedly performing operations of determining the first weight parameter of the second discriminator and determining the respective retention factors until the absolute value of the difference value between the first loss difference and the second loss difference is less than the first preset threshold.

2 . The network model compression method according to claim 1 , wherein the first weight parameter comprises weight parameters corresponding to other elements in the second discriminator other than the respective retention factors.

3 . The network model compression method according to claim 1 , wherein the second weight parameter comprises weight parameters corresponding to elements in the second generator.

4 . The network model compression method according to claim 1 , wherein determining a first weight parameter of the second discriminator comprises:

determining the first weight parameter of the second discriminator according to an objective function of the second discriminator; and

the network model compression method further comprises:

determining the second weight parameter of the second generator according to an objective function of the second generator.

5 . The network model compression method according to claim 4 , wherein before determining the second weight parameter of the second generator according to an objective function of the second generator, the network model compression method further comprises:

determining the objective function of the second generator according to a loss function of the second generator; and

determining the objective function of the second discriminator according to a loss function of the second discriminator with respect to real pictures and a loss function of the second discriminator with respect to false pictures.

6 . The network model compression method according to claim 5 , wherein before determining the objective function of the second generator according to a loss function of the second generator, the network model compression method further comprises:

taking the first generator and the first discriminator as a teacher generative adversarial network, and taking the second generator and the second discriminator as a student generative adversarial network; and

determining the objective function of the second generator according to a loss function of the second generator comprises:

determining the objective function of the second generator according to a distillation objective function between the teacher generative adversarial network and the student generative adversarial network, and the loss function of the second generator.

7 . The network model compression method according to claim 6 , wherein determining the objective function of the second generator according to a distillation objective function between the teacher generative adversarial network and the student generative adversarial network, and the loss function of the second generator, comprises:

summing, according to weights, the distillation objective function and an objective function component determined according to the loss function of the second generator, to determine the objective function of the second generator.

8 . The network model compression method according to claim 6 , wherein before determining the objective function of the second generator according to a distillation objective function between the teacher generative adversarial network and the student generative adversarial network, and the loss function of the second generator, the network model compression method further comprises:

determining a first similarity metric function according to a similarity between intermediate feature maps of at least one layer in the first generator and the second generator;

inputting false pictures generated by the first generator into the first discriminator to obtain a first intermediate feature map of at least one layer in the first discriminator;

inputting false pictures generated by the second generator into the first discriminator to obtain a second intermediate feature map of at least one layer in the first discriminator;

determining a second similarity metric function according to a similarity between the first intermediate feature map of the at least one layer and the second intermediate feature map of the at least one layer; and

determining the distillation objective function according to the first similarity metric function and the second similarity metric function.

9 . The network model compression method according to claim 8 , wherein determining a first similarity metric function according to a similarity between intermediate feature maps of at least one layer in the first generator and the second generator, comprises:

inputting an intermediate feature map of an i-th layer in the first generator and an intermediate feature map of an i-th layer in the second generator into a similarity metric function to obtain a first sub-similarity metric function corresponding to the i-th layer, wherein i is a positive integer, i takes a value from 1 to M, and M is a total number of layers of the first generator and the second generator; and

determining the first similarity metric function according to first sub-similarity metric functions corresponding to respective layers.

10 . The network model compression method according to claim 8 , wherein determining a second similarity metric function according to a similarity between the first intermediate feature map of the at least one layer and the second intermediate feature map of the at least one layer, comprises:

inputting a first intermediate feature map and a second intermediate feature map corresponding to a j-th layer into a similarity metric function to obtain a second sub-similarity metric function corresponding to the j-th layer, wherein j is a positive integer, 1≤j≤N, j takes a value from 1 to N, and N is a total number of layers of the first discriminator; and

determining the second similarity metric function according to second sub-similarity metric functions corresponding to respective layers.

11 . The network model compression method according to claim 1 , wherein determining the respective retention factors comprises:

determining the respective retention factors according to an objective function of the respective retention factors;

when a retention factor is less than a second preset threshold, determining the retention factor to be 0; and

when a retention factor is greater than or equal to the second preset threshold, determining the retention factor to be 1.

12 . The network model compression method according to claim 11 , wherein before determining the respective retention factors according to an objective function of the respective retention factors, the network model compression method further comprises:

determining the objective function of the respective retention factors according to an objective function of the second generator, an objective function of the second discriminator, a loss function of the second discriminator with respect to false pictures, an objective function of the first generator, and a loss function of the first discriminator with respect to false pictures.

13 . An image generation method, comprising:

inputting a random noise signal into a second generator to enable the second generator to generate a false image according to the random noise signal; and

inputting the false image into a second discriminator to enable that the second discriminator discriminates that the false image is true and then outputs the false image,

wherein the second generator and the second discriminator are obtained by using the network model compression method according to claim 1 .

14 . A network model compression device, comprising:

a memory, storing a computer program; and

a processor, configured to execute the computer program, wherein the computer program, when executed by the processor, causes the processor to perform a network model compression method, a network model to be compressed comprises a first generator and a first discriminator, and the network model compression method comprises:

performing pruning processing on the first generator to obtain a second generator; and

configuring states of convolution kernels in the first discriminator to enable a part of the convolution kernels to be in an activated state and the other part of the convolution kernels to be in a suppressed state, so as to obtain a second discriminator,

wherein generating a first loss difference between a performance of the first generator and a performance of the first discriminator, and generating a second loss difference between a performance of the second generator and a performance of the second discriminator such that an absolute value of a difference value between the first loss difference and the second loss difference is less than a first preset threshold,

wherein configuring states of convolution kernels in the first discriminator to enable a part of the convolution kernels to be in an activated state and the other part of the convolution kernels to be in a suppressed state, so as to obtain a second discriminator, comprises:

freezing a retention factor corresponding to each convolution kernel in the second discriminator, and determining a first weight parameter of the second discriminator, wherein the retention factor is used for characterizing importance of a convolution kernel corresponding the retention factor;

freezing the first weight parameter of the second discriminator and a second weight parameter of the second generator, and determining respective retention factors; and

repeatedly performing operations of determining the first weight parameter of the second discriminator and determining the respective retention factors until the absolute value of the difference value between the first loss difference and the second loss difference is less than the first preset threshold.

15 . A non-transitory computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements the network model compression method according to claim 1 .

16 . The network model compression device according to claim 14 , wherein the first weight parameter comprises weight parameters corresponding to other elements in the second discriminator other than the respective retention factors.

17 . The network model compression device according to claim 14 , wherein the second weight parameter comprises weight parameters corresponding to elements in the second generator.