CN113657590A - Model compression method, face recognition method, electronic device, and storage medium - Google Patents

Model compression method, face recognition method, electronic device, and storage medium Download PDF

Info

Publication number
CN113657590A
CN113657590A CN202110846659.9A CN202110846659A CN113657590A CN 113657590 A CN113657590 A CN 113657590A CN 202110846659 A CN202110846659 A CN 202110846659A CN 113657590 A CN113657590 A CN 113657590A
Authority
CN
China
Prior art keywords
model
layer
face image
face
image set
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
CN202110846659.9A
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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202110846659.9A priority Critical patent/CN113657590A/en
Publication of CN113657590A publication Critical patent/CN113657590A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computational Linguistics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a model compression method, a face recognition method, an electronic device and a storage medium, wherein the model compression method comprises the following steps: acquiring a first face image set of a first model in a target application scene, and merging image sequences of the same face in the first face image set to acquire a second face image set; quantizing the first model layer by layer, and adopting respective quantization strategies for each layer, so that the precision loss of the second face image set after passing through each layer of the first model is smaller than a first threshold value, and a second model is obtained; and cutting channels in each layer of the second model layer by layer, and enabling the precision loss of the second face image set after passing through each layer of the second model to be smaller than a second threshold value, so that the compressed target model under the target application scene is obtained. By means of the method, model compression can be performed in a specific application scene, and adaptability of the compressed target model and the application scene is improved.

Description

Model compression method, face recognition method, electronic device, and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a model compression method, a face recognition method, an electronic device, and a storage medium.
Background
With the continuous development of image processing technology, the recognition of face images by models is becoming the mainstream mode, and when the models are applied, the trained models are usually required to be compressed to improve the speed of face recognition. However, in the prior art, model compression is usually completed before deployment to a specific application scenario, and the model is not compressed after deployment to the application scenario, which results in a single model compression manner and poor adaptability of the compressed model to the specific application scenario. In view of this, how to perform model compression in a specific application scenario, and improving the adaptability of a compressed target model and the application scenario become problems to be solved urgently.
Disclosure of Invention
The technical problem mainly solved by the application is to provide a model compression method, a face recognition method, an electronic device and a storage medium, which can perform model compression in a specific application scene and improve the adaptability of a compressed target model and the application scene.
In order to solve the above technical problem, a first aspect of the present application provides a model compression method, including: obtaining a first face image set of a first model in a target application scene, and merging image sequences of the same face in the first face image set to obtain a second face image set; quantizing the first model layer by layer, and adopting respective quantization strategies for each layer, so that the precision loss of the second face image set after passing through each layer of the first model is smaller than a first threshold value, and a second model is obtained; and cutting channels in each layer of the second model layer by layer, and enabling the precision loss of the second face image set after passing through each layer of the second model to be smaller than a second threshold value, so as to obtain a compressed target model under the target application scene.
In order to solve the above technical problem, a second aspect of the present application provides a face recognition method, including: obtaining a face image to be recognized in a target application scene; acquiring a target model corresponding to the target application scene based on the target application scene; wherein the object model is obtained according to the method of the first aspect; and inputting the face image to be recognized into the target model to obtain a face recognition result corresponding to the face image to be recognized.
To solve the above technical problem, a third aspect of the present application provides an electronic device, including: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor calls the program data to execute the method of the first aspect or the second aspect.
In order to solve the above technical problem, a fourth aspect of the present application provides a computer-readable storage medium having stored thereon program data, which when executed by a processor, implements the method of the first aspect or the second aspect.
The beneficial effect of this application is: the method comprises the steps of obtaining a first face image set of a first model in a target application scene, merging image sequences belonging to the same face in the first face image set, thereby realizing automatic calibration of the image sequences belonging to the same face, obtaining a second face image set, quantizing the first model layer by layer, wherein each layer adopts a quantization strategy corresponding to each layer, so that when each layer in the first model is quantized, the quantization strategies are matched with the target application scene, the precision loss of the second face image set after passing through each layer of the first model is smaller than a first threshold value, thereby obtaining the second model, cutting channels in each layer of the second model layer by layer, so that the second model is matched with the target application scene when the channels are cut in each layer, and the precision loss of the second face image set after passing through each layer of the second model is smaller than a second threshold value, thereby obtaining a compressed target model in a target application scene.
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. Wherein:
FIG. 1 is a schematic flow chart diagram of one embodiment of a model compression method of the present application;
FIG. 2 is a schematic flow chart diagram of another embodiment of a model compression method of the present application;
FIG. 3 is a schematic flow chart diagram illustrating an embodiment of a face recognition method according to the present application;
FIG. 4 is a schematic structural diagram of an embodiment of an electronic device of the present application;
FIG. 5 is a schematic structural diagram of an embodiment of a computer-readable storage medium according to the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship. Further, the term "plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a schematic flow chart diagram illustrating an embodiment of a model compression method according to the present application, the method including:
s101: and acquiring a first face image set of the first model in a target application scene, and merging image sequences of the same face in the first face image set to acquire a second face image set.
Specifically, the first model is deployed in a target application scene, so that a certain number of face images are acquired by a camera in the target application scene, and a first face image set of the first model in the target application scene is obtained.
Furthermore, each collected target corresponds to a group of image sequences in the first face image set, and the image sequences belonging to the same face image in the first face image set are combined to obtain a second face image set.
In an application mode, when the number of image sequences in a first face image set exceeds a preset value, image sequence comparison is carried out on the first face image set so as to merge image sequences belonging to the same face, and therefore a second face image set is obtained.
In another application mode, after each group of image sequences is added in the first face image set, the added image sequences are compared with the image sequences stored in the first face image set, so that the image sequences belonging to the same face are combined, and when the number of the image sequences in the first face image set reaches a preset value, the current first face image set is extracted to serve as the second face image set.
Specifically, when the image sequences are compared, representative face images are extracted from the image sequences, and then feature comparison is performed between every two representative face images to judge whether the representative face images belong to the same face, so that automatic calibration of the image sequences belonging to the same face is realized, and the image sequences corresponding to the representative face images belonging to the same face are combined.
S102: and quantizing the first model layer by layer, and each layer adopts a respective quantization strategy, so that the precision loss of the second face image set after passing through each layer of the first model is smaller than a first threshold value, and the second model is obtained.
Specifically, when the first model is quantized, the difference is from the prior art, in the prior art, model quantization usually refers to quantizing model parameters from a floating point type to an int8 integer type, and when the model is quantized, a quantization strategy of each layer is consistent and cannot be matched with a target application scene.
Further, since the second face image set is composed of face images collected in the target application scene, when each layer in the first model is quantized, the precision loss of the second face image set after passing through each layer of the first model is smaller than a first threshold value, and then the quantization strategy corresponding to each layer of the first model can be matched with the current target application scene, so that the second model obtained after each layer in the first model is quantized is more matched with the target application scene.
In an application mode, quantization bits are set layer by layer for each layer in the first model, so that after the quantization bits in the quantization strategy corresponding to each layer are set, the precision loss of the second face image set after passing through each layer of the first model is smaller than a first threshold value.
In a specific application scenario, when the first model is quantized layer by layer, the quantization digit number is tried, wherein the range of the quantization digit number is 2-32 bits in the binary digit number, the quantization digit number of each layer is set according to the sequence of the quantization digit numbers from large to small until the precision loss of the second face image set after passing through the current layer of the first model is smaller than a first threshold value, and then the current quantization digit number is used as the quantization digit number corresponding to the quantization strategy of the current layer.
S103: and cutting channels in each layer of the second model layer by layer, and enabling the precision loss of the second face image set after passing through each layer of the second model to be smaller than a second threshold value, so that the compressed target model under the target application scene is obtained.
Specifically, when the first model is quantized, the difference is from the prior art, in the prior art, model clipping usually deletes some fixed parameters in the model but cannot be matched with a target application scene, and when the second model is channel clipped, channels in each layer of the second model are respectively clipped, so that the precision loss of the second face image set after passing through each layer of the second model is smaller than a second threshold.
Furthermore, because the second face image set is composed of face images collected in the target application scene, when each layer in the second model is cut, the precision loss of the second face image set after passing through each layer of the second model is smaller than a second threshold value, and then each layer of the second model can be matched with the current target application scene after the channels of the cutting part of each layer, so that the target model obtained after each layer in the second model is subjected to channel cutting is more matched with the target application scene, and the compressed target model under the target application scene is obtained.
In an application mode, each layer in the first model is cut layer by layer, so that each layer corresponds to the cutting quantity of each channel, and the precision loss of the second face image set after passing through each layer of the second model is smaller than a second threshold value.
In a specific application scenario, channels of each layer of the second model are cut, only one channel is cut for all channels in the current layer of the second model at a time, so that the influence of each channel on the precision loss of the current layer is obtained, and the channel cutting mode of the current layer is determined based on the influence of different channels on the precision channels.
In another specific application scenario, the channel of each layer of the second model is cut, at least one channel of other channels of the current layer is removed on the basis of the last cutting in sequence, until the precision loss of the second face image set after passing through the current layer of the second model is greater than a second threshold, the cutting mode before the precision loss is greater than the second threshold is used as the cutting mode of the current layer.
The scheme includes that a first face image set of a first model in a target application scene is obtained, image sequences belonging to the same face in the first face image set are combined, automatic calibration of the image sequences belonging to the same face is achieved, a second face image set is obtained, the first model is quantized layer by layer, corresponding quantization strategies are adopted for each layer, when quantization is carried out on each layer in the first model, the quantization strategies are matched with the target application scene, precision loss of the second face image set after the second face image set passes through each layer of the first model is smaller than a first threshold value, the second model is obtained, channels in each layer of the second model are cut layer by layer, when channel cutting is carried out on each layer of the second model, the second model is matched with the target application scene, and precision loss of the second face image set after the second face image set passes through each layer of the second model is smaller than a second threshold value, thereby obtaining a compressed target model in a target application scene.
Referring to fig. 2, fig. 2 is a schematic flow chart diagram illustrating another embodiment of a model compression method according to the present application, the method including:
s201: and acquiring a first face image set of the first model in a target application scene, and merging image sequences of the same face in the first face image set to acquire a second face image set.
Specifically, after the first model is deployed in the target application scene, the first model is operated for a period of time to obtain a first face image set of the first model in the target application scene, image sequences of the same face in the first face image set are obtained, and the image sequences of the same face in the first face image set are merged to obtain a second face image set. The target application scenario includes, but is not limited to, different specific locations, for example: in places such as a corridor or an indoor space, the target application scene may be a scene in which the camera device includes different installation angles or the lens of the camera device is at least partially blocked.
In an application mode, extracting a representative face image corresponding to each image sequence in a first face image set; acquiring similarity values of every two representative face images, and judging the representative face images with the similarity values exceeding a third threshold value as the same face; and merging all image sequences corresponding to the same face to obtain a second face image set.
Specifically, in order to compare image sequences to obtain image sequences belonging to the same face, a representative face image is selected from the image sequences, the representative face images are subjected to feature comparison to obtain a similarity value between every two representative face images, when the similarity value exceeds a third threshold value, the representative face images are judged to belong to the same face, so that the image sequences belonging to the same face are automatically found, and all the image sequences belonging to the same face are combined to obtain a second face image set.
Further, image sequences belonging to the same face are automatically combined, so that a second face image set is subsequently utilized to determine that the first model is quantized layer by layer, and when the second model is cut layer by layer, the accuracy loss can be obtained based on the more accurate face image set, and the rationality of model compression is improved.
In a specific application scene, the face image with the highest quality score corresponding to each image sequence is used as a representative face image, wherein the face image in each image sequence is subjected to quality scoring for each face image by a quality scoring module during collection, so that the face image with the highest quality score is quickly extracted after the image sequence is obtained and used as the representative face image, and the representative face images are subjected to feature comparison, so that the image sequences belonging to the same face are obtained.
In another specific application scenario, the face image with the minimum sum of feature differences between each image sequence and other face images is used as a representative face image, wherein after the image sequences are obtained, feature comparison is performed between every two face images in the image sequences, and then the face image with the minimum sum of feature differences between each two face images in the image sequences is extracted and used as the representative face image, so that the accuracy of the representative face is improved, and the representative face images are subjected to feature comparison, so that the image sequences belonging to the same face are obtained.
S202: and starting from the first layer of the first model, obtaining the minimum quantization digit corresponding to the current layer of the first model, so that the precision loss of the second face image set after passing through the current layer is smaller than a first threshold value.
Specifically, a first layer of the first model is used as an initial current layer, a plurality of quantization digits are set for the current layer in the first model, and the minimum quantization digit with the minimum quantization digit is extracted from the quantization digits meeting the requirement that the precision loss is smaller than a first threshold value, so that the precision of quantization of each layer of the first model is improved, and the precision loss of a second face image set passing through the current layer is smaller than the first threshold value.
In an application mode, sequentially setting quantization bits for the current layer of the first model according to the sequence of the quantization bits from small to large; judging whether the precision loss of the second face image set after passing through the current layer is less than a first threshold value or not every time one quantization digit is set; if so, returning to the step of sequentially setting quantization digits for the current layer of the first model according to the sequence of the quantization digits from small to large so as to increase the quantization digits of the current layer; if not, subtracting one bit from the current quantization digit to obtain the minimum quantization digit of the current layer.
Specifically, when the quantization digit is set for the current layer, trying is performed from the minimum value of the quantization digit to the maximum value of the quantization digit according to the sequence from small to large of the quantization digits, judging whether the precision loss of the second face image set after passing through the current layer is smaller than a first threshold value or not every time one quantization digit is set, if so, adding the quantization digits of the current layer, continuously trying the quantization digit of the current layer until the precision loss of the second face image set after passing through the current layer of the first model is larger than the first threshold value, and subtracting one digit from the current quantization digit to obtain the minimum quantization digit corresponding to the quantization strategy of the current layer, so that the theoretical minimum quantization digit can be obtained when the current layer is quantized, and the compression precision of the first model is improved.
S203: it is determined whether each layer of the first model has been traversed.
Specifically, it is determined whether each layer in the first model has been quantized, and if not, the process proceeds to step S204, and if so, the process proceeds to step S205.
S204: and entering the next layer of the current layer.
Specifically, the next layer of the current layer is entered, the next layer of the current layer is used as a new current layer, and the steps of setting the quantization bits for the current layer of the first model in sequence from small to large in order to increase the quantization bits of the current layer are returned.
S205: and cutting one channel in the current layer of the second model from the first layer of the second model to obtain a plurality of first precision losses corresponding to the second face image after the current layers of different channels are cut.
Specifically, the first layer of the second model is used as an initial current layer, only one channel is cut for all channels in the current layer of the second model each time until each channel in the current layer is cut once, and therefore a plurality of first precision losses corresponding to the second face image after the current layers of different channels are cut are obtained.
S206: and acquiring the maximum channel number which can be clipped in the current layer based on the plurality of first precision losses.
Specifically, all first precision losses which can meet the condition that the precision loss sum is smaller than the second threshold value are obtained from the plurality of first precision losses, so that channels corresponding to all first precision losses of which the precision loss sum is smaller than the second threshold value are used as channels which can be cut, the maximum number of channels which can be cut in the current layer is obtained, and the compression rate of converting the second model into the target model is improved.
In an application mode, arranging a plurality of first precision losses according to the numerical value from small to large; and accumulating the first precision loss from the minimum value until the first precision loss exceeds a second threshold value, so as to obtain a channel corresponding to the first precision loss accumulated before the first precision loss exceeds the second threshold value, and further determine the maximum channel number which can be cut by the current layer.
Specifically, after a plurality of first precision losses are obtained, the first precision losses are arranged according to the numerical value sequence from small to large, the minimum values of the remaining first precision losses are sequentially obtained from the smallest first precision loss and accumulated, so that the precision loss sum is calculated, after the precision loss sum exceeds a second threshold, the first precision loss value accumulated for the last time is removed, so that channels corresponding to the first precision losses accumulated before the precision loss sum exceeds the second threshold are obtained, the maximum number of channels which can be cropped in the current layer is determined, and the precision loss of the second image set is smaller than the second threshold after passing through the current layer of the second model.
Optionally, the second threshold and the first threshold may be set to the same value or different values, for example, the first threshold and the second threshold are both set to 0.00001, and may be set to other values in other embodiments, which is not limited in this application.
S207: it is determined whether each layer of the second model has been traversed.
Specifically, it is determined whether each layer in the second model has been channel-clipped, if not, the process proceeds to step S208, and if so, the process proceeds to step S209.
S208: and entering the next layer of the current layer.
Specifically, the next layer of the current layer is entered, the next layer of the current layer is used as a new current layer, and the step of cutting one channel in the current layer of the second model is returned.
S209: and responding to the completion of channel clipping of each layer in the second model to obtain a compressed target model in the target application scene.
Specifically, when each layer in the second model completes channel clipping, the current settings are saved to obtain the compressed target model in the target application scenario.
Optionally, after each layer in the second model completes channel clipping, the target model is fine-tuned based on a second precision loss of the second face image set before and after passing through the target model, so as to enhance adaptability of the target model to the target application scene.
In this embodiment, after an uncompressed first model is set in a target application scene, a minimum quantization bit number of each layer in the first model is obtained layer by layer, so that the first model is more adaptive to the target application scene after quantization, thereby obtaining a second model, and a maximum channel number that can be cut off in each layer in the second model is obtained layer by layer, thereby obtaining the target model, so that the target model is more adaptive to the target application scene.
Referring to fig. 3, fig. 3 is a schematic flow chart of an embodiment of a face recognition method according to the present application, the method including:
s301: and obtaining a face image to be recognized in the target application scene.
Specifically, a to-be-recognized face image acquired in a target application scene is obtained by a camera device in the target application scene.
S302: and acquiring a target model corresponding to the target application scene based on the target application scene.
Specifically, according to a current target application scenario, a target model matching the target application scenario is obtained, where the target model is obtained according to the method in any of the above embodiments.
S303: and inputting the face image to be recognized into the target model to obtain a face recognition result corresponding to the face image to be recognized.
Specifically, the face image to be recognized is input into the target model, so that the target model outputs a face recognition result corresponding to the face image to be recognized, and the face recognition result is used for personnel gathering or security control.
In this embodiment, a first model is set in a specific target application scenario, the first model is quantized layer by layer and each layer adopts a respective quantization strategy, so that when each layer in the first model is quantized, the quantization strategy is matched with the target application scene, so that the accuracy loss of the second face image set after passing through each layer of the first model is less than the first threshold value, thereby obtaining a second model, cutting the channel in each layer of the second model layer by layer so as to ensure that the second model is matched with the target application scene when channel cutting is carried out in each layer, so that the accuracy loss of the second face image set after passing through each layer of the second model is less than the second threshold value, thereby obtaining a compressed target model in a target application scene, identifying the face image to be identified by using the target model, therefore, the delay of face recognition is reduced, and the accuracy of the face recognition result in the target application scene is improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an embodiment of an electronic device 40 of the present application, where the electronic device includes a memory 401 and a processor 402 coupled to each other, where the memory 401 stores program data (not shown), and the processor 402 calls the program data to implement the method in any of the embodiments described above, and the description of the related contents refers to the detailed description of the embodiments of the method described above, which is not repeated herein.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of a computer-readable storage medium 50 of the present application, the computer-readable storage medium 50 stores program data 500, and the program data 500 is executed by a processor to implement the method in any of the above embodiments, and the related contents are described in detail with reference to the above method embodiments and will not be described in detail herein.
It should be noted that, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A model compression method is applied to face recognition, and the method comprises the following steps:
obtaining a first face image set of a first model in a target application scene, and merging image sequences of the same face in the first face image set to obtain a second face image set;
quantizing the first model layer by layer, and adopting respective quantization strategies for each layer, so that the precision loss of the second face image set after passing through each layer of the first model is smaller than a first threshold value, and a second model is obtained;
and cutting channels in each layer of the second model layer by layer, and enabling the precision loss of the second face image set after passing through each layer of the second model to be smaller than a second threshold value, so as to obtain a compressed target model under the target application scene.
2. The model compression method of claim 1, wherein the step of quantizing the first model layer by layer, and employing a respective quantization strategy for each layer, so that the loss of accuracy of the second face image set after passing through each layer of the first model is less than a first threshold value comprises:
starting from a first layer of the first model, obtaining a minimum quantization bit number corresponding to a current layer of the first model, so that the precision loss of the second face image set after passing through the current layer is smaller than the first threshold value;
and entering the next layer of the current layer and returning to the step of obtaining the minimum quantization bit number corresponding to the current layer of the first model until each layer of the first model is traversed.
3. The method of claim 2, wherein the step of obtaining the minimum quantization bit number corresponding to the current layer of the first model comprises:
setting the quantization bits for the current layer of the first model in sequence from small to large;
judging whether the precision loss of the second face image set after passing through the current layer is less than the first threshold value or not every time one quantization bit number is set;
if so, returning to the step of sequentially setting the quantization digits for the current layer of the first model according to the sequence of the quantization digits from small to large so as to increase the quantization digits of the current layer;
if not, subtracting one bit from the current quantization digit to obtain the minimum quantization digit of the current layer.
4. The model compression method of claim 1, wherein the step of clipping the channels in each layer of the second model layer by layer and making the accuracy loss of the second face image set after passing through each layer of the second model less than a second threshold value comprises:
cutting one channel in the current layer of the second model from the first layer of the second model to obtain a plurality of first precision losses corresponding to the second face image after the current layers of different channels are cut;
obtaining the maximum channel number which can be cut by the current layer based on a plurality of first precision losses;
and entering the next layer of the current layer and returning to the step of cutting one channel in the current layer of the second model until each layer of the second model is traversed.
5. The model compression method of claim 4, wherein the step of obtaining the maximum number of channels that can be clipped for the current layer based on the plurality of first precision losses comprises:
arranging a plurality of first precision losses in numerical order from small to large;
and accumulating the first precision loss from the minimum value to exceed the second threshold value in sequence to obtain a channel corresponding to the first precision loss accumulated before exceeding the second threshold value, so as to determine the maximum channel number of the current layer which can be cut.
6. A method of compressing a model according to claim 1, wherein said step of merging image sequences belonging to the same face in said first set of face images to obtain a second set of face images comprises:
extracting representative face images corresponding to each image sequence in the first face image set;
acquiring similarity values of every two representative face images, and judging the representative face images with the similarity values exceeding a third threshold value as the same face;
and combining all the image sequences corresponding to the same face to obtain the second face image set.
7. The model compression method according to claim 6, wherein the step of extracting the representative face image corresponding to each image sequence in the first face image set comprises:
taking the face image with the highest quality score corresponding to each image sequence as the representative face image; alternatively, the first and second electrodes may be,
and taking the face image with the minimum sum of the feature differences between the face image and other face images in each image sequence as the representative face image.
8. A face recognition method, comprising:
obtaining a face image to be recognized in a target application scene;
acquiring a target model corresponding to the target application scene based on the target application scene; wherein the object model is obtained according to the method of any one of claims 1-7;
and inputting the face image to be recognized into the target model to obtain a face recognition result corresponding to the face image to be recognized.
9. An electronic device, comprising: a memory and a processor coupled to each other, wherein the memory stores program data that the processor calls to perform the method of any of claims 1-7 or 8.
10. A computer-readable storage medium, on which program data are stored, which program data, when being executed by a processor, carry out the method of any one of claims 1-7 or 8.
CN202110846659.9A 2021-07-26 2021-07-26 Model compression method, face recognition method, electronic device, and storage medium Pending CN113657590A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110846659.9A CN113657590A (en) 2021-07-26 2021-07-26 Model compression method, face recognition method, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110846659.9A CN113657590A (en) 2021-07-26 2021-07-26 Model compression method, face recognition method, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
CN113657590A true CN113657590A (en) 2021-11-16

Family

ID=78478726

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110846659.9A Pending CN113657590A (en) 2021-07-26 2021-07-26 Model compression method, face recognition method, electronic device, and storage medium

Country Status (1)

Country Link
CN (1) CN113657590A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109934300A (en) * 2019-03-21 2019-06-25 腾讯科技(深圳)有限公司 Model compression method, apparatus, computer equipment and storage medium
CN110232203A (en) * 2019-04-22 2019-09-13 山东大学 Knowledge distillation optimization RNN has a power failure prediction technique, storage medium and equipment in short term
CN111695375A (en) * 2019-03-13 2020-09-22 上海云从企业发展有限公司 Face recognition model compression algorithm based on model distillation, medium and terminal
US20200311552A1 (en) * 2019-03-25 2020-10-01 Samsung Electronics Co., Ltd. Device and method for compressing machine learning model
CN112488070A (en) * 2020-12-21 2021-03-12 上海交通大学 Neural network compression method for remote sensing image target detection
CN112861602A (en) * 2020-12-10 2021-05-28 华南理工大学 Face living body recognition model compression and transplantation method based on depth separable convolution
US20210192794A1 (en) * 2019-12-18 2021-06-24 Tiandy Technologies Co., Ltd. Feature compression algorithm based on neural network

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111695375A (en) * 2019-03-13 2020-09-22 上海云从企业发展有限公司 Face recognition model compression algorithm based on model distillation, medium and terminal
CN109934300A (en) * 2019-03-21 2019-06-25 腾讯科技(深圳)有限公司 Model compression method, apparatus, computer equipment and storage medium
US20200311552A1 (en) * 2019-03-25 2020-10-01 Samsung Electronics Co., Ltd. Device and method for compressing machine learning model
CN110232203A (en) * 2019-04-22 2019-09-13 山东大学 Knowledge distillation optimization RNN has a power failure prediction technique, storage medium and equipment in short term
US20210192794A1 (en) * 2019-12-18 2021-06-24 Tiandy Technologies Co., Ltd. Feature compression algorithm based on neural network
CN112861602A (en) * 2020-12-10 2021-05-28 华南理工大学 Face living body recognition model compression and transplantation method based on depth separable convolution
CN112488070A (en) * 2020-12-21 2021-03-12 上海交通大学 Neural network compression method for remote sensing image target detection

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ZHISHENG ZHONG 等: "Channel-Level Variable Quantization Network for Deep Image Compression", 《ARXIV》, 15 July 2020 (2020-07-15) *
孙彦丽;叶炯耀;: "基于剪枝与量化的卷积神经网络压缩方法", 计算机科学, no. 08, 31 August 2020 (2020-08-31) *
高晗 等: "深度学习模型压缩与加速综述", 《软件学报》, vol. 32, no. 01, 31 January 2021 (2021-01-31) *

Similar Documents

Publication Publication Date Title
CN110555847B (en) Image processing method and device based on convolutional neural network
CN110147710B (en) Method and device for processing human face features and storage medium
CN106937114B (en) Method and device for detecting video scene switching
EP1542155A1 (en) Object detection
US20020047936A1 (en) Moving image processing apparatus and method, and computer readable memory
CN111091106B (en) Image clustering method and device, storage medium and electronic device
CN113783717B (en) Smart city network flow prediction method and system
EP1542154A2 (en) Object detection
CN109697725B (en) Background filtering method and device and computer readable storage medium
CN108961316A (en) Image processing method, device and server
CN115858861A (en) Video compression method, electronic device and computer-readable storage medium
CN115115540A (en) Unsupervised low-light image enhancement method and unsupervised low-light image enhancement device based on illumination information guidance
JP5192437B2 (en) Object region detection apparatus, object region detection method, and object region detection program
CN113657590A (en) Model compression method, face recognition method, electronic device, and storage medium
CN112883213B (en) Picture archiving method and device and electronic equipment
CN111241930A (en) Method and system for face recognition
CN103916677A (en) Advertisement video identifying method and device
CN115830342A (en) Method and device for determining detection frame, storage medium and electronic device
CN113628248B (en) Pedestrian residence time length determining method and device and computer readable storage medium
CN110582091B (en) Method and apparatus for locating wireless quality problems
CN105516735A (en) Representation frame acquisition method and representation frame acquisition apparatus
CN104462422A (en) Object processing method and device
CN112020723A (en) Training method and device for classification neural network for semantic segmentation, and electronic equipment
CN104754248A (en) Method and device for acquiring target snapshot
CN111507424B (en) Data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination